boost icon indicating copy to clipboard operation
boost copied to clipboard

[CMake] Why some libs use `CONFIGURE_DEPENDS`???

Open Challanger524 opened this issue 10 months ago • 0 comments

It causes creation of ...\CMakeFiles\VerifyGlobs.cmake polluted with glob checks for certain boost libraries:

Spoiler
# CMAKE generated file: DO NOT EDIT!
# Generated by CMake Version 3.29
cmake_policy(SET CMP0009 NEW)

# BOOST_STATIC_STRING_HEADERS at C:/*/dev/boost/libs/static_string/CMakeLists.txt:57 (file)
file(GLOB_RECURSE NEW_GLOB LIST_DIRECTORIES false "C:/*/dev/boost/libs/static_string/include/boost/*.hpp")
set(OLD_GLOB
  "C:/*/dev/boost/libs/static_string/include/boost/static_string.hpp"
  "C:/*/dev/boost/libs/static_string/include/boost/static_string/config.hpp"
  "C:/*/dev/boost/libs/static_string/include/boost/static_string/static_string.hpp"
  )
if(NOT "${NEW_GLOB}" STREQUAL "${OLD_GLOB}")
  message("-- GLOB mismatch!")
  file(TOUCH_NOCREATE "C:/*/dev/bplan/out/build/msvc-dbg/CMakeFiles/cmake.verify_globs")
endif()

# BOOST_STATIC_STRING_HEADERS at C:/*/dev/boost/libs/static_string/CMakeLists.txt:57 (file)
file(GLOB_RECURSE NEW_GLOB LIST_DIRECTORIES false "C:/*/dev/boost/libs/static_string/include/boost/*.ipp")
set(OLD_GLOB
  )
if(NOT "${NEW_GLOB}" STREQUAL "${OLD_GLOB}")
  message("-- GLOB mismatch!")
  file(TOUCH_NOCREATE "C:/*/dev/bplan/out/build/msvc-dbg/CMakeFiles/cmake.verify_globs")
endif()

# BOOST_STATIC_STRING_HEADERS at C:/*/dev/boost/libs/static_string/CMakeLists.txt:57 (file)
file(GLOB_RECURSE NEW_GLOB LIST_DIRECTORIES false "C:/*/dev/boost/libs/static_string/include/boost/*.natvis")
set(OLD_GLOB
  )
if(NOT "${NEW_GLOB}" STREQUAL "${OLD_GLOB}")
  message("-- GLOB mismatch!")
  file(TOUCH_NOCREATE "C:/*/dev/bplan/out/build/msvc-dbg/CMakeFiles/cmake.verify_globs")
endif()

Image

There is no need to re-check globs for 3rd party libs that are being changed only on pulling updates (not frequent change). I believe VerifyGlobs.cmake should only contain user globs, if user specified CONFIGURE_DEPENDS in his own project.

Good alternative example is the boost::beast that uses glob only in non-library mode:

if (BOOST_BEAST_IS_ROOT)
    file(GLOB_RECURSE BOOST_BEAST_HEADERS CONFIGURE_DEPENDS include/boost/*.hpp)
    set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/boost PREFIX "" FILES ${BOOST_BEAST_HEADERS})
    target_sources(boost_beast PRIVATE ${BOOST_BEAST_HEADERS} build.jam)
endif ()

Challanger524 avatar Mar 12 '25 11:03 Challanger524