[Cmake-commits] CMake branch, next, updated. v2.8.10.2-1787-g23c5440

Stephen Kelly steveire at gmail.com
Sun Jan 27 04:04:27 EST 2013


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  23c544089e608879ee3138f1399e1c325ac43019 (commit)
       via  34d1ade048a87953c089d730f0126eecb6685968 (commit)
       via  3a1719793fa4eb4024e2e36e17196832551d469c (commit)
       via  f7db6d115d0bd665ee0ed9be9994a59792d016af (commit)
      from  c6e58afc8a8aa2d626ee35890501c536a4adb4a1 (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=23c544089e608879ee3138f1399e1c325ac43019
commit 23c544089e608879ee3138f1399e1c325ac43019
Merge: c6e58af 34d1ade
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 27 04:04:26 2013 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jan 27 04:04:26 2013 -0500

    Merge topic 'fix-relocatable-include-dirs' into next
    
    34d1ade Add the INSTALL_PREFIX genex.
    3a17197 Generate the _IMPORT_PREFIX in the non-config export file.
    f7db6d1 CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=34d1ade048a87953c089d730f0126eecb6685968
commit 34d1ade048a87953c089d730f0126eecb6685968
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 27 09:43:44 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 27 09:59:26 2013 +0100

    Add the INSTALL_PREFIX genex.

diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index be9f2ff..8b80a8a 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -55,6 +55,8 @@
   "the 'head' target was created, else '0'.  If the policy was not "    \
   "set, the warning message for the policy will be emitted.  This "     \
   "generator expression only works for a subset of policies.\n"         \
+  "  $<INSTALL_PREFIX>         = Content of the install prefix when "   \
+  "the target is exported via INSTALL(EXPORT) and empty otherwise.\n"   \
   "Boolean expressions:\n"                                              \
   "  $<AND:?[,?]...>           = '1' if all '?' are '1', else '0'\n"    \
   "  $<OR:?[,?]...>            = '0' if all '?' are '0', else '1'\n"    \
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 96e0aea..2ae7138 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -431,6 +431,9 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
     input.replace(pos, endPos - pos + 1, targetName);
     lastPos = endPos;
     }
+
+  this->ReplaceInstallPrefix(input);
+
   if (!errorString.empty())
     {
     mf->IssueMessage(cmake::FATAL_ERROR, errorString);
@@ -439,6 +442,13 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
 
 //----------------------------------------------------------------------------
 void
+cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
+{
+  // Do nothing
+}
+
+//----------------------------------------------------------------------------
+void
 cmExportFileGenerator
 ::SetImportLinkInterface(const char* config, std::string const& suffix,
                     cmGeneratorExpression::PreprocessContext preprocessRule,
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index b39df0f..776be61 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -152,6 +152,8 @@ private:
   void ResolveTargetsInGeneratorExpression(std::string &input,
                                     cmTarget* target,
                                     std::vector<std::string> &missingTargets);
+
+  virtual void ReplaceInstallPrefix(std::string &input);
 };
 
 #endif
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index c7e3581..b6600f0 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -155,6 +155,21 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 }
 
 //----------------------------------------------------------------------------
+void
+cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input)
+{
+  std::string::size_type pos = 0;
+  std::string::size_type lastPos = pos;
+
+  while((pos = input.find("$<INSTALL_PREFIX>", lastPos)) != input.npos)
+    {
+    std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
+    input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
+    lastPos = endPos;
+    }
+}
+
+//----------------------------------------------------------------------------
 bool
 cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
                                     std::vector<std::string> &missingTargets)
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index e187749..7a70431 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -64,6 +64,8 @@ protected:
                                    cmTarget* depender,
                                    cmTarget* dependee);
 
+  virtual void ReplaceInstallPrefix(std::string &input);
+
   void ComplainAboutMissingTarget(cmTarget* depender,
                                   cmTarget* dependee,
                                   int occurrences);
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 0c61a12..f74b69e 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -615,6 +615,24 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
 } targetPolicyNode;
 
 //----------------------------------------------------------------------------
+static const struct InstallPrefixNode : public cmGeneratorExpressionNode
+{
+  InstallPrefixNode() {}
+
+  virtual bool GeneratesContent() const { return false; }
+  virtual int NumExpectedParameters() const { return 0; }
+
+  std::string Evaluate(const std::vector<std::string> &,
+                       cmGeneratorExpressionContext *,
+                       const GeneratorExpressionContent *,
+                       cmGeneratorExpressionDAGChecker *) const
+  {
+    return std::string();
+  }
+
+} installPrefixNode;
+
+//----------------------------------------------------------------------------
 template<bool linker, bool soname>
 struct TargetFilesystemArtifactResultCreator
 {
@@ -849,6 +867,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
     return &installInterfaceNode;
   else if (identifier == "TARGET_DEFINED")
     return &targetDefinedNode;
+  else if (identifier == "INSTALL_PREFIX")
+    return &installPrefixNode;
   return 0;
 
 }
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index eecfd6a..cfcd9fa 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -113,9 +113,16 @@ macro(add_include_lib _libName)
   add_library(${_libName} "${CMAKE_CURRENT_BINARY_DIR}/${_libName}.c")
   file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_libName}")
   set_property(TARGET ${_libName} APPEND PROPERTY
-      INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/${_libName}")
+      INTERFACE_INCLUDE_DIRECTORIES
+        "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${_libName}>"
+        "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/${_libName}>"
+      )
   if (NOT "${ARGV1}" STREQUAL "NO_HEADER")
       file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h" "// no content\n")
+      install(FILES
+        "${CMAKE_CURRENT_BINARY_DIR}/${_libName}/${_libName}.h"
+          DESTINATION include/${_libName}
+      )
   endif()
 endmacro()
 
@@ -129,6 +136,10 @@ add_include_lib(testLibIncludeRequired3 NO_HEADER)
 # but we are testing that the INSTALL_INTERFACE causes it not to be used
 # at build time.
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired3/testLibIncludeRequired4.h" "#error Should not be included\n")
+install(FILES
+  "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired3/testLibIncludeRequired4.h"
+    DESTINATION include/testLibIncludeRequired3
+)
 add_include_lib(testLibIncludeRequired4)
 add_include_lib(testLibIncludeRequired5 NO_HEADER)
 # Generate testLibIncludeRequired6 in the testLibIncludeRequired5 directory
@@ -139,6 +150,10 @@ add_include_lib(testLibIncludeRequired5 NO_HEADER)
 # the Import side of this unit test, the '6' include from the '5' directory
 # will not be used because it is in the BUILD_INTERFACE only.
 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired5/testLibIncludeRequired6.h" "#error Should not be included\n")
+install(FILES
+  "${CMAKE_CURRENT_BINARY_DIR}/testLibIncludeRequired5/testLibIncludeRequired6.h"
+    DESTINATION include/testLibIncludeRequired5
+)
 add_include_lib(testLibIncludeRequired6)
 
 set_property(TARGET testLibRequired APPEND PROPERTY
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index ecbbedf..a40a541 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -89,6 +89,7 @@ add_custom_target(check-part2 ALL
     -Dtest_install_interface=$<INSTALL_INTERFACE:install>
     -Dtest_target_name_1=$<TARGET_NAME:tgt,ok>
     -Dtest_target_name_2=$<TARGET_NAME:tgt:ok>
+    -Dtest_install_prefix=$<INSTALL_PREFIX>
     -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part2.cmake
   COMMAND ${CMAKE_COMMAND} -E echo "check done (part 2 of 2)"
   VERBATIM
diff --git a/Tests/GeneratorExpression/check-part2.cmake b/Tests/GeneratorExpression/check-part2.cmake
index 8855a97..0b50204 100644
--- a/Tests/GeneratorExpression/check-part2.cmake
+++ b/Tests/GeneratorExpression/check-part2.cmake
@@ -26,3 +26,4 @@ check(test_build_interface "build")
 check(test_install_interface "")
 check(test_target_name_1 "tgt,ok")
 check(test_target_name_2 "tgt:ok")
+check(test_install_prefix "")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a1719793fa4eb4024e2e36e17196832551d469c
commit 3a1719793fa4eb4024e2e36e17196832551d469c
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jan 27 09:42:54 2013 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jan 27 09:42:54 2013 +0100

    Generate the _IMPORT_PREFIX in the non-config export file.

diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index a35f5cf..c7e3581 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -69,6 +69,27 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
   this->GenerateExpectedTargetsCode(os, expectedTargets);
   }
 
+  // Add code to compute the installation prefix relative to the
+  // import file location.
+  const char* installDest = this->IEGen->GetDestination();
+  if(!cmSystemTools::FileIsFullPath(installDest))
+    {
+    std::string dest = installDest;
+    os << "# Compute the installation prefix relative to this file.\n"
+       << "get_filename_component(_IMPORT_PREFIX "
+       << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
+    while(!dest.empty())
+      {
+      os <<
+        "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
+      dest = cmSystemTools::GetFilenamePath(dest);
+      }
+    os << "\n";
+
+    // Import location properties may reference this variable.
+    this->ImportPrefix = "${_IMPORT_PREFIX}/";
+    }
+
   std::vector<std::string> missingTargets;
 
   // Create all the imported targets.
@@ -107,6 +128,13 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
      << "endforeach()\n"
      << "\n";
 
+  // Cleanup the import prefix variable.
+  if(!this->ImportPrefix.empty())
+    {
+    os << "# Cleanup temporary variables.\n"
+       << "set(_IMPORT_PREFIX)\n"
+       << "\n";
+    }
   this->GenerateImportedFileCheckLoop(os);
 
   // Generate an import file for each configuration.
@@ -187,27 +215,6 @@ cmExportInstallFileGenerator
                               const char* config, std::string const& suffix,
                               std::vector<std::string> &missingTargets)
 {
-  // Add code to compute the installation prefix relative to the
-  // import file location.
-  const char* installDest = this->IEGen->GetDestination();
-  if(!cmSystemTools::FileIsFullPath(installDest))
-    {
-    std::string dest = installDest;
-    os << "# Compute the installation prefix relative to this file.\n"
-       << "get_filename_component(_IMPORT_PREFIX "
-       << "\"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
-    while(!dest.empty())
-      {
-      os <<
-        "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" PATH)\n";
-      dest = cmSystemTools::GetFilenamePath(dest);
-      }
-    os << "\n";
-
-    // Import location properties may reference this variable.
-    this->ImportPrefix = "${_IMPORT_PREFIX}/";
-    }
-
   // Add each target in the set to the export.
   for(std::vector<cmTargetExport*>::const_iterator
         tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
@@ -253,14 +260,6 @@ cmExportInstallFileGenerator
                                            importedLocations);
       }
     }
-
-  // Cleanup the import prefix variable.
-  if(!this->ImportPrefix.empty())
-    {
-    os << "# Cleanup temporary variables.\n"
-       << "set(_IMPORT_PREFIX)\n"
-       << "\n";
-    }
 }
 
 //----------------------------------------------------------------------------

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

Summary of changes:
 Source/CMakeVersion.cmake                   |    2 +-
 Source/cmDocumentGeneratorExpressions.h     |    2 +
 Source/cmExportFileGenerator.cxx            |   10 ++++
 Source/cmExportFileGenerator.h              |    2 +
 Source/cmExportInstallFileGenerator.cxx     |   72 ++++++++++++++++-----------
 Source/cmExportInstallFileGenerator.h       |    2 +
 Source/cmGeneratorExpressionEvaluator.cxx   |   20 +++++++
 Tests/ExportImport/Export/CMakeLists.txt    |   17 ++++++-
 Tests/GeneratorExpression/CMakeLists.txt    |    1 +
 Tests/GeneratorExpression/check-part2.cmake |    1 +
 10 files changed, 98 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list