using Ninja results in cyclic dependency error. I used relative paths for conciseness. The behaviour is the same with absolute paths.
Normalizing paths with genex is a challenge, though. I tried other things but always hit the rule not found error.
here is a simplified version of the problem:
cmake_minimum_required(VERSION 3.20)
project(MyProj LANGUAGES NONE)
add_custom_target(test1 ALL
COMMAND ${CMAKE_COMMAND} -E echo "this line:$<TARGET_PROPERTY:test1,SOURCES>"
SOURCES foo.bar
COMMAND_EXPAND_LISTS
)
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test/build
this line:foo.bar /tmp/test/build/CMakeFiles/test1 /tmp/test/build/CMakeFiles/test1.rule
Built target test1
[Finished in 0.1s]
this version builds successfully.
it makes me think that CMake might have created a target-level dependency for target_property, even so this should only happen for TARGET_xxx_FILE
, etc.
these restrictions might to also apply to add_custom_command
.