From 08e6c7b7ddc8fdd1cbf85f809947d030b8c3f47a Mon Sep 17 00:00:00 2001 From: msclock Date: Mon, 2 Sep 2024 15:22:56 +0800 Subject: [PATCH] perf: register the print of current configuration (#119) Signed-off-by: msclock --- cmake/ProjectDefault.cmake | 6 ++++++ cmake/configure/Common.cmake | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cmake/ProjectDefault.cmake b/cmake/ProjectDefault.cmake index 2e02563..586f73f 100644 --- a/cmake/ProjectDefault.cmake +++ b/cmake/ProjectDefault.cmake @@ -17,3 +17,9 @@ include(${CMAKE_CURRENT_LIST_DIR}/install/Default.cmake) add_debug_macro() create_uninstall_target() + +# Show information about the current project +cmake_language(DEFER DIRECTORY ${CMAKE_SOURCE_DIR} CALL show_project_version) +cmake_language(DEFER DIRECTORY ${CMAKE_SOURCE_DIR} CALL + show_vcpkg_configuration) +cmake_language(DEFER DIRECTORY ${CMAKE_SOURCE_DIR} CALL show_installation) diff --git a/cmake/configure/Common.cmake b/cmake/configure/Common.cmake index a7b3240..6fede73 100644 --- a/cmake/configure/Common.cmake +++ b/cmake/configure/Common.cmake @@ -18,14 +18,15 @@ endmacro() #[[ Show vcpkg configurition ]] -macro(show_vcpkg_configuration) - message(STATUS "VCPKG_HOST_TRIPLET ${VCPKG_HOST_TRIPLET}") - message(STATUS "VCPKG_INSTALLED_DIR ${VCPKG_INSTALLED_DIR}") - message(STATUS "VCPKG_TARGET_TRIPLET ${VCPKG_TARGET_TRIPLET}") - message(STATUS "VCPKG_LIBRARY_LINKAGE ${VCPKG_LIBRARY_LINKAGE}") - message(STATUS "VCPKG_TARGET_IS_WINDOWS ${VCPKG_TARGET_IS_WINDOWS}") - message(STATUS "VCPKG_TARGET_IS_MINGW ${VCPKG_TARGET_IS_MINGW}") -endmacro() +function(show_vcpkg_configuration) + # Print all vcpkg variables + get_cmake_property(_vars VARIABLES) + foreach(_var IN LISTS _vars) + if(_var MATCHES "^VCPKG_") + message(STATUS "${_var} ${${_var}}") + endif() + endforeach() +endfunction() #[[ Add definition _DEBUG with config type Debug