toltec-astro / macana2

AzTEC data reduction pipeline
0 stars 2 forks source link

CMake unable to find OpenMP on OS X 10.14 #1

Closed PaHorton closed 5 years ago

PaHorton commented 5 years ago

When running cmake, the linker is unable unable to find the OpenMP library:

CMake Error at CMakeLists.txt:73 (message):
  Cannot find OpenMP, abort

Here is the output of the homebrew installation of libomp:

==> Reinstalling libomp
==> Downloading https://homebrew.bintray.com/bottles/libomp-6.0.1.mojave.bottle.tar.gz
Already downloaded: /Users/paulhorton/Library/Caches/Homebrew/downloads/b4a4b5583565a13f5cbf05a8a1ab0d4c6953e1cc0cc6c944c0fc955812de055d--libomp-6.0.1.mojave.bottle.tar.gz
==> Pouring libomp-6.0.1.mojave.bottle.tar.gz
==> Caveats
On Apple Clang, you need to add several options to use OpenMP's front end
instead of the standard driver option. This usually looks like
  -Xpreprocessor -fopenmp -lomp

You might need to make sure the lib and include directories are discoverable
if /usr/local is not searched:

  -L/usr/local/opt/libomp/lib -I/usr/local/opt/libomp/include

For CMake, the following flags will cause the OpenMP::OpenMP_CXX target to
be set up correctly:
  -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" -DOpenMP_CXX_LIB_NAMES="omp" -DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib
==> Summary
🍺  /usr/local/Cellar/libomp/6.0.1: 12 files, 1.2MB

I have attempted to reinstall via homebrew but it appears that the issues is certain flags not being set in the cmake file that allow the library to be discoverable.

Any advice would be greatly appreciated!

PaHorton commented 5 years ago

It appears that changing the checks for OpenMP in the CMakeLists file do not follow Modern CMake's recommended check format. Changing OpenMP_FOUND to OpenMP_CXX_FOUND seems to work but I'm unsure if this is a proper fix.

PaHorton commented 5 years ago

Fixed in 3c36cd2f9eb1b7ed4c2c6a01680f86bafb6082ea