CMake/Tests/RunCMake/CMP0026/clear-cached-information.cmake
Stephen Kelly 2514e4265c CMP0026: Use compatibility codepath until configure is finished (#15748)
Use it instead of the similar cmMakefile API.  It is necessary to
know that the Configure step is completely done, not just that one
particular cmMakefile is finished configuring.

Prior to commit 611220f7 (cmTarget: Use reliable test for CMP0024 and CMP0026
OLD., 2015-07-25), this was determined by checking whether cmGeneratorTargets
exist yet, which happens after the Configure step.
2015-09-18 20:49:00 +02:00

15 lines
535 B
CMake

enable_language(C)
cmake_policy(SET CMP0026 OLD)
add_subdirectory(clear-cached-information-dir)
# Critical: this needs to happen in root CMakeLists.txt and not inside
# the subdir.
get_target_property(mypath Hello LOCATION)
# Now we create the file later, so you can see, ultimately no error should
# happen e.g. during generate phase:
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE)