mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-01 03:11:08 -06:00
Output files get the source property `GENERATED` which is indirectly checked by adding them to a library. For a missing file that is not generated CMake will abort. With the new behavior according CMP0070 relative files are generated into the binary directory.
15 lines
407 B
CMake
15 lines
407 B
CMake
enable_language(C)
|
|
add_library(SourceProperty)
|
|
|
|
cmake_policy(SET CMP0070 OLD)
|
|
file(GENERATE OUTPUT relative-output-OLD.c CONTENT "")
|
|
target_sources(SourceProperty PRIVATE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/relative-output-OLD.c"
|
|
)
|
|
|
|
cmake_policy(SET CMP0070 NEW)
|
|
file(GENERATE OUTPUT relative-output-NEW.c CONTENT "")
|
|
target_sources(SourceProperty PRIVATE
|
|
"${CMAKE_CURRENT_BINARY_DIR}/relative-output-NEW.c"
|
|
)
|