summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDeniz Bahadir <deniz@code.bahadir.email>2024-05-01 17:20:32 (GMT)
committerDeniz Bahadir <deniz@code.bahadir.email>2024-05-01 17:20:32 (GMT)
commit9e67ad47a99b549ee02bd48ad2d1ae438f9f3181 (patch)
treefb39e400b803692d989e0988878c352a4817d995
parent04ce020bf7f68cbbc966ea7ae6314fd6ec0e64d9 (diff)
downloadCMake-9e67ad47a99b549ee02bd48ad2d1ae438f9f3181.zip
CMake-9e67ad47a99b549ee02bd48ad2d1ae438f9f3181.tar.gz
CMake-9e67ad47a99b549ee02bd48ad2d1ae438f9f3181.tar.bz2
cmLocalGenerator: Support arbitrary component name when installing
The generated `cmake_install.cmake` script no longer blindly tries to create files `install_manifest_<component-name>.txt` that partly consists of the verbatim name of a component, which might contain characters that are not supported on the platform / filesystem. Instead, if the component's name contains a (possibly) problematic character its MD5 hash will be used: `install_manifest_<component-hash>.txt`
-rw-r--r--Source/cmLocalGenerator.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index ffd41d2..22daa0e 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -717,8 +717,15 @@ void cmLocalGenerator::GenerateInstallRules()
/* clang-format off */
fout <<
"if(CMAKE_INSTALL_COMPONENT)\n"
- " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
+ " if(CMAKE_INSTALL_COMPONENT MATCHES \"^[a-zA-Z0-9_.+-]+$\")\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
"${CMAKE_INSTALL_COMPONENT}.txt\")\n"
+ " else()\n"
+ " string(MD5 CMAKE_INST_COMP_HASH \"${CMAKE_INSTALL_COMPONENT}\")\n"
+ " set(CMAKE_INSTALL_MANIFEST \"install_manifest_"
+ "${CMAKE_INST_COMP_HASH}.txt\")\n"
+ " unset(CMAKE_INST_COMP_HASH)\n"
+ " endif()\n"
"else()\n"
" set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n"
"endif()\n"