diff options
Diffstat (limited to 'Tests')
20 files changed, 65 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 20d47b2..c274d8f 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -146,6 +146,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) @@ -162,6 +163,7 @@ add_RunCMake_test(Syntax) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) add_RunCMake_test(add_dependencies) +add_RunCMake_test(add_subdirectory) add_RunCMake_test(build_command) add_RunCMake_test(execute_process) add_RunCMake_test(export) diff --git a/Tests/RunCMake/PolicyScope/CMakeLists.txt b/Tests/RunCMake/PolicyScope/CMakeLists.txt new file mode 100644 index 0000000..667561e --- /dev/null +++ b/Tests/RunCMake/PolicyScope/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.12) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake new file mode 100644 index 0000000..d6c021f --- /dev/null +++ b/Tests/RunCMake/PolicyScope/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(parent-dir-generate-time) +run_cmake(dir-in-macro-generate-time) diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt new file mode 100644 index 0000000..d223f42 --- /dev/null +++ b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time-stderr.txt @@ -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. diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake new file mode 100644 index 0000000..04a7c2c --- /dev/null +++ b/Tests/RunCMake/PolicyScope/dir-in-macro-generate-time.cmake @@ -0,0 +1,2 @@ + +include(dir-in-macro-include.cmake) diff --git a/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake b/Tests/RunCMake/PolicyScope/dir-in-macro-include.cmake new file mode 100644 index 0000000..fd326f1 --- /dev/null +++ b/Tests/RunCMake/PolicyScope/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) diff --git a/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt new file mode 100644 index 0000000..16bcb36 --- /dev/null +++ b/Tests/RunCMake/PolicyScope/dir1/CMakeLists.txt @@ -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}>) diff --git a/Tests/RunCMake/PolicyScope/dir1/foo.cpp b/Tests/RunCMake/PolicyScope/dir1/foo.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/RunCMake/PolicyScope/dir1/foo.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/PolicyScope/parent-dir-generate-time-result.txt b/Tests/RunCMake/PolicyScope/parent-dir-generate-time-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/PolicyScope/parent-dir-generate-time-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake b/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake new file mode 100644 index 0000000..a0842f7 --- /dev/null +++ b/Tests/RunCMake/PolicyScope/parent-dir-generate-time.cmake @@ -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) diff --git a/Tests/RunCMake/add_subdirectory/CMakeLists.txt b/Tests/RunCMake/add_subdirectory/CMakeLists.txt new file mode 100644 index 0000000..18dfd26 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/add_subdirectory/DoesNotExist-result.txt b/Tests/RunCMake/add_subdirectory/DoesNotExist-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/DoesNotExist-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt b/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt new file mode 100644 index 0000000..369a956 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/DoesNotExist-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at DoesNotExist.cmake:1 \(add_subdirectory\): + add_subdirectory given source "DoesNotExist" which is not an existing + directory. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_subdirectory/DoesNotExist.cmake b/Tests/RunCMake/add_subdirectory/DoesNotExist.cmake new file mode 100644 index 0000000..fe2945c --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/DoesNotExist.cmake @@ -0,0 +1 @@ +add_subdirectory(DoesNotExist) diff --git a/Tests/RunCMake/add_subdirectory/Missing-result.txt b/Tests/RunCMake/add_subdirectory/Missing-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/Missing-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/add_subdirectory/Missing-stderr.txt b/Tests/RunCMake/add_subdirectory/Missing-stderr.txt new file mode 100644 index 0000000..aba0675 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/Missing-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at Missing.cmake:1 \(add_subdirectory\): + The source directory + + .*/Tests/RunCMake/add_subdirectory/Missing + + does not contain a CMakeLists.txt file. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/add_subdirectory/Missing.cmake b/Tests/RunCMake/add_subdirectory/Missing.cmake new file mode 100644 index 0000000..0e68927 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/Missing.cmake @@ -0,0 +1 @@ +add_subdirectory(Missing) diff --git a/Tests/RunCMake/add_subdirectory/Missing/Missing.txt b/Tests/RunCMake/add_subdirectory/Missing/Missing.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/Missing/Missing.txt diff --git a/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake new file mode 100644 index 0000000..a3ddec8 --- /dev/null +++ b/Tests/RunCMake/add_subdirectory/RunCMakeTest.cmake @@ -0,0 +1,4 @@ +include(RunCMake) + +run_cmake(DoesNotExist) +run_cmake(Missing) |