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

Open
#1,018 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cmake
Domain
build-system

Research direction

Start with boost/libs/static_string/CMakeLists.txt at line 57 and compare its CONFIGURE_DEPENDS usage with the boost::beast example, which limits the glob to non-library mode. Reproduce the generated CMakeFiles/VerifyGlobs.cmake during configuration, then trace which Boost library CMake files add these checks. Done means establishing whether third-party library globs should be excluded while preserving user-project glob checks.

Written by the indexing model from the issue text.

Description

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 ()
Dominant language
HTML
Stars
8.6k
Forks
2k
Avg merge
9h 35m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/boost

All issues in boostorg/boost

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.