Tests: Verify generate-time policy scope behavior.
If some day there are no policies checked through the makefile at generate time, this can be fixed.
This commit is contained in:
parent
6c3d0e9a6b
commit
f0005bb484
|
@ -145,6 +145,7 @@ add_RunCMake_test(TargetSources)
|
||||||
add_RunCMake_test(find_dependency)
|
add_RunCMake_test(find_dependency)
|
||||||
add_RunCMake_test(CompileDefinitions)
|
add_RunCMake_test(CompileDefinitions)
|
||||||
add_RunCMake_test(CompileFeatures)
|
add_RunCMake_test(CompileFeatures)
|
||||||
|
add_RunCMake_test(PolicyScope)
|
||||||
add_RunCMake_test(WriteCompilerDetectionHeader)
|
add_RunCMake_test(WriteCompilerDetectionHeader)
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
add_RunCMake_test(PositionIndependentCode)
|
add_RunCMake_test(PositionIndependentCode)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
|
|
@ -0,0 +1,4 @@
|
||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(parent-dir-generate-time)
|
||||||
|
run_cmake(dir-in-macro-generate-time)
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,5 @@
|
||||||
|
CMake Warning \(dev\) at dir1/CMakeLists.txt:5 \(target_compile_definitions\):
|
||||||
|
Policy CMP0044 is not set: Case sensitive <LANG>_COMPILER_ID generator
|
||||||
|
expressions. Run "cmake --help-policy CMP0044" for policy details. Use
|
||||||
|
the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
include(dir-in-macro-include.cmake)
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
# This does not affect dir1 despite being set before the add_subdirectory.
|
||||||
|
cmake_policy(SET CMP0044 NEW)
|
||||||
|
add_subdirectory(dir1)
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
add_library(foo STATIC foo.cpp)
|
||||||
|
string(TOLOWER ${CMAKE_CXX_COMPILER_ID} compiler_id)
|
||||||
|
target_compile_definitions(foo PRIVATE Foo=$<CXX_COMPILER_ID:${compiler_id}>)
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
0
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
enable_language(CXX)
|
||||||
|
|
||||||
|
add_subdirectory(dir1)
|
||||||
|
|
||||||
|
# This affects dir1 despite being set after the add_subdirectory.
|
||||||
|
cmake_policy(SET CMP0044 NEW)
|
Loading…
Reference in New Issue