Parcourir la source

BUG: Fix for generated install scripts to support prefixes with trailing slashes or just a single slash.

Brad King il y a 19 ans
Parent
commit
2b7e43961c
1 fichiers modifiés avec 4 ajouts et 3 suppressions
  1. 4 3
      Source/cmLocalGenerator.cxx

+ 4 - 3
Source/cmLocalGenerator.cxx

@@ -307,10 +307,11 @@ void cmLocalGenerator::GenerateInstallRules()
   // Write the header.
   fout << "# Install script for directory: "
        << m_Makefile->GetCurrentDirectory() << std::endl << std::endl;
-  fout << "# Set the install prefix" << std::endl
-    << "IF(NOT CMAKE_INSTALL_PREFIX)" << std::endl
+  fout << "# Set the install prefix and remove any trailing slash." << std::endl
+    << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
     << "  SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
-    << "ENDIF(NOT CMAKE_INSTALL_PREFIX)" << std::endl
+    << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
+    << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\")" << std::endl
     << std::endl;
 
   // Write support code for generating per-configuration install rules.