From 005e32d9318fa7bbeca501ae09c116ef5246d91a Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Sun, 28 Sep 2025 12:49:37 +0200 Subject: [PATCH 1/2] Avoid installing libraries multiple times or issueing wrong message Some libraries call `boost_install` themselves which adds `INSTALL_INTERFACE` to their `INTERFACE_INCLUDE_DIRETORIES` property. That then makes the install check in `__boost_auto_install` fail and print a message that the library won't be installed while it will be. Use a label to detect targets for which `boost_install` was already called and skip the logic in `__boost_auto_install` for those. --- include/BoostInstall.cmake | 4 ++++ include/BoostRoot.cmake | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/BoostInstall.cmake b/include/BoostInstall.cmake index 1127c6f..f918c04 100644 --- a/include/BoostInstall.cmake +++ b/include/BoostInstall.cmake @@ -320,6 +320,10 @@ function(boost_install_target) install(EXPORT ${LIB}-targets DESTINATION "${CONFIG_INSTALL_DIR}" NAMESPACE Boost:: FILE ${LIB}-targets.cmake) + get_target_property(labels ${LIB} LABELS) + list(APPEND labels boost_install_specified) + set_target_properties(${LIB} PROPERTIES LABELS "${labels}") + set(CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/tmpinst/${LIB}-config.cmake") set(CONFIG_FILE_CONTENTS "# Generated by BoostInstall.cmake for ${LIB}-${__VERSION}\n\n") diff --git a/include/BoostRoot.cmake b/include/BoostRoot.cmake index bd7f8be..d0d48ba 100644 --- a/include/BoostRoot.cmake +++ b/include/BoostRoot.cmake @@ -182,6 +182,11 @@ function(__boost_auto_install __boost_lib) if(TARGET "Boost::${__boost_lib_target}" AND TARGET "boost_${__boost_lib_target}") + get_target_property(labels "boost_${__boost_lib_target}" LABELS) + if("boost_install_specified" IN_LIST labels) + return() # Ignore libraries for which boost_install was already called + endif() + get_target_property(__boost_lib_incdir "boost_${__boost_lib_target}" INTERFACE_INCLUDE_DIRECTORIES) set(incdir "${BOOST_SUPERPROJECT_SOURCE_DIR}/libs/${__boost_lib}/include") From 247de87d85f7b3c21cbb796237bfb329867077ef Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sun, 28 Sep 2025 18:47:43 +0200 Subject: [PATCH 2/2] Use custom property Since CMake 3.11 properties starting with underscores are considered custom properties and allowed. --- include/BoostInstall.cmake | 4 +--- include/BoostRoot.cmake | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/BoostInstall.cmake b/include/BoostInstall.cmake index f918c04..bdeb7d7 100644 --- a/include/BoostInstall.cmake +++ b/include/BoostInstall.cmake @@ -320,9 +320,7 @@ function(boost_install_target) install(EXPORT ${LIB}-targets DESTINATION "${CONFIG_INSTALL_DIR}" NAMESPACE Boost:: FILE ${LIB}-targets.cmake) - get_target_property(labels ${LIB} LABELS) - list(APPEND labels boost_install_specified) - set_target_properties(${LIB} PROPERTIES LABELS "${labels}") + set_target_properties(${LIB} PROPERTIES _boost_is_installed ON) set(CONFIG_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/tmpinst/${LIB}-config.cmake") set(CONFIG_FILE_CONTENTS "# Generated by BoostInstall.cmake for ${LIB}-${__VERSION}\n\n") diff --git a/include/BoostRoot.cmake b/include/BoostRoot.cmake index d0d48ba..ad37410 100644 --- a/include/BoostRoot.cmake +++ b/include/BoostRoot.cmake @@ -182,8 +182,8 @@ function(__boost_auto_install __boost_lib) if(TARGET "Boost::${__boost_lib_target}" AND TARGET "boost_${__boost_lib_target}") - get_target_property(labels "boost_${__boost_lib_target}" LABELS) - if("boost_install_specified" IN_LIST labels) + get_target_property(is_installed "boost_${__boost_lib_target}" _boost_is_installed) + if(is_installed) return() # Ignore libraries for which boost_install was already called endif()