Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: set explicit transitive requirements on C++17 #48

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(NOT ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") AND (CMAKE_COMPILER_IS_GNUCXX OR
endif()

if(MSVC)
add_compile_definitions(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_SCL_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS)
add_compile_options(/EHsc /FAs)
endif()

Expand Down Expand Up @@ -95,7 +95,7 @@ install(EXPORT YOMM2Targets
)
# Configure package config (tells using code about dependencies)
configure_package_config_file(
cmake/Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/YOMM2Config.cmake
cmake/YOMM2Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/YOMM2Config.cmake
INSTALL_DESTINATION lib/cmake/YOMM2
)
# Copy config files to install directory
Expand Down
4 changes: 4 additions & 0 deletions cmake/Config.cmake.in → cmake/YOMM2Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

# Tell library users about the Boost dependency
find_dependency(Boost 1.74 REQUIRED)

# Add the targets file
include("${CMAKE_CURRENT_LIST_DIR}/YOMM2Targets.cmake")

check_required_components(YOMM2)
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ if(YOMM2_SHARED)
if(NOT WIN32)
target_compile_options(yomm2 PRIVATE -fvisibility=hidden)
endif()
target_compile_definitions(yomm2 PUBLIC -DYOMM2_SHARED=1)
target_compile_definitions(yomm2 PUBLIC YOMM2_SHARED=1)
target_include_directories(
yomm2 PUBLIC
$<BUILD_INTERFACE:${YOMM2_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PUBLIC $<TARGET_PROPERTY:Boost::headers,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries(yomm2 PUBLIC Boost::headers)
target_compile_features(yomm2 PUBLIC cxx_std_17)
if (${YOMM2_CHECK_ABI_COMPATIBILITY})
message(STATUS "type: ${CMAKE_BUILD_TYPE} FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
Expand All @@ -42,6 +43,7 @@ else()
$<INSTALL_INTERFACE:include>
)
target_link_libraries(yomm2 INTERFACE Boost::headers)
target_compile_features(yomm2 INTERFACE cxx_std_17)
endif()

install(TARGETS yomm2
Expand Down
Loading