Disable OpenMP on MSVC because it doesn't support OpenMP 4.0 which is needed by crypto++ and then crashes the build.

This commit is contained in:
Sebastian Messmer 2018-09-26 00:21:21 -07:00
parent 3c10e095d8
commit e132ce4ca8

View File

@ -15,10 +15,13 @@ if(NOT DISABLE_OPENMP)
message(STATUS "Applying workaround for OSX OpenMP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fopenmp")
target_link_libraries(cryptopp PRIVATE -lomp)
elseif(MSVC)
message(WARNING "MSVC does not support the OpenMP 4.0 standard used by Crypto++. Disabling OpenMP. This can cause degraded performance.")
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
message(STATUS "We are on an older CMake that does not set OpenMP_CXX_LIBRARIES. Setting it from OpenMP_CXX_FLAGS.")
set(OpenMP_CXX_LIBRARIES ${OpenMP_CXX_FLAGS})
endif()
if(OPENMP_FOUND)