CMAKE_CONFIGURE_DEPENDS does not support generation expressions
CMAKE_CONFIGURE_DEPENDS does not support generation expressions, therefore files generated at generation time cannot be added as configuration dependencies.
In our case, we are generating some files (per configuration) that are used by the binaries. If those files are manually, they dont get regenerated, so we were trying to use CMAKE_CONFIGURE_DEPENDS to make them dependencies of configuration and get ZERO_CHECK to kick in if they are deleted.
Example:
cmake_minimum_required(VERSION 3.20)
project(bug_test)
set(generatedfile bin/$<CONFIG>/generatedfile.txt) # Doesnt work
#set(generatedfile bin/generatedfile.txt) # works
file(GENERATE OUTPUT ${generatedfile} CONTENT "some content")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_BINARY_DIR}/${generatedfile})
When inspecting the generated CMakeFiles\generate.stamp.depend
, the file "generatedfile.txt" doesnt show up.
Changing the path of "generatedfile" to not contain the generation expression adds it to CMakeFiles\generate.stamp.depend
If I am not mistaken, the fix should be done around here: In https://github.com/Kitware/CMake/blob/66488d4eb31d372d8e06ce78e5f49a7cc43974ee/Source/cmMakefile.cxx#L4039