Skip to content

Commit

Permalink
Fix compilation in OSX Catalina with OMP enabled
Browse files Browse the repository at this point in the history
- Explicitly add linker flags from OMP
  • Loading branch information
SergioRAgostinho committed Apr 10, 2020
1 parent 41a9d02 commit b54ad11
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
endif()

### ---[ Find universal dependencies

# Threads (required)
find_package(Threads REQUIRED)

# OpenMP (optional) needs to be included after Threads are found
find_package(OpenMP COMPONENTS C CXX)
if(OpenMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
Expand All @@ -299,14 +304,14 @@ if(OpenMP_FOUND)
else()
message(WARNING "Delay loading flag for OpenMP DLL is invalid.")
endif()
else()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_CXX_LIBRARIES}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_LIBRARIES}")
endif()
else()
message(STATUS "Not found OpenMP")
endif()

# Threads (required)
find_package(Threads REQUIRED)

# Eigen (required)
find_package(Eigen 3.1 REQUIRED)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
Expand Down

0 comments on commit b54ad11

Please sign in to comment.