HI, I am using cmake 3.20. But it also happens with 3.28
In top level CMakeList.txt I do
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/version.cpp
${CMAKE_BINARY_DIR}/_version.cpp
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_SOURCE_DIR}/version.cmake
)
And later in same file I do
add_executable(chVersion
${CMAKE_BINARY_DIR}/version.cpp
chVersion.cc
)
And that works fine.
But if I refer to ${CMAKE_BINARY_DIR}/version.cpp
in another CMakeList.txt added via add_subdirectory, cmake complains that it cannot find it, and fails during configuration.
Is it supposed to not work.
Is there some work-around?