Tests: Run IfacePaths tests with a parameter.

Run the tests for the INCLUDE_DIRECTORIES INTERFACE property
in a specific build location, and update the stderr expectation
to match the new output.
This commit is contained in:
Stephen Kelly 2014-11-30 13:42:00 +01:00
parent cc15209476
commit d9f8390db6
9 changed files with 35 additions and 21 deletions

View File

@ -188,7 +188,9 @@ add_RunCMake_test(CommandLine)
add_RunCMake_test(install)
add_RunCMake_test(CPackInstallProperties)
add_RunCMake_test(ExternalProject)
add_RunCMake_test(IfacePaths)
set(IfacePaths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES)
add_RunCMake_test(IfacePaths_INCLUDE_DIRECTORIES TEST_DIR IfacePaths)
if(RPMBUILD)
add_RunCMake_test(CPackRPM)

View File

@ -1,6 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo"
which is prefixed in the build directory.

View File

@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt:
Directory:
".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo"
in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
of the install directory:
".*Tests/RunCMake/IfacePaths/prefix"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix"
however it is also a subdirectory of the build tree:
".*Tests/RunCMake/IfacePaths/prefix/BinInInstallPrefix-CMP0052-WARN-build"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build"
This warning is for project developers. Use -Wno-dev to suppress it.

View File

@ -1,6 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*RunCMake/IfacePaths/BinaryDirectoryInInterface-build/foo"
".*RunCMake/IfacePaths_INCLUDE_DIRECTORIES/BinaryDirectoryInInterface-build/foo"
which is prefixed in the build directory.

View File

@ -1,6 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*Tests/RunCMake/IfacePaths/InstallInBinDir-build/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/InstallInBinDir-build/foo"
which is prefixed in the build directory.

View File

@ -1,6 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*Tests/RunCMake/IfacePaths/copy/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/copy/foo"
which is prefixed in the source directory.

View File

@ -1,5 +1,10 @@
include(RunCMake)
macro(run_cmake test)
list(APPEND RunCMake_TEST_OPTIONS -DTEST_PROP=${TEST_PROP})
_run_cmake(${test})
endmacro()
run_cmake(RelativePathInInterface)
run_cmake(RelativePathInGenex)
run_cmake(export-NOWARN)
@ -57,12 +62,15 @@ configure_file(
COPYONLY
)
foreach(policyStatus "" NEW OLD)
if (NOT "${policyStatus}" STREQUAL "")
set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus})
else()
unset(policyOption)
set(policyStatus WARN)
foreach(policyStatus NEW OLD "")
if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
if (NOT "${policyStatus}" STREQUAL "")
set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus})
else()
unset(policyOption)
set(policyStatus WARN)
endif()
set(policySuffix -CMP0052-${policyStatus})
endif()
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
@ -73,16 +81,20 @@ foreach(policyStatus "" NEW OLD)
# a subdirectory or the source directory, which is allowed and tested separately
# below.
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build")
run_cmake(BinInInstallPrefix-CMP0052-${policyStatus})
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix${policySuffix}-build")
run_cmake(BinInInstallPrefix${policySuffix})
unset(RunCMake_TEST_BINARY_DIR)
set(RunCMake_TEST_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
"-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake"
)
run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus})
run_cmake(SrcInInstallPrefix${policySuffix})
unset(RunCMake_TEST_SOURCE_DIR)
if (NOT TEST_PROP STREQUAL INCLUDE_DIRECTORIES)
break()
endif()
endforeach()
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")

View File

@ -1,6 +1,6 @@
CMake Error in CMakeLists.txt:
Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path:
".*Tests/RunCMake/IfacePaths/prefix/src/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src/foo"
which is prefixed in the source directory.

View File

@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt:
Directory:
".*Tests/RunCMake/IfacePaths/prefix/src/foo"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src/foo"
in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory
of the install directory:
".*Tests/RunCMake/IfacePaths/prefix"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix"
however it is also a subdirectory of the source tree:
".*Tests/RunCMake/IfacePaths/prefix/src"
".*Tests/RunCMake/IfacePaths_INCLUDE_DIRECTORIES/prefix/src"
This warning is for project developers. Use -Wno-dev to suppress it.