mirror of
https://github.com/allankoechke/soci.git
synced 2026-11-30 10:58:24 +00:00
CMakeLists.txt: ensure build types are displayed for multi-config generators correctly
This commit is contained in:
@@ -45,6 +45,9 @@ option(SOCI_TESTS "Enable building SOCI test cases" ${PROJECT_IS_TOP_LEVEL})
|
||||
option(WITH_BOOST "Enable Boost support" ON)
|
||||
cmake_dependent_option(SOCI_LTO "Enable link time optimizations in release builds" ON "LTO_AVAILABLE" OFF)
|
||||
|
||||
# Determine if the CMake generator is single or multi config. This will be
|
||||
# useful later when printing the SOCI configuration in show_config.
|
||||
get_property(SOCI_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
|
||||
# Configure LTO for anything but Debug builds (if enabled in the first place)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${SOCI_LTO})
|
||||
@@ -159,10 +162,16 @@ endif()
|
||||
|
||||
# Also make it possible to see SOCI configuration later.
|
||||
add_custom_target(show_config
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "SOCI ${SOCI_VERSION} configured with:"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " Build type: ${CMAKE_BUILD_TYPE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " Library type: ${SOCI_LIB_TYPE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo " Enabled backends: ${SOCI_ENABLED_BACKENDS}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
"SOCI ${SOCI_VERSION} configured with:"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
# If using multi-config generator CMAKE_BUILD_TYPE is not meaningful. One
|
||||
# would instead select a build type from CMAKE_CONFIGURATION_TYPES.
|
||||
" Build type: $<IF:${SOCI_IS_MULTI_CONFIG},${CMAKE_CONFIGURATION_TYPES},${CMAKE_BUILD_TYPE}>"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
" Library type: ${SOCI_LIB_TYPE}"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo
|
||||
" Enabled backends: ${SOCI_ENABLED_BACKENDS}"
|
||||
COMMENT
|
||||
"Show SOCI build configuration summary"
|
||||
VERBATIM
|
||||
|
||||
Reference in New Issue
Block a user