Skip to content
Snippets Groups Projects
Commit f0005bb4 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

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.
parent 6c3d0e9a
No related branches found
No related tags found
No related merge requests found
Showing with 40 additions and 0 deletions
......@@ -145,6 +145,7 @@ add_RunCMake_test(TargetSources)
add_RunCMake_test(find_dependency)
add_RunCMake_test(CompileDefinitions)
add_RunCMake_test(CompileFeatures)
add_RunCMake_test(PolicyScope)
add_RunCMake_test(WriteCompilerDetectionHeader)
if(NOT WIN32)
add_RunCMake_test(PositionIndependentCode)
......
cmake_minimum_required(VERSION 2.8.12)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
include(RunCMake)
run_cmake(parent-dir-generate-time)
run_cmake(dir-in-macro-generate-time)
0
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.
include(dir-in-macro-include.cmake)
enable_language(CXX)
# This does not affect dir1 despite being set before the add_subdirectory.
cmake_policy(SET CMP0044 NEW)
add_subdirectory(dir1)
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}>)
int main()
{
return 0;
}
0
enable_language(CXX)
add_subdirectory(dir1)
# This affects dir1 despite being set after the add_subdirectory.
cmake_policy(SET CMP0044 NEW)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment