mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
6a1fac1450
The file generated by install(EXPORT) computes _IMPORT_PREFIX in a way that assumes a normalized path. If the DESTINATION contains any ../ components, the computed _IMPORT_PREFIX would be wrong. Force the DESTINATION path to be normalized, subject to the new CMP0176 policy. Also normalize all other DESTINATION paths for consistency, except for INCLUDES DESTINATION, which is not strictly a destination but rather a search path to add. Fixes: #26252
37 lines
1.3 KiB
CMake
37 lines
1.3 KiB
CMake
set(installBase ${RunCMake_TEST_BINARY_DIR}/root-all)
|
|
|
|
foreach(i RANGE 1 5)
|
|
set(subdir shouldNotRemain${i})
|
|
if(IS_DIRECTORY ${installBase}/${subdir})
|
|
set(RunCMake_TEST_FAILED "Check failed.")
|
|
string(APPEND RunCMake_TEST_FAILURE_MESSAGE
|
|
"\nUnexpectedly created install path that should have disappeared with "
|
|
"normalization:\n"
|
|
" ${installBase}/${subdir}"
|
|
)
|
|
endif()
|
|
endforeach()
|
|
|
|
file(GLOB perConfigFiles ${installBase}/lib/cmake/pkg/pkg-config-*.cmake)
|
|
foreach(file IN LISTS perConfigFiles ITEMS ${installBase}/lib/cmake/pkg/pkg-config.cmake)
|
|
file(STRINGS ${file} matches REGEX shouldNotRemain)
|
|
if(NOT matches STREQUAL "")
|
|
set(RunCMake_TEST_FAILED "Check failed.")
|
|
string(APPEND RunCMake_TEST_FAILURE_MESSAGE
|
|
"\nNon-normalized path found in ${file}:"
|
|
)
|
|
foreach(match IN LISTS matches)
|
|
string(APPEND RunCMake_TEST_FAILURE_MESSAGE "\n ${match}")
|
|
endforeach()
|
|
endif()
|
|
endforeach()
|
|
|
|
if(NOT EXISTS "${installBase}/dirs/dir/empty.txt")
|
|
set(RunCMake_TEST_FAILED "Check failed.")
|
|
string(APPEND RunCMake_TEST_FAILURE_MESSAGE
|
|
"\nNon-normalized DIRECTORY destination not handled correctly. "
|
|
"Expected to find the following file, but it was missing:\n"
|
|
" ${installBase}/dirs/dir/empty.txt"
|
|
)
|
|
endif()
|