Skip to content

Commit

Permalink
Remove hardcode
Browse files Browse the repository at this point in the history
  • Loading branch information
cybaol committed Sep 20, 2024
1 parent 44d3154 commit e91faf0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,17 @@ endif()
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")
# libomp 15.0+ from brew is keg-only,
# because it can override GCC headers and result in broken builds,
# so have to search in other locations.
execute_process(COMMAND brew --prefix libomp
OUTPUT_VARIABLE HOMEBREW_LIBOMP_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${HOMEBREW_LIBOMP_PREFIX}/include")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${HOMEBREW_LIBOMP_PREFIX}/include")
set(OpenMP_C_LIB_NAMES omp)
set(OpenMP_CXX_LIB_NAMES omp)
set(OpenMP_omp_LIBRARY ${HOMEBREW_LIBOMP_PREFIX}/lib/libomp.dylib)
endif()
find_package(OpenMP COMPONENTS C CXX)
endif()
Expand Down

0 comments on commit e91faf0

Please sign in to comment.