Skip to content

more stringency when exporting WM_ compiler settings

  • for building 3rd-party components, we export WM_CC and WM_CXX compiler settings as CC and CXX so the configure/CMake know about them. However, when trying to build something like Clang we can experience issues. The OpenFOAM env sets ThirdParty Clang (setting WM_CC in the process), but this is the component we are trying to build, so makeLLVM will have problems configuring for this non-existent compiler.
  1. can avoid this by using makeLLVM -gcc to force use of gcc for making Clang. This seems to be an ok alternative, since this isn't part of the normal OpenFOAM process (we are building the toolchain for building OpenFOAM).

  2. check within the ThirdParty scripts that the exported CC variable corresponds to a command. Eg,

     if test -n "$WM_CC" && command -v "$WM_CC" >/dev/null
     then
         export CC="$WM_CC"
         [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
     fi

Probably the second one is OK to include too, but targeted for the next release.

Edited by Mark OLESEN