Applying GENEX_EVAL to property that already contains GENEX_EVAL
There is following code:
cmake_minimum_required(VERSION 3.12)
project(test CXX)
add_executable(foo foo.cpp)
set_target_properties(
foo
PROPERTIES
"a" "$<GENEX_EVAL:$<TARGET_PROPERTY:b>>"
"b" "$<GENEX_EVAL:$<TARGET_PROPERTY:c>>"
"c" "$<GENEX_EVAL:$<TARGET_PROPERTY:d>>"
"d" "$<1:macarena>"
)
target_compile_options(foo PRIVATE "$<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:foo,a>>")
a
reads b
, b
reads c
, c
reads d
, d
have to be expanded as macarena
.
I expect compilation error due to unknown compiler option macarena
.
But:
- cmake 3.13.1 on Linux(Centos 7) just crashes.
- cmake 3.12.4 on Windows 10 produces following error:
CMake Error at CMakeLists.txt:14 (target_compile_options):
Error evaluating generator expression:
$<GENEX_EVAL:$<TARGET_PROPERTY:c>>
Dependency loop found.
CMake Error at CMakeLists.txt:14 (target_compile_options):
Loop step 1
$<GENEX_EVAL:$<TARGET_PROPERTY:b>>
CMake Error at CMakeLists.txt:14 (target_compile_options):
Loop step 2
$<TARGET_GENEX_EVAL:foo,$<TARGET_PROPERTY:foo,a>>
CMake Error:
Loop step 3
$<GENEX_EVAL:$<TARGET_PROPERTY:c>>
Probably if I update cmake on Windows I get crash as well.
Am I doing something wrong or this is cmake bug?
UPD:
I believe that problem places are assert
in TargetPropertyNode::Evaluate
and and if
in cmGeneratorExpressionDAGChecker::CheckGraph()
. If I remove them, everything works as expected.
Edited by yrHeTaTeJlb