Skip to content

Commit 02faa57

Browse files
convenience changes for cmake 4 and openmp on apple devices (#365)
1 parent d7f9e6d commit 02faa57

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMake/Common.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ endif()
7575

7676
option(USE_OpenMP "Use OpenMP" ON)
7777
if(USE_OpenMP)
78+
# Add the default openmp installation directory for apple systems
79+
if(APPLE)
80+
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH};/opt/homebrew/opt/libomp)
81+
endif()
7882
FIND_PACKAGE(OpenMP)
7983
if(OPENMP_FOUND)
8084
if (CMAKE_VERSION VERSION_GREATER "3.8")
@@ -83,6 +87,8 @@ if(USE_OpenMP)
8387
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
8488
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
8589
endif()
90+
else()
91+
message("OpenMP could not be found. On Apple devices, make sure to install it with `brew install libomp`.")
8692
endif()
8793
endif()
8894

0 commit comments

Comments
 (0)