Files
CMake/Tests/RunCMake/File_Generate/SourceProperty.cmake
Josef Angstenberger 462b6d83e8 file(GENERATE): Test source properties
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.
2020-08-19 09:05:53 -04:00

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"
)