Use interface libraries for vendor libraries
This commit is contained in:
parent
b228c4dd0d
commit
6164453c77
10
vendor/cryptopp/CMakeLists.txt
vendored
10
vendor/cryptopp/CMakeLists.txt
vendored
@ -1,11 +1,11 @@
|
|||||||
project(mycryptopp)
|
project(mycryptopp)
|
||||||
|
|
||||||
add_library(cryptopp dummy.cpp)
|
add_library(cryptopp INTERFACE)
|
||||||
# note: include directory is called vendor_cryptopp instead of cryptopp to avoid include clashes with system headers
|
# 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})
|
target_include_directories(cryptopp SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# Forward debug build info (i.e. set CRYPTOPP_DEBUG variable if building in debug mode)
|
# Forward debug build info (i.e. set CRYPTOPP_DEBUG variable if building in debug mode)
|
||||||
target_compile_definitions(cryptopp PUBLIC $<$<CONFIG:Debug>:CRYPTOPP_DEBUG>) # add to all targets depending on this
|
target_compile_definitions(cryptopp INTERFACE $<$<CONFIG:Debug>:CRYPTOPP_DEBUG>) # add to all targets depending on this
|
||||||
add_compile_options($<$<CONFIG:Debug>:-DCRYPTOPP_DEBUG>) # add to stuff built in subdirectories (like the actual library)
|
add_compile_options($<$<CONFIG:Debug>:-DCRYPTOPP_DEBUG>) # add to stuff built in subdirectories (like the actual library)
|
||||||
|
|
||||||
if(NOT DISABLE_OPENMP)
|
if(NOT DISABLE_OPENMP)
|
||||||
@ -68,8 +68,8 @@ if(NOT DISABLE_OPENMP)
|
|||||||
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS} ${Additional_OpenMP_Libraries_Workaround})
|
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS} ${Additional_OpenMP_Libraries_Workaround})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(cryptopp PUBLIC ${OpenMP_CXX_FLAGS}) # Workaround for Ubuntu 18.04 that otherwise doesn't set -fopenmp for linking
|
target_link_libraries(cryptopp INTERFACE ${OpenMP_CXX_FLAGS}) # Workaround for Ubuntu 18.04 that otherwise doesn't set -fopenmp for linking
|
||||||
target_link_libraries(cryptopp PUBLIC OpenMP::OpenMP_CXX)
|
target_link_libraries(cryptopp INTERFACE OpenMP::OpenMP_CXX)
|
||||||
|
|
||||||
# also add these flags to the third party Crypto++ build setup that is built in a subdirectory
|
# also add these flags to the third party Crypto++ build setup that is built in a subdirectory
|
||||||
message(STATUS "OpenMP flags: ${OpenMP_CXX_FLAGS}")
|
message(STATUS "OpenMP flags: ${OpenMP_CXX_FLAGS}")
|
||||||
@ -87,4 +87,4 @@ set(BUILD_STATIC ON CACHE BOOL "")
|
|||||||
set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING OFF CACHE BOOL "")
|
set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING OFF CACHE BOOL "")
|
||||||
add_subdirectory(vendor_cryptopp EXCLUDE_FROM_ALL)
|
add_subdirectory(vendor_cryptopp EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
target_link_libraries(cryptopp PRIVATE cryptopp-static)
|
target_link_libraries(cryptopp INTERFACE cryptopp-static)
|
||||||
|
0
vendor/cryptopp/dummy.cpp
vendored
0
vendor/cryptopp/dummy.cpp
vendored
9
vendor/googletest/CMakeLists.txt
vendored
9
vendor/googletest/CMakeLists.txt
vendored
@ -7,13 +7,12 @@ if (BUILD_TESTING)
|
|||||||
set(INSTALL_GMOCK off CACHE BOOL "" FORCE)
|
set(INSTALL_GMOCK off CACHE BOOL "" FORCE)
|
||||||
add_subdirectory(gtest EXCLUDE_FROM_ALL)
|
add_subdirectory(gtest EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
project (googletest)
|
add_library(googletest INTERFACE)
|
||||||
add_library(${PROJECT_NAME} dummy.cpp)
|
target_link_libraries(googletest INTERFACE gtest gmock)
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC gtest gmock)
|
target_include_directories(googletest SYSTEM INTERFACE ${gtest_INCLUDE_DIRS}/include SYSTEM INTERFACE ${gmock_INCLUDE_DIRS}/include)
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE ${gtest_INCLUDE_DIRS}/include SYSTEM ${gmock_INCLUDE_DIRS}/include)
|
|
||||||
|
|
||||||
# Disable "missing override" warning because gmock MOCK_METHOD() don't use override :(
|
# Disable "missing override" warning because gmock MOCK_METHOD() don't use override :(
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-inconsistent-missing-override")
|
target_compile_options(googletest INTERFACE "-Wno-inconsistent-missing-override")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
0
vendor/googletest/dummy.cpp
vendored
0
vendor/googletest/dummy.cpp
vendored
10
vendor/range-v3/CMakeLists.txt
vendored
10
vendor/range-v3/CMakeLists.txt
vendored
@ -1,8 +1,2 @@
|
|||||||
project (range-v3)
|
add_library(range-v3 INTERFACE)
|
||||||
|
target_include_directories(range-v3 SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/range-v3/include)
|
||||||
set(SOURCES
|
|
||||||
dummy.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
|
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/range-v3/include)
|
|
||||||
|
0
vendor/range-v3/dummy.cpp
vendored
0
vendor/range-v3/dummy.cpp
vendored
10
vendor/spdlog/CMakeLists.txt
vendored
10
vendor/spdlog/CMakeLists.txt
vendored
@ -1,8 +1,2 @@
|
|||||||
project (spdlog)
|
add_library(spdlog INTERFACE)
|
||||||
|
target_include_directories(spdlog SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
set(SOURCES
|
|
||||||
dummy.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
|
0
vendor/spdlog/dummy.cpp
vendored
0
vendor/spdlog/dummy.cpp
vendored
Loading…
Reference in New Issue
Block a user