diff options
author | Brad King <brad.king@kitware.com> | 2019-01-21 12:47:22 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-21 12:47:29 (GMT) |
commit | d1aa2e11092acdcc22b333e219187026d38549a5 (patch) | |
tree | eaba8a9e22decb92d4af7427667ec5e07fe0fe87 /Tests/RunCMake | |
parent | fefae527c8c54d249c44313d9b09cdb0157e2f5d (diff) | |
parent | b773e58099b2fc8ebdf8319172fb018d0139396d (diff) | |
download | CMake-d1aa2e11092acdcc22b333e219187026d38549a5.zip CMake-d1aa2e11092acdcc22b333e219187026d38549a5.tar.gz CMake-d1aa2e11092acdcc22b333e219187026d38549a5.tar.bz2 |
Merge topic 'find-package-resolve-symlinks'
b773e58099 find_package: add test coverage for CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS
a5e948a36f find_package: optionally resolve symlinks when discovering packages
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2798
Diffstat (limited to 'Tests/RunCMake')
4 files changed, 31 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake new file mode 100644 index 0000000..4496a05 --- /dev/null +++ b/Tests/RunCMake/find_package/PackageRoot/ResolvedConfig.cmake @@ -0,0 +1 @@ +set(Resolved_DIR "${CMAKE_CURRENT_LIST_DIR}") diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index e9f3558..066523e 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -26,3 +26,6 @@ run_cmake(WrongVersionConfig) run_cmake(CMP0084-OLD) run_cmake(CMP0084-WARN) run_cmake(CMP0084-NEW) +if(UNIX) + run_cmake(SetFoundResolved) +endif() diff --git a/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt new file mode 100644 index 0000000..ea94be5 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundResolved-stderr.txt @@ -0,0 +1,10 @@ +CMake Warning at SetFoundResolved.cmake:10 \(message\): + .*/Tests/RunCMake/find_package/symlink +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) + + +CMake Warning at SetFoundResolved.cmake:15 \(message\): + .*/Tests/RunCMake/find_package/PackageRoot +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/find_package/SetFoundResolved.cmake b/Tests/RunCMake/find_package/SetFoundResolved.cmake new file mode 100644 index 0000000..8d56513 --- /dev/null +++ b/Tests/RunCMake/find_package/SetFoundResolved.cmake @@ -0,0 +1,17 @@ +# Create ./symlink pointing back here. +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + PackageRoot "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + +# Make find_package search through the symlink. +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/symlink") + +# Test preservation of symlinks. +find_package(Resolved) +message(WARNING "${Resolved_DIR}") + +# Test resolving symlinks. +set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS ON) +find_package(Resolved) +message(WARNING "${Resolved_DIR}") + +file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink") |