mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-07 06:40:16 -05:00
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.
This commit is contained in:
committed by
Brad King
parent
1977f7833b
commit
462b6d83e8
@@ -4,6 +4,10 @@ run_cmake(CMP0070-NEW)
|
|||||||
run_cmake(CMP0070-OLD)
|
run_cmake(CMP0070-OLD)
|
||||||
run_cmake(CMP0070-WARN)
|
run_cmake(CMP0070-WARN)
|
||||||
|
|
||||||
|
run_cmake(SourceProperty)
|
||||||
|
run_cmake(SourceProperty-CMP0070-NEW)
|
||||||
|
run_cmake(SourceProperty-CMP0070-OLD)
|
||||||
|
|
||||||
run_cmake(CommandConflict)
|
run_cmake(CommandConflict)
|
||||||
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
||||||
run_cmake(OutputConflict)
|
run_cmake(OutputConflict)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
^CMake Error at SourceProperty-CMP0070-NEW.cmake:[0-9]+ \(add_library\):
|
||||||
|
Cannot find source file:
|
||||||
|
|
||||||
|
.*\/relative-output-NEW\.c
|
||||||
|
|
||||||
|
Tried extensions \.c \.C.*
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Generate step failed. Build files cannot be regenerated correctly.$
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
enable_language(C)
|
||||||
|
add_library(foo)
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0070 NEW)
|
||||||
|
file(GENERATE OUTPUT relative-output-NEW.c CONTENT "")
|
||||||
|
target_sources(foo PRIVATE
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/relative-output-NEW.c"
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
1
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
^CMake Deprecation Warning at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(cmake_policy\):
|
||||||
|
The OLD behavior for policy CMP0070 will be removed from a future version
|
||||||
|
of CMake.
|
||||||
|
|
||||||
|
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||||
|
policies are deprecated and that a policy should be set to OLD only under
|
||||||
|
specific short-term circumstances. Projects should be ported to the NEW
|
||||||
|
behavior and not rely on setting a policy to OLD.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at SourceProperty-CMP0070-OLD.cmake:[0-9]+ \(add_library\):
|
||||||
|
Cannot find source file:
|
||||||
|
|
||||||
|
.*\/relative-output-OLD\.c
|
||||||
|
|
||||||
|
Tried extensions \.c \.C.*
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Generate step failed. Build files cannot be regenerated correctly.$
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
enable_language(C)
|
||||||
|
add_library(foo)
|
||||||
|
|
||||||
|
cmake_policy(SET CMP0070 OLD)
|
||||||
|
file(GENERATE OUTPUT relative-output-OLD.c CONTENT "")
|
||||||
|
target_sources(foo PRIVATE
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/relative-output-OLD.c"
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
^CMake Deprecation Warning at SourceProperty.cmake:[0-9]+ \(cmake_policy\):
|
||||||
|
The OLD behavior for policy CMP0070 will be removed from a future version
|
||||||
|
of CMake.
|
||||||
|
|
||||||
|
The cmake-policies\(7\) manual explains that the OLD behaviors of all
|
||||||
|
policies are deprecated and that a policy should be set to OLD only under
|
||||||
|
specific short-term circumstances. Projects should be ported to the NEW
|
||||||
|
behavior and not rely on setting a policy to OLD.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:[0-9]+ \(include\)$
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
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"
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user