Commit a9428fc4 authored by Brad King's avatar Brad King

Tests: Fix FindPackageTest when path to source has a symlink

Exclude a portion of the test that does not work in this case.
parent e27437d0
...@@ -205,15 +205,20 @@ if(UNIX) ...@@ -205,15 +205,20 @@ if(UNIX)
message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")")
endif() endif()
# Resolve symlinks when finding the package. # This part of the test only works if there are no symlinks in our path.
set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE) get_filename_component(real_src_dir "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
set(SetFoundResolved_DIR "") if(real_src_dir STREQUAL CMAKE_CURRENT_SOURCE_DIR)
find_package(SetFoundResolved) # Resolve symlinks when finding the package.
# ./symlink points back here so it should be gone when resolved. set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(SetFoundResolved_DIR "")
if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}") find_package(SetFoundResolved)
message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")") # ./symlink points back here so it should be gone when resolved.
set(SetFoundResolved_EXPECTED "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(NOT "${SetFoundResolved_DIR}" STREQUAL "${SetFoundResolved_EXPECTED}")
message(SEND_ERROR "SetFoundResolved_DIR set by find_package() is set to \"${SetFoundResolved_DIR}\" (expected \"${SetFoundResolved_EXPECTED}\")")
endif()
endif() endif()
# Cleanup. # Cleanup.
unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS) unset(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS)
file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink") file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/symlink")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment