diff --git a/CMakeLists.txt b/CMakeLists.txt index f2d31d9e010..a300feae031 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,6 +287,13 @@ endif() # OpenMP (optional) option(WITH_OPENMP "Build with parallelization using OpenMP" TRUE) if(WITH_OPENMP) + if(APPLE) + set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include") + set(OpenMP_C_LIB_NAMES "omp") + set(OpenMP_CXX_FLAGS "${OpenMP_C_FLAGS}") + set(OpenMP_CXX_LIB_NAMES "${OpenMP_C_LIB_NAMES}") + set(OpenMP_omp_LIBRARY "/usr/local/opt/libomp/lib/libomp.dylib") + endif() find_package(OpenMP COMPONENTS C CXX) endif() if(OpenMP_FOUND)