Use OpenMP_CXX_INCLUDE_DIRS, fix OpenMP_CXX_FLAGS usage
These are fixes for issues encountered building VTK-m 1.6.0 with AppleClang 1200.0.32.29 (Xcode 12.4 command line tools) on macOS 10.15.7 with an external OpenMP runtime (libomp 13 from MacPorts).
-
Use
OpenMP_CXX_INCLUDE_DIRS
if set: Compilers such as AppleClang do not include OpenMP headers. Specifying the path to OpenMP headers usingOpenMP_CXX_INCLUDE_DIR
during configure may cause theOpenMP_CXX_INCLUDE_DIRS
variable to be set (see https://cmake.org/cmake/help/latest/module/FindOpenMP.html), which if not used during the build will cause fatal errors due to omp.h not being found. -
Convert
OpenMP_CXX_FLAGS
from space-separated list to semicolon-separated list before appending to compiler options in order to avoid warnings from AppleClang during build caused by-Xclang -fopenmp
being treated as one argument rather than two:
clang: warning: argument unused during compilation: '-Xclang -fopenmp' [-Wunused-command-line-argument]