Testing: Add test for CMP0082

This commit is contained in:
Kyle Edwards
2018-10-03 11:49:18 -04:00
parent fc8955e889
commit b56f2db87a
35 changed files with 119 additions and 2 deletions

View File

@@ -0,0 +1 @@
install(CODE "message(STATUS \"exclude\")")

View File

@@ -0,0 +1,4 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- sub
-- top$

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- sub
-- top$

View File

@@ -0,0 +1,3 @@
add_subdirectory(CMP0082)
add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1 @@
add_subdirectory(sub)

View File

@@ -0,0 +1 @@
install(CODE "message(STATUS \"sub\")")

View File

@@ -0,0 +1,2 @@
add_subdirectory(sub)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1 @@
install(CODE "message(STATUS \"sub\")")

View File

@@ -0,0 +1,4 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- top
-- sub$

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- top
-- sub$

View File

@@ -0,0 +1,3 @@
add_subdirectory(CMP0082)
add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1,4 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- top
-- sub$

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- top
-- sub$

View File

@@ -0,0 +1,7 @@
CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are
interleaved with those in caller\. Run "cmake --help-policy CMP0082" 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\.

View File

@@ -0,0 +1,2 @@
add_subdirectory(CMP0082-Nested)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1,4 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- top
-- sub$

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- top
-- sub$

View File

@@ -0,0 +1,7 @@
CMake Warning \(dev\) in CMP0082-NestedSub/CMakeLists\.txt:
Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are
interleaved with those in caller\. Run "cmake --help-policy CMP0082" 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\.

View File

@@ -0,0 +1 @@
add_subdirectory(CMP0082-NestedSub)

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- sub$

View File

@@ -0,0 +1,2 @@
^-- Install configuration: "[^\n]*"
-- sub$

View File

@@ -0,0 +1 @@
add_subdirectory(CMP0082)

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- top$

View File

@@ -0,0 +1,2 @@
^-- Install configuration: "[^\n]*"
-- top$

View File

@@ -0,0 +1,2 @@
add_subdirectory(CMP0082-None)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1,4 @@
^-- Install configuration: "[^\n]*"
-- Install component: "Unspecified"
-- top
-- sub$

View File

@@ -0,0 +1,3 @@
^-- Install configuration: "[^\n]*"
-- top
-- sub$

View File

@@ -0,0 +1,7 @@
CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0082 is not set: Install rules from add_subdirectory\(\) are
interleaved with those in caller\. Run "cmake --help-policy CMP0082" 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\.

View File

@@ -0,0 +1,3 @@
add_subdirectory(CMP0082)
add_subdirectory(CMP0082-ExcludeFromAll EXCLUDE_FROM_ALL)
install(CODE "message(STATUS \"top\")")

View File

@@ -0,0 +1 @@
install(CODE "message(STATUS \"sub\")")

View File

@@ -1,3 +1,10 @@
cmake_minimum_required(VERSION 3.2)
# Have to set policy here due to policy scope
if(DEFINED CMP0082_VALUE)
cmake_policy(SET CMP0082 "${CMP0082_VALUE}")
endif()
set(CMAKE_POLICY_WARNING_CMP0082 ON)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)

View File

@@ -2,4 +2,4 @@
add_subdirectory given source "DoesNotExist" which is not an existing
directory.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -5,4 +5,4 @@
does not contain a CMakeLists.txt file.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$
CMakeLists\.txt:[0-9]+ \(include\)$

View File

@@ -4,6 +4,28 @@ run_cmake(DoesNotExist)
run_cmake(Missing)
run_cmake(Function)
macro(run_cmake_install case)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
set(RunCMake_TEST_NO_CLEAN 1)
set(RunCMake_TEST_OPTIONS ${ARGN})
run_cmake(${case})
run_cmake_command(${case}-install ${CMAKE_COMMAND} -P cmake_install.cmake)
run_cmake_command(${case}-install-component ${CMAKE_COMMAND} -DCOMPONENT=Unspecified -P cmake_install.cmake)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
unset(RunCMake_TEST_OPTIONS)
endmacro()
run_cmake_install(CMP0082-WARN)
run_cmake_install(CMP0082-WARN-Nested)
run_cmake_install(CMP0082-WARN-NestedSub)
run_cmake_install(CMP0082-WARN-None)
run_cmake_install(CMP0082-WARN-NoTopInstall)
run_cmake_install(CMP0082-OLD -DCMP0082_VALUE=OLD)
run_cmake_install(CMP0082-NEW -DCMP0082_VALUE=NEW)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExcludeFromAll-build)
set(RunCMake_TEST_NO_CLEAN 1)