summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/FindBoost/TestPython/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/ExternalProject/MultiCommand.cmake12
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake17
-rw-r--r--Tests/RunCMake/ExternalProject/SourceDirChange-build2-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/SourceDirChange.cmake20
-rw-r--r--Tests/RunCMake/find_package/IgnorePath.cmake12
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake1
7 files changed, 60 insertions, 7 deletions
diff --git a/Tests/FindBoost/TestPython/CMakeLists.txt b/Tests/FindBoost/TestPython/CMakeLists.txt
index 6d292cd..8ef18e9 100644
--- a/Tests/FindBoost/TestPython/CMakeLists.txt
+++ b/Tests/FindBoost/TestPython/CMakeLists.txt
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.14)
project(TestFindBoostPython CXX)
include(CTest)
-find_package(Boost OPTIONAL_COMPONENTS python27 python34 python35 python36 python37 python38 python39)
+find_package(Boost OPTIONAL_COMPONENTS python27 python34 python35 python36 python37 python38 python39 python310)
set(FAILTEST TRUE)
-foreach (v IN ITEMS 27 34 35 36 37 38 39)
+foreach (v IN ITEMS 27 34 35 36 37 38 39 310)
if (Boost_PYTHON${v}_FOUND)
set(FAILTEST FALSE)
break()
diff --git a/Tests/RunCMake/ExternalProject/MultiCommand.cmake b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
index 0849658..3e8bd94 100644
--- a/Tests/RunCMake/ExternalProject/MultiCommand.cmake
+++ b/Tests/RunCMake/ExternalProject/MultiCommand.cmake
@@ -1,5 +1,12 @@
include(ExternalProject)
+# Force all steps to be re-run by removing timestamps from any previous run.
+# This has to happen before we call ExternalProject_Add() because that command
+# writes some files to the stamp directory for recording repository details.
+set(STAMP_DIR ${CMAKE_BINARY_DIR}/multiCommand-prefix/src/multiCommand-stamp)
+file(REMOVE_RECURSE "${STAMP_DIR}")
+file(MAKE_DIRECTORY "${STAMP_DIR}")
+
# Verify COMMAND keyword is recognized after various *_COMMAND options
ExternalProject_Add(multiCommand
DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "download 1"
@@ -17,8 +24,3 @@ ExternalProject_Add(multiCommand
INSTALL_COMMAND "${CMAKE_COMMAND}" -E echo "install 1"
COMMAND "${CMAKE_COMMAND}" -E echo "install 2"
)
-
-# Force all steps to be re-run by removing timestamps from any previous run
-ExternalProject_Get_Property(multiCommand STAMP_DIR)
-file(REMOVE_RECURSE "${STAMP_DIR}")
-file(MAKE_DIRECTORY "${STAMP_DIR}")
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 48f8b23..fde384f 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -61,6 +61,23 @@ if(NOT XCODE_VERSION OR XCODE_VERSION VERSION_LESS 12)
endif()
run_steps_CMP0114(NEW)
+function(__ep_test_source_dir_change)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SourceDirChange-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(SourceDirChange)
+ run_cmake_command(SourceDirChange-build1 ${CMAKE_COMMAND} --build .)
+ # Because some file systems have timestamps with only one second resolution,
+ # we have to ensure we don't re-run the configure stage too quickly after the
+ # first build. Otherwise, the modified RepositoryInfo.txt files the next
+ # configure writes might still have the same timestamp as the previous one.
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1.125)
+ run_cmake_command(SourceDirChange-change ${CMAKE_COMMAND} -DSOURCE_DIR_CHANGE=YES .)
+ run_cmake_command(SourceDirChange-build2 ${CMAKE_COMMAND} --build .)
+endfunction()
+__ep_test_source_dir_change()
+
# Run both cmake and build steps. We always do a clean before the
# build to ensure that the download step re-runs each time.
function(__ep_test_with_build testName)
diff --git a/Tests/RunCMake/ExternalProject/SourceDirChange-build2-stdout.txt b/Tests/RunCMake/ExternalProject/SourceDirChange-build2-stdout.txt
new file mode 100644
index 0000000..22dac9d
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/SourceDirChange-build2-stdout.txt
@@ -0,0 +1 @@
+Download command executed
diff --git a/Tests/RunCMake/ExternalProject/SourceDirChange.cmake b/Tests/RunCMake/ExternalProject/SourceDirChange.cmake
new file mode 100644
index 0000000..62213cd
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/SourceDirChange.cmake
@@ -0,0 +1,20 @@
+include(ExternalProject)
+
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/first")
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/second")
+
+if("${SOURCE_DIR_CHANGE}" STREQUAL "")
+ set(source_dir first)
+else()
+ set(source_dir second)
+endif()
+
+ExternalProject_Add(source_dir_change
+ SOURCE_DIR "${CMAKE_BINARY_DIR}/${source_dir}"
+ DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "Download command executed"
+ UPDATE_COMMAND ""
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ TEST_COMMAND ""
+ INSTALL_COMMAND ""
+)
diff --git a/Tests/RunCMake/find_package/IgnorePath.cmake b/Tests/RunCMake/find_package/IgnorePath.cmake
new file mode 100644
index 0000000..f40549b
--- /dev/null
+++ b/Tests/RunCMake/find_package/IgnorePath.cmake
@@ -0,0 +1,12 @@
+set(CMAKE_PREFIX_PATH
+ ${CMAKE_SOURCE_DIR}/PackageRoot/foo/cmake_root
+ ${CMAKE_SOURCE_DIR}/PackageRoot/foo/env_root
+ )
+set(CMAKE_IGNORE_PATH
+ ${CMAKE_SOURCE_DIR}/PackageRoot//foo/cmake_root// # Test double slashes
+ ${CMAKE_SOURCE_DIR}/PackageRoot/foo/env_root/cmake
+ )
+find_package(Bar QUIET CONFIG)
+if(Bar_FOUND)
+ message(FATAL_ERROR "Bar should not be found, was found in ${Bar_DIR}")
+endif()
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 2bace98..12701dc 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -44,6 +44,7 @@ run_cmake(VersionRangeConfig2)
run_cmake(VersionRangeConfig02)
run_cmake(VersionRangeConfigStd)
run_cmake(VersionRangeConfigStd2)
+run_cmake(IgnorePath)
if(UNIX
AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS
)