Files
cmake/Tests/RunCMake/test_include_dirs/TIDGenex-ctest-Release-check.cmake
T
Daksh Mamodiya 63316be823 TEST_INCLUDE_FILES: Evaluate generator expressions in include paths
The TEST_INCLUDE_FILE(S) directory properties were written verbatim into
CTestTestfile.cmake, so a $<CONFIG>-parameterized include path could not
select a per-configuration script and failed at ctest time.

Evaluate generator expressions per include entry in
cmLocalGenerator::GenerateTestFiles():

* Entries without a generator expression are emitted unchanged.
* On single-config generators a genex entry is evaluated once and
  emitted as one unconditional include.
* On multi-config generators it is evaluated for every configuration;
  a config-independent result collapses to one unconditional include,
  otherwise each non-empty per-config result is guarded by a
  CTEST_CONFIGURATION_TYPE branch, mirroring add_test().  An entry that
  evaluates to empty adds no include.

Promote cmScriptGenerator::CreateConfigTest to a public static helper so
the include guards reuse the exact add_test() config-test encoding; the
instance overloads now delegate to it.  Evaluated results are quoted via
cmScriptGenerator::Quote, while plain entries keep their raw
serialization.

Fixes: #27941
2026-07-23 18:58:04 +02:00

18 lines
797 B
CMake

# ctest -C Release (multi-config only): the Release per-config include runs;
# the Debug per-config include and the Debug-only conditional include do not.
if(NOT actual_stdout MATCHES "plain_test")
string(APPEND RunCMake_TEST_FAILED "plain_test missing with -C Release\n")
endif()
if(NOT actual_stdout MATCHES "indep_test")
string(APPEND RunCMake_TEST_FAILED "indep_test missing with -C Release\n")
endif()
if(NOT actual_stdout MATCHES "config_Release")
string(APPEND RunCMake_TEST_FAILED "config_Release missing with -C Release\n")
endif()
if(actual_stdout MATCHES "config_Debug")
string(APPEND RunCMake_TEST_FAILED "config_Debug ran under -C Release\n")
endif()
if(actual_stdout MATCHES "dbgonly_test")
string(APPEND RunCMake_TEST_FAILED "dbgonly_test ran under -C Release\n")
endif()