install: Normalize DESTINATION .

Such that during installation, instead of printing

  -- Installing: /cmake/install/prefix/./file

now prints

  -- Installing: /cmake/install/prefix/file
This commit is contained in:
huangqinjin
2026-02-28 18:50:05 +08:00
committed by Brad King
parent e50e73e456
commit 0f1ba8f6bb
4 changed files with 8 additions and 0 deletions

View File

@@ -219,6 +219,10 @@ bool cmInstallGenerator::InstallsForConfig(std::string const& config)
std::string cmInstallGenerator::ConvertToAbsoluteDestination(
std::string const& dest)
{
if (dest == ".") {
return "${CMAKE_INSTALL_PREFIX}";
}
std::string result;
if (!dest.empty() && !cmSystemTools::FileIsFullPath(dest)) {
result = "${CMAKE_INSTALL_PREFIX}/";

View File

@@ -0,0 +1,2 @@
-- Installing: [^
]+/Tests/RunCMake/install/FILES-DESTINATION-dot-build/root-all/empty\.c

View File

@@ -0,0 +1 @@
install(FILES empty.c DESTINATION ".")

View File

@@ -127,6 +127,7 @@ if(CMake_TEST_ISPC)
run_install_test(FILES-EXTRA_ISPC_TARGET_OBJECTS)
endif()
run_install_test(FILES-DESTINATION-dot)
run_install_test(TARGETS-InstallFromSubDir)
run_install_test(TARGETS-OPTIONAL)