Don't give build summary again if it hasn't changed

Avoid giving the summary and again and again and again when rerunning
CMake due to some change in CMakeLists.txt: this is especially important
when using the library via add_subdirectory() and the change happens in
some files not related to SOCI at all.
This commit is contained in:
Vadim Zeitlin
2025-07-24 22:13:56 +02:00
parent cbcd5529bb
commit 21e2ff016a

View File

@@ -131,9 +131,18 @@ install(
DESTINATION "${SOCI_INSTALL_CMAKEDIR}"
)
# Final status
# Give build summary at the end but only if it's the first time we're running,
# as indicated by SOCI_SUMMARY not being cached yet, or if it has changed.
set(SOCI_SUMMARY_NOW
"${SOCI_VERSION}-${SOCI_LIB_TYPE}-${SOCI_ENABLED_BACKENDS}-${CMAKE_BUILD_TYPE}"
)
if(NOT "${SOCI_SUMMARY_NOW}" STREQUAL "$CACHE{SOCI_SUMMARY}")
set(SOCI_SUMMARY ${SOCI_SUMMARY_NOW} CACHE INTERNAL "SOCI internal build summary")
if (CMAKE_BUILD_TYPE)
set(SOCI_CONFIG_DESCRIPTION " in ${CMAKE_BUILD_TYPE} configuration")
endif()
message(STATUS "SOCI ${SOCI_VERSION} will be built as ${SOCI_LIB_TYPE} library${SOCI_CONFIG_DESCRIPTION}.")
message(STATUS "Enabled SOCI backends are: ${SOCI_ENABLED_BACKENDS}")
endif()