Enforce OpenMP build by default, but allow disabling it with a cmake flag
This commit is contained in:
parent
72f123e38e
commit
a087f7dc8a
@ -17,6 +17,7 @@ require_clang_version(3.7)
|
||||
# Default value is not to build test cases
|
||||
option(BUILD_TESTING "build test cases" OFF)
|
||||
option(CRYFS_UPDATE_CHECKS "let cryfs check for updates and security vulnerabilities" ON)
|
||||
option(DISABLE_OPENMP "allow building without OpenMP libraries. This will cause performance degradations." OFF)
|
||||
|
||||
# Default value is to build in release mode
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
|
17
vendor/cryptopp/CMakeLists.txt
vendored
17
vendor/cryptopp/CMakeLists.txt
vendored
@ -4,14 +4,15 @@ add_library(cryptopp dummy.cpp)
|
||||
# note: include directory is called vendor_cryptopp instead of cryptopp to avoid include clashes with system headers
|
||||
target_include_directories(cryptopp SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
message(STATUS "Building crypto++ with OpenMP")
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS})
|
||||
target_link_libraries(cryptopp PRIVATE ${OpenMP_CXX_FLAGS})
|
||||
else(OPENMP_FOUND)
|
||||
message(WARNING "Did not find OpenMP. Performance might be degraded.")
|
||||
endif(OPENMP_FOUND)
|
||||
if(NOT DISABLE_OPENMP)
|
||||
find_package(OpenMP)
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS})
|
||||
target_link_libraries(cryptopp PRIVATE ${OpenMP_CXX_FLAGS})
|
||||
else(OPENMP_FOUND)
|
||||
message(FATAL_ERROR "Did not find OpenMP. Build with -DDISABLE_OPENMP=ON if you want to allow this and are willing to take the performance hit.")
|
||||
endif(OPENMP_FOUND)
|
||||
endif(NOT DISABLE_OPENMP)
|
||||
|
||||
|
||||
set(BUILD_TESTING OFF)
|
||||
|
Loading…
Reference in New Issue
Block a user