[Cmake-commits] CMake branch, next, updated. v3.1.2-1286-g9e978e3

Brad King brad.king at kitware.com
Wed Feb 11 15:19:44 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  9e978e3ee89f5f53991cd09e1b25ba3d2ec03e98 (commit)
       via  f30022eb07b913598326d2e3b10ff2e706fbe873 (commit)
       via  7607c3d16aa0636458c909f4036e4b0d91581b30 (commit)
       via  ebd556caa9e1fc92e00c8e401b145c531390e854 (commit)
       via  290ca8e2d0328d27f51ff5248c35e32e44fdd1eb (commit)
       via  f99991db882c2f4cf8246b9c272845faaa5bbce5 (commit)
      from  17b2ebaf51f87d9622c92fce30605989ce1b0afd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e978e3ee89f5f53991cd09e1b25ba3d2ec03e98
commit 9e978e3ee89f5f53991cd09e1b25ba3d2ec03e98
Merge: 17b2eba f30022e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 15:19:42 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Feb 11 15:19:42 2015 -0500

    Merge topic 'install-DESTINATION-genex' into next
    
    f30022eb install: Allow generator expressions in TARGETS DESTINATION (#14317)
    7607c3d1 cmInstallGenerator: Pass destination explicitly to AddInstallRule
    ebd556ca cmInstallGenerator: Fix check for absolute install destinations
    290ca8e2 cmInstallGenerator: Refactor computation of absolute install dest
    f99991db cmInstallGenerator: Move GetDestination to subclasses that need it


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f30022eb07b913598326d2e3b10ff2e706fbe873
commit f30022eb07b913598326d2e3b10ff2e706fbe873
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 14:02:45 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 11 15:15:33 2015 -0500

    install: Allow generator expressions in TARGETS DESTINATION (#14317)
    
    This will allow per-config destinations for targets in EXPORT sets.
    Using multiple install(TARGETS) with separate CONFIGURATIONS is
    rejected as a target appearing more than once in an export set.
    Now instead one can write
    
     install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>)
    
    to get a single logical membership of the target in the export set
    while still having a per-config destination.

diff --git a/Help/command/install.rst b/Help/command/install.rst
index 5dd5aaa..c99ed73 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -159,6 +159,10 @@ file itself, call ``install(EXPORT)``, documented below.
 Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
 set to ``TRUE`` has undefined behavior.
 
+The install destination given to the target install ``DESTINATION`` may
+use "generator expressions" with the syntax ``$<...>``.  See the
+:manual:`cmake-generator-expressions(7)` manual for available expressions.
+
 Installing Files
 ^^^^^^^^^^^^^^^^
 
diff --git a/Help/release/dev/install-DESTINATION-genex.rst b/Help/release/dev/install-DESTINATION-genex.rst
new file mode 100644
index 0000000..4c4bbed
--- /dev/null
+++ b/Help/release/dev/install-DESTINATION-genex.rst
@@ -0,0 +1,5 @@
+install-DESTINATION-genex
+-------------------------
+
+* The :command:`install(TARGETS)` command learned to support
+  generator expressions in the ``DESTINATION`` value.
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 053c022..ba1dde2 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -398,7 +398,7 @@ cmExportInstallFileGenerator
   cmTarget* target = itgen->GetTarget();
 
   // Construct the installed location of the target.
-  std::string dest = itgen->GetDestination();
+  std::string dest = itgen->GetDestination(config);
   std::string value;
   if(!cmSystemTools::FileIsFullPath(dest.c_str()))
     {
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7ab88f1..b035bad 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -12,6 +12,7 @@
 #include "cmInstallTargetGenerator.h"
 
 #include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
@@ -78,7 +79,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
     fromDirConfig += "/";
     }
   std::string toDir =
-    this->ConvertToAbsoluteDestination(this->Destination);
+    this->ConvertToAbsoluteDestination(this->GetDestination(config));
   toDir += "/";
 
   // Compute the list of files to install for this target.
@@ -323,7 +324,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
   const char* no_dir_permissions = 0;
   const char* no_rename = 0;
   bool optional = this->Optional || this->ImportLibrary;
-  this->AddInstallRule(os, this->Destination,
+  this->AddInstallRule(os, this->GetDestination(config),
                        type, filesFrom, optional,
                        this->FilePermissions.c_str(), no_dir_permissions,
                        no_rename, literal_args.c_str(),
@@ -336,6 +337,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
 
 //----------------------------------------------------------------------------
 std::string
+cmInstallTargetGenerator::GetDestination(std::string const& config) const
+{
+  cmGeneratorExpression ge;
+  return ge.Parse(this->Destination)
+    ->Evaluate(this->Target->GetMakefile(), config);
+}
+
+//----------------------------------------------------------------------------
+std::string
 cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
 {
   NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 4d4b399..075c8a4 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -60,8 +60,7 @@ public:
   cmTarget* GetTarget() const { return this->Target; }
   bool IsImportLibrary() const { return this->ImportLibrary; }
 
-  std::string const& GetDestination() const
-    { return this->Destination; }
+  std::string GetDestination(std::string const& config) const;
 
 protected:
   virtual void GenerateScript(std::ostream& os);
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index e130eca..0df42d9 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -68,6 +68,11 @@ add_library(testLib5 SHARED testLib5.c)
 
 add_library(testLib6 STATIC testLib6.cxx testLib6c.c)
 
+add_library(testLibPerConfigDest STATIC testLibPerConfigDest.c)
+install(TARGETS testLibPerConfigDest EXPORT exp
+  DESTINATION lib/$<$<BOOL:$<CONFIG>>:$<CONFIG>>$<$<NOT:$<BOOL:$<CONFIG>>>:NoConfig>
+  )
+
 # Work-around: Visual Studio 6 does not support per-target object files.
 set(VS6)
 if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6")
@@ -446,9 +451,9 @@ install(
   cmp0022NEW cmp0022OLD
   systemlib
   EXPORT exp
-  RUNTIME DESTINATION bin
-  LIBRARY DESTINATION lib NAMELINK_SKIP
-  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION $<1:bin>
+  LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP
+  ARCHIVE DESTINATION $<1:lib>
   FRAMEWORK DESTINATION Frameworks
   BUNDLE DESTINATION Applications
   )
@@ -503,6 +508,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3
 export(TARGETS testExe2 testLib4 testLib5 testLib6 testExe3 testExe2lib
   testLib4lib testLib4libdbg testLib4libopt
   testLibCycleA testLibCycleB
+  testLibPerConfigDest
   NAMESPACE bld_
   APPEND FILE ExportBuildTree.cmake
   )
diff --git a/Tests/ExportImport/Export/testLibPerConfigDest.c b/Tests/ExportImport/Export/testLibPerConfigDest.c
new file mode 100644
index 0000000..c7113fc
--- /dev/null
+++ b/Tests/ExportImport/Export/testLibPerConfigDest.c
@@ -0,0 +1 @@
+int testLibPerConfigDest(void) { return 0; }
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 358776b..ced7b03 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -34,6 +34,7 @@ target_link_libraries(imp_testExe1
   exp_testLib5
   exp_testLib6
   exp_testLibCycleA
+  exp_testLibPerConfigDest
   )
 
 # Try building a plugin to an executable imported from the install tree.
@@ -66,6 +67,7 @@ target_link_libraries(imp_testExe1b
   bld_testLib5
   bld_testLib6
   bld_testLibCycleA
+  bld_testLibPerConfigDest
   )
 
 add_custom_target(check_testLib1_genex ALL
diff --git a/Tests/ExportImport/Import/A/imp_testExe1.c b/Tests/ExportImport/Import/A/imp_testExe1.c
index 451998a..150fcef 100644
--- a/Tests/ExportImport/Import/A/imp_testExe1.c
+++ b/Tests/ExportImport/Import/A/imp_testExe1.c
@@ -7,6 +7,7 @@ extern int testLib4lib();
 extern int testLib5();
 extern int testLib6();
 extern int testLibCycleA1();
+extern int testLibPerConfigDest();
 
 /* Switch a symbol between debug and optimized builds to make sure the
    proper library is found from the testLib4 link interface.  */
@@ -21,5 +22,6 @@ int main()
 {
   return (testLib2() + generated_by_testExe1() + testLib3() + testLib4()
           + testLib5() + testLib6() + testLibCycleA1()
+          + testLibPerConfigDest()
           + generated_by_testExe3() + testLib4lib() + testLib4libcfg());
 }
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 53b91f3..7149603 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -6,3 +6,4 @@ run_cmake(DIRECTORY-message-lazy)
 run_cmake(SkipInstallRulesWarning)
 run_cmake(SkipInstallRulesNoWarning1)
 run_cmake(SkipInstallRulesNoWarning2)
+run_cmake(TARGETS-DESTINATION-bad)
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+  Error evaluating generator expression:
+
+    \$<NOTAGENEX>
+
+  Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake
new file mode 100644
index 0000000..feff52d
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(empty empty.c)
+install(TARGETS empty DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/empty.c b/Tests/RunCMake/install/empty.c
new file mode 100644
index 0000000..e69de29

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7607c3d16aa0636458c909f4036e4b0d91581b30
commit 7607c3d16aa0636458c909f4036e4b0d91581b30
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 11:48:13 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 11 15:14:01 2015 -0500

    cmInstallGenerator: Pass destination explicitly to AddInstallRule
    
    This will allow specific invocations to transform the destination
    before AddInstallRule uses it.

diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 8c13bab..7593380 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -44,7 +44,9 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
 {
   // Write code to install the directories.
   const char* no_rename = 0;
-  this->AddInstallRule(os, cmInstallType_DIRECTORY,
+  this->AddInstallRule(os,
+                       this->Destination,
+                       cmInstallType_DIRECTORY,
                        this->Directories,
                        this->Optional,
                        this->FilePermissions.c_str(),
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 77af6c2..38c80df 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -185,7 +185,8 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
     files.push_back(i->second);
     std::string config_test = this->CreateConfigTest(i->first);
     os << indent << "if(" << config_test << ")\n";
-    this->AddInstallRule(os, cmInstallType_FILES, files, false,
+    this->AddInstallRule(os, this->Destination,
+                         cmInstallType_FILES, files, false,
                          this->FilePermissions.c_str(), 0, 0, 0,
                          indent.Next());
     os << indent << "endif()\n";
@@ -224,6 +225,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
   // Install the main export file.
   std::vector<std::string> files;
   files.push_back(this->MainImportFile);
-  this->AddInstallRule(os, cmInstallType_FILES, files, false,
+  this->AddInstallRule(os, this->Destination,
+                       cmInstallType_FILES, files, false,
                        this->FilePermissions.c_str(), 0, 0, 0, indent);
 }
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 91b102a..28c27c2 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -57,6 +57,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
   // Write code to install the files.
   const char* no_dir_permissions = 0;
   this->AddInstallRule(os,
+                       this->Destination,
                        (this->Programs
                         ? cmInstallType_PROGRAMS
                         : cmInstallType_FILES),
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 3ae8975..2e1c5f0 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -37,6 +37,7 @@ cmInstallGenerator
 void cmInstallGenerator
 ::AddInstallRule(
                  std::ostream& os,
+                 std::string const& dest,
                  cmInstallType type,
                  std::vector<std::string> const& files,
                  bool optional /* = false */,
@@ -60,7 +61,6 @@ void cmInstallGenerator
     case cmInstallType_FILES:          stype = "FILE"; break;
     }
   os << indent;
-  std::string const& dest = this->Destination;
   if (cmSystemTools::FileIsFullPath(dest.c_str()))
      {
      os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 1e87bda..c4191e4 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -40,7 +40,9 @@ public:
   virtual ~cmInstallGenerator();
 
   void AddInstallRule(
-    std::ostream& os, cmInstallType type,
+    std::ostream& os,
+    std::string const& dest,
+    cmInstallType type,
     std::vector<std::string> const& files,
     bool optional = false,
     const char* permissions_file = 0,
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index a22b123..7ab88f1 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -323,8 +323,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
   const char* no_dir_permissions = 0;
   const char* no_rename = 0;
   bool optional = this->Optional || this->ImportLibrary;
-  this->AddInstallRule(os, type, filesFrom,
-                       optional,
+  this->AddInstallRule(os, this->Destination,
+                       type, filesFrom, optional,
                        this->FilePermissions.c_str(), no_dir_permissions,
                        no_rename, literal_args.c_str(),
                        indent);

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ebd556caa9e1fc92e00c8e401b145c531390e854
commit ebd556caa9e1fc92e00c8e401b145c531390e854
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 11:52:19 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 11 15:13:57 2015 -0500

    cmInstallGenerator: Fix check for absolute install destinations
    
    In AddInstallRule, check for absolute install destinations before
    converting to the absolute install destination.  Previously this
    worked only by accident because literal "${CMAKE_INSTALL_PREFIX}"
    looks like a relative path.

diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 1d64674..3ae8975 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -60,7 +60,7 @@ void cmInstallGenerator
     case cmInstallType_FILES:          stype = "FILE"; break;
     }
   os << indent;
-  std::string dest = this->ConvertToAbsoluteDestination(this->Destination);
+  std::string const& dest = this->Destination;
   if (cmSystemTools::FileIsFullPath(dest.c_str()))
      {
      os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
@@ -94,7 +94,8 @@ void cmInstallGenerator
         << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
      os << indent << "endif()\n";
      }
-  os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype;
+  std::string absDest = this->ConvertToAbsoluteDestination(dest);
+  os << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE " << stype;
   if(optional)
     {
     os << " OPTIONAL";

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=290ca8e2d0328d27f51ff5248c35e32e44fdd1eb
commit 290ca8e2d0328d27f51ff5248c35e32e44fdd1eb
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 11:48:02 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 11 15:12:16 2015 -0500

    cmInstallGenerator: Refactor computation of absolute install dest
    
    Replace the GetInstallDestination method, which looked up the
    Destination ivar, with a new ConvertToAbsoluteDestination method that
    takes the nominal destination as an argument.  Update call sites
    accordingly.  This will allow some clients to transform the install
    destination before calling the method.

diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 4480cc6..77af6c2 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -199,7 +199,7 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os,
 {
   // Remove old per-configuration export files if the main changes.
   std::string installedDir = "$ENV{DESTDIR}";
-  installedDir += this->GetInstallDestination();
+  installedDir += this->ConvertToAbsoluteDestination(this->Destination);
   installedDir += "/";
   std::string installedFile = installedDir;
   installedFile += this->FileName;
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index b261cbf..1d64674 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -60,7 +60,7 @@ void cmInstallGenerator
     case cmInstallType_FILES:          stype = "FILE"; break;
     }
   os << indent;
-  std::string dest = this->GetInstallDestination();
+  std::string dest = this->ConvertToAbsoluteDestination(this->Destination);
   if (cmSystemTools::FileIsFullPath(dest.c_str()))
      {
      os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
@@ -179,15 +179,16 @@ bool cmInstallGenerator::InstallsForConfig(const std::string& config)
 }
 
 //----------------------------------------------------------------------------
-std::string cmInstallGenerator::GetInstallDestination() const
+std::string
+cmInstallGenerator::ConvertToAbsoluteDestination(std::string const& dest) const
 {
   std::string result;
-  if(!this->Destination.empty() &&
-     !cmSystemTools::FileIsFullPath(this->Destination.c_str()))
+  if(!dest.empty() &&
+     !cmSystemTools::FileIsFullPath(dest.c_str()))
     {
     result = "${CMAKE_INSTALL_PREFIX}/";
     }
-  result += this->Destination;
+  result += dest;
   return result;
 }
 
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index eeeca15..1e87bda 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -52,7 +52,7 @@ public:
 
   /** Get the install destination as it should appear in the
       installation script.  */
-  std::string GetInstallDestination() const;
+  std::string ConvertToAbsoluteDestination(std::string const& dest) const;
 
   /** Test if this generator installs something for a given configuration.  */
   bool InstallsForConfig(const std::string& config);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 6d69f54..a22b123 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -77,7 +77,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
     fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
     fromDirConfig += "/";
     }
-  std::string toDir = this->GetInstallDestination();
+  std::string toDir =
+    this->ConvertToAbsoluteDestination(this->Destination);
   toDir += "/";
 
   // Compute the list of files to install for this target.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f99991db882c2f4cf8246b9c272845faaa5bbce5
commit f99991db882c2f4cf8246b9c272845faaa5bbce5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Feb 11 11:45:41 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Feb 11 15:05:57 2015 -0500

    cmInstallGenerator: Move GetDestination to subclasses that need it
    
    The method is used only for EXPORT and TARGET install destinations.
    While at it, make it return a std::string by reference instead of a
    "const char*".

diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index a0d9013..053c022 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -73,8 +73,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
   // to reference if they are relative to the install prefix.
   std::string installPrefix =
     this->IEGen->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
-  const char* installDest = this->IEGen->GetDestination();
-  if(cmSystemTools::FileIsFullPath(installDest))
+  std::string const& expDest = this->IEGen->GetDestination();
+  if(cmSystemTools::FileIsFullPath(expDest))
     {
     // The export file is being installed to an absolute path so the
     // package is not relocatable.  Use the configured install prefix.
@@ -87,7 +87,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
     {
     // Add code to compute the installation prefix relative to the
     // import file location.
-    std::string absDest = installPrefix + "/" + installDest;
+    std::string absDest = installPrefix + "/" + expDest;
     std::string absDestS = absDest + "/";
     os << "# Compute the installation prefix relative to this file.\n"
        << "get_filename_component(_IMPORT_PREFIX"
@@ -109,7 +109,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
         "unset(_realOrig)\n"
         "unset(_realCurr)\n";
       }
-    std::string dest = installDest;
+    std::string dest = expDest;
     while(!dest.empty())
       {
       os <<
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index eb8c28b..3e078f2 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -41,6 +41,9 @@ public:
 
   const std::string& GetNamespace() const { return this->Namespace; }
 
+  std::string const& GetDestination() const
+    { return this->Destination; }
+
 protected:
   virtual void GenerateScript(std::ostream& os);
   virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h
index 38aac91..eeeca15 100644
--- a/Source/cmInstallGenerator.h
+++ b/Source/cmInstallGenerator.h
@@ -50,9 +50,6 @@ public:
     Indent const& indent = Indent()
     );
 
-  const char* GetDestination() const
-    { return this->Destination.c_str(); }
-
   /** Get the install destination as it should appear in the
       installation script.  */
   std::string GetInstallDestination() const;
diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h
index 7e5cc71..4d4b399 100644
--- a/Source/cmInstallTargetGenerator.h
+++ b/Source/cmInstallTargetGenerator.h
@@ -60,6 +60,9 @@ public:
   cmTarget* GetTarget() const { return this->Target; }
   bool IsImportLibrary() const { return this->ImportLibrary; }
 
+  std::string const& GetDestination() const
+    { return this->Destination; }
+
 protected:
   virtual void GenerateScript(std::ostream& os);
   virtual void GenerateScriptForConfig(std::ostream& os,

-----------------------------------------------------------------------

Summary of changes:
 Help/command/install.rst                              |    4 ++++
 Help/release/dev/install-DESTINATION-genex.rst        |    5 +++++
 Source/cmExportInstallFileGenerator.cxx               |   10 +++++-----
 Source/cmInstallDirectoryGenerator.cxx                |    4 +++-
 Source/cmInstallExportGenerator.cxx                   |    8 +++++---
 Source/cmInstallExportGenerator.h                     |    3 +++
 Source/cmInstallFilesGenerator.cxx                    |    1 +
 Source/cmInstallGenerator.cxx                         |   14 ++++++++------
 Source/cmInstallGenerator.h                           |    9 ++++-----
 Source/cmInstallTargetGenerator.cxx                   |   17 ++++++++++++++---
 Source/cmInstallTargetGenerator.h                     |    2 ++
 Tests/ExportImport/Export/CMakeLists.txt              |   12 +++++++++---
 Tests/ExportImport/Export/testLibPerConfigDest.c      |    1 +
 Tests/ExportImport/Import/A/CMakeLists.txt            |    2 ++
 Tests/ExportImport/Import/A/imp_testExe1.c            |    2 ++
 Tests/RunCMake/install/RunCMakeTest.cmake             |    1 +
 .../TARGETS-DESTINATION-bad-result.txt}               |    0
 .../install/TARGETS-DESTINATION-bad-stderr.txt        |    6 ++++++
 Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake  |    3 +++
 .../RunCMake/{GeneratorExpression => install}/empty.c |    0
 20 files changed, 78 insertions(+), 26 deletions(-)
 create mode 100644 Help/release/dev/install-DESTINATION-genex.rst
 create mode 100644 Tests/ExportImport/Export/testLibPerConfigDest.c
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => install/TARGETS-DESTINATION-bad-result.txt} (100%)
 create mode 100644 Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt
 create mode 100644 Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake
 copy Tests/RunCMake/{GeneratorExpression => install}/empty.c (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list