1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Tests/RunCMake/Ninja/AssumedSources.cmake
Deniz Bahadir ca4ce458a3 GENERATED prop: Check CMP0118 policy and warn in certain situations
* Adding tests for CMP0118 being unset (aka set to `WARN`).
* Adjusting the (unrelated) RunCMake.CMP0026 test to set CMP0118 to
  `NEW`,
* Adjusting the (unrelated) RunCMake.Ninja test to set CMP0118 to `OLD`.
* Adjusting the (unrelated) RunCMake.FileAPI test to set CMP0118 to
  `OLD`.

Note:
Setting CMP0118 to `NEW` and modifying the `GENERATED` property with
`set_property` or `set_source_files_properties` will currently NOT set
that property because the implementation is still to come.
2020-11-24 17:54:54 +01:00

22 lines
748 B
CMake

cmake_minimum_required(VERSION 3.8)
cmake_policy(SET CMP0118 OLD)
project(AssumedSources)
set_source_files_properties(
"${CMAKE_CURRENT_BINARY_DIR}/target.c"
"${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c"
PROPERTIES GENERATED 1)
add_executable(working
"${CMAKE_CURRENT_BINARY_DIR}/target.c"
"${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c")
add_custom_target(
gen-target.c ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target.c")
add_custom_target(
gen-target-no-depends.c ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/dep.c" "${CMAKE_CURRENT_BINARY_DIR}/target-no-depends.c")
add_dependencies(working gen-target.c)