Tests: Refactor RunCMake.include_directories to drop RunCMake_TEST_FILE
Drop use of RunCMake_TEST_FILE and pass the test file in through a definition in RunCMake_TEST_OPTIONS.
This commit is contained in:
parent
8707814e78
commit
f0f15b93bd
|
@ -1,3 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(${RunCMake_TEST} CXX)
|
project(${RunCMake_TEST} CXX)
|
||||||
include(${RunCMake_TEST}.cmake)
|
if(NOT TEST_FILE)
|
||||||
|
set(TEST_FILE ${RunCMake_TEST}.cmake)
|
||||||
|
endif()
|
||||||
|
include(${TEST_FILE})
|
||||||
|
|
|
@ -5,7 +5,7 @@ CMake Debug Log at DebugIncludes.cmake:8 \(include_directories\):
|
||||||
\* .*/Tests/RunCMake/include_directories/two
|
\* .*/Tests/RunCMake/include_directories/two
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
+
|
+
|
||||||
CMake Debug Log at DebugIncludes.cmake:13 \(set_property\):
|
CMake Debug Log at DebugIncludes.cmake:13 \(set_property\):
|
||||||
Used includes for target lll:
|
Used includes for target lll:
|
||||||
|
@ -13,7 +13,7 @@ CMake Debug Log at DebugIncludes.cmake:13 \(set_property\):
|
||||||
\* .*/Tests/RunCMake/include_directories/three
|
\* .*/Tests/RunCMake/include_directories/three
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
+
|
+
|
||||||
CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\):
|
CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\):
|
||||||
Used includes for target lll:
|
Used includes for target lll:
|
||||||
|
@ -21,7 +21,7 @@ CMake Debug Log at DebugIncludes.cmake:18 \(include_directories\):
|
||||||
\* .*/Tests/RunCMake/include_directories/four
|
\* .*/Tests/RunCMake/include_directories/four
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
+
|
+
|
||||||
CMake Debug Log at DebugIncludes.cmake:33 \(set_property\):
|
CMake Debug Log at DebugIncludes.cmake:33 \(set_property\):
|
||||||
Used includes for target lll:
|
Used includes for target lll:
|
||||||
|
@ -33,7 +33,7 @@ CMake Debug Log at DebugIncludes.cmake:33 \(set_property\):
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
DebugIncludes.cmake:44 \(some_macro\)
|
DebugIncludes.cmake:44 \(some_macro\)
|
||||||
DebugIncludes.cmake:47 \(some_function\)
|
DebugIncludes.cmake:47 \(some_function\)
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
+
|
+
|
||||||
CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\):
|
CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\):
|
||||||
Used includes for target lll:
|
Used includes for target lll:
|
||||||
|
@ -41,7 +41,7 @@ CMake Debug Log at DebugIncludes.cmake:30 \(target_link_libraries\):
|
||||||
\* .*/Tests/RunCMake/include_directories/eight
|
\* .*/Tests/RunCMake/include_directories/eight
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
+
|
+
|
||||||
CMake Debug Log at DebugIncludes.cmake:55 \(set_property\):
|
CMake Debug Log at DebugIncludes.cmake:55 \(set_property\):
|
||||||
Used includes for target lll:
|
Used includes for target lll:
|
||||||
|
@ -50,4 +50,4 @@ CMake Debug Log at DebugIncludes.cmake:55 \(set_property\):
|
||||||
\* .*/Tests/RunCMake/include_directories/ten
|
\* .*/Tests/RunCMake/include_directories/ten
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|
|
@ -31,19 +31,22 @@ configure_file(
|
||||||
"${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake"
|
"${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake"
|
||||||
COPYONLY
|
COPYONLY
|
||||||
)
|
)
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix")
|
set(RunCMake_TEST_OPTIONS
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface")
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface/prefix"
|
||||||
|
"-DTEST_FILE=${RunCMake_BINARY_DIR}/copy/SourceDirectoryInInterface.cmake"
|
||||||
|
)
|
||||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy")
|
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/copy")
|
||||||
run_cmake(InstallInSrcDir)
|
run_cmake(InstallInSrcDir)
|
||||||
unset(RunCMake_TEST_SOURCE_DIR)
|
unset(RunCMake_TEST_SOURCE_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix")
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix")
|
||||||
|
set(RunCMake_TEST_OPTIONS
|
||||||
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallInBinDir-build/prefix"
|
||||||
|
"-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
|
||||||
|
)
|
||||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build")
|
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/InstallInBinDir-build")
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface")
|
|
||||||
run_cmake(InstallInBinDir)
|
run_cmake(InstallInBinDir)
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${RunCMake_SOURCE_DIR}/CMakeLists.txt"
|
"${RunCMake_SOURCE_DIR}/CMakeLists.txt"
|
||||||
|
@ -68,22 +71,25 @@ foreach(policyStatus "" NEW OLD)
|
||||||
unset(policyOption)
|
unset(policyOption)
|
||||||
set(policyStatus WARN)
|
set(policyStatus WARN)
|
||||||
endif()
|
endif()
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption})
|
set(RunCMake_TEST_OPTIONS
|
||||||
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption}
|
||||||
|
"-DTEST_FILE=${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface.cmake"
|
||||||
|
)
|
||||||
# Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
|
# Set the RunCMake_TEST_SOURCE_DIR here to the copy too. This is needed to run
|
||||||
# the test suite in-source properly. Otherwise the install directory would be
|
# the test suite in-source properly. Otherwise the install directory would be
|
||||||
# a subdirectory or the source directory, which is allowed and tested separately
|
# a subdirectory or the source directory, which is allowed and tested separately
|
||||||
# below.
|
# below.
|
||||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
|
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src")
|
||||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build")
|
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build")
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_SOURCE_DIR}/BinaryDirectoryInInterface")
|
|
||||||
run_cmake(BinInInstallPrefix-CMP0052-${policyStatus})
|
run_cmake(BinInInstallPrefix-CMP0052-${policyStatus})
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
|
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface")
|
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-CMP0052-${policyStatus})
|
||||||
unset(RunCMake_TEST_SOURCE_DIR)
|
unset(RunCMake_TEST_SOURCE_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix")
|
||||||
|
@ -104,12 +110,13 @@ configure_file(
|
||||||
"${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake"
|
"${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake"
|
||||||
COPYONLY
|
COPYONLY
|
||||||
)
|
)
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix")
|
set(RunCMake_TEST_OPTIONS
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface")
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface/prefix"
|
||||||
|
"-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrc/InstallPrefixInInterface.cmake"
|
||||||
|
)
|
||||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc")
|
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrc")
|
||||||
run_cmake(InstallToPrefixInSrcDirOutOfSource)
|
run_cmake(InstallToPrefixInSrcDirOutOfSource)
|
||||||
unset(RunCMake_TEST_SOURCE_DIR)
|
unset(RunCMake_TEST_SOURCE_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
|
|
||||||
|
|
||||||
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc")
|
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}/installToSrcInSrc")
|
||||||
|
@ -131,12 +138,13 @@ configure_file(
|
||||||
COPYONLY
|
COPYONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix")
|
set(RunCMake_TEST_OPTIONS
|
||||||
set(RunCMake_TEST_FILE "${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface")
|
"-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface/prefix"
|
||||||
|
"-DTEST_FILE=${RunCMake_BINARY_DIR}/installToSrcInSrc/InstallPrefixInInterface.cmake"
|
||||||
|
)
|
||||||
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc")
|
set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc")
|
||||||
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc")
|
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/installToSrcInSrc")
|
||||||
run_cmake(InstallToPrefixInSrcDirInSource)
|
run_cmake(InstallToPrefixInSrcDirInSource)
|
||||||
unset(RunCMake_TEST_SOURCE_DIR)
|
unset(RunCMake_TEST_SOURCE_DIR)
|
||||||
unset(RunCMake_TEST_BINARY_DIR)
|
unset(RunCMake_TEST_BINARY_DIR)
|
||||||
unset(RunCMake_TEST_FILE)
|
|
||||||
unset(RunCMake_TEST_NO_CLEAN)
|
unset(RunCMake_TEST_NO_CLEAN)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
CMake Error at TID-bad-target.cmake:6 \(target_include_directories\):
|
CMake Error at TID-bad-target.cmake:6 \(target_include_directories\):
|
||||||
target_include_directories called with non-compilable target type
|
target_include_directories called with non-compilable target type
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:[0-9]+ \(include\)
|
||||||
|
|
Loading…
Reference in New Issue