Fix OpenMP for old CMake on Linux

This commit is contained in:
Sebastian Messmer 2018-09-25 00:41:03 -07:00
parent a10dd04dea
commit 3c10e095d8

View File

@ -17,7 +17,12 @@ if(NOT DISABLE_OPENMP)
target_link_libraries(cryptopp PRIVATE -lomp)
else()
find_package(OpenMP)
if (NOT OpenMP_CXX_LIBRARIES)
# Older CMake didn't have OpenMP_CXX_LIBRARIES defined yet, but passed the library in OpenMP_CXX_FLAGS
set(OpenMP_CXX_LIBRARIES ${OpenMP_CXX_FLAGS})
endif()
if(OPENMP_FOUND)
message(STATUS "Using OpenMP flags: ${OpenMP_CXX_FLAGS}")
message(STATUS "Using OpenMP library: ${OpenMP_CXX_LIBRARIES}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
target_link_libraries(cryptopp PRIVATE ${OpenMP_CXX_LIBRARIES})