[Cmake-commits] CMake branch, next, updated. v3.1.0-rc2-1169-gb1b54ed

Stephen Kelly steveire at gmail.com
Mon Dec 8 13:40:54 EST 2014


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  b1b54ed34a6c129445f056bd3ab0ad590f45b774 (commit)
       via  76a5304936fb32fbafd4de00d74e1434c140b865 (commit)
       via  aab516bd77dd9922541fa911961a60756f035bd0 (commit)
       via  4bf555b0f7635afde86a67cd3ef9eb2ab83d4064 (commit)
       via  67f9fc26bdabee44e94cbaed52f2302f47f9a2d5 (commit)
      from  230e5355966deb3920f4399010979207cda06a27 (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=b1b54ed34a6c129445f056bd3ab0ad590f45b774
commit b1b54ed34a6c129445f056bd3ab0ad590f45b774
Merge: 230e535 76a5304
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 8 13:40:52 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Dec 8 13:40:52 2014 -0500

    Merge topic 'diagnose-invalid-_IMPORT_PREFIX-generation' into next
    
    76a53049 Export: Issue error if generating unusable export file (#15258).
    aab516bd Export: Diagnose issues in INCLUDES DESTINATION while generating (#15258).
    4bf555b0 cmPolicies: Remove superfluous newline.
    67f9fc26 Export: Test error on export of target and export with mixed paths.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=76a5304936fb32fbafd4de00d74e1434c140b865
commit 76a5304936fb32fbafd4de00d74e1434c140b865
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 8 19:29:56 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Dec 8 19:40:33 2014 +0100

    Export: Issue error if generating unusable export file (#15258).
    
    Diagnose presence of $<INSTALL_PREFIX> in exported target properties,
    as can appear in user code, or generated for relative paths inside
    a $<INSTALL_INTERFACE> generator expression.
    
    The case of use of install(TARGETS) with a relative path in
    INCLUDES DESTINATION would also be caught by this diagnostic, but
    that is handled separately because in that case the $<INSTALL_PREFIX>
    is generated by cmake internally, so a more-specific diagnostic is
    desired.

diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 1f39d7a..37956dc 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -171,7 +171,7 @@ void cmExportFileGenerator::PopulateInterfaceProperty(
                                                            preprocessRule);
     if (!prepro.empty())
       {
-      this->ResolveTargetsInGeneratorExpressions(prepro, target,
+      this->ResolveTargetsInGeneratorExpressions(propName, prepro, target,
                                                  missingTargets);
       properties[outputName] = prepro;
       }
@@ -205,7 +205,8 @@ bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
                                                            preprocessRule);
     if (!prepro.empty())
       {
-      this->ResolveTargetsInGeneratorExpressions(prepro, target,
+      this->ResolveTargetsInGeneratorExpressions("INTERFACE_LINK_LIBRARIES",
+                                                 prepro, target,
                                                  missingTargets,
                                                  ReplaceFreeTargets);
       properties["INTERFACE_LINK_LIBRARIES"] = prepro;
@@ -383,7 +384,8 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
                                             tei->InterfaceIncludeDirectories,
                                             preprocessRule,
                                             true);
-  this->ReplaceInstallPrefix(dirs);
+  this->ReplaceInstallPrefix(tei->Target, "INTERFACE_INCLUDE_DIRECTORIES",
+                             dirs);
   cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
   std::string exportDirs = cge->Evaluate(target->GetMakefile(), "",
                                          false, target);
@@ -421,8 +423,9 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
                                                          true);
   if (!prepro.empty())
     {
-    this->ResolveTargetsInGeneratorExpressions(prepro, target,
-                                                missingTargets);
+    this->ResolveTargetsInGeneratorExpressions("INTERFACE_INCLUDE_DIRECTORIES",
+                                               prepro, target,
+                                               missingTargets);
 
     if (!checkInterfaceDirs(prepro, target))
       {
@@ -607,6 +610,7 @@ cmExportFileGenerator::AddTargetNamespace(std::string &input,
 //----------------------------------------------------------------------------
 void
 cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
+                                    std::string const& propName,
                                     std::string &input,
                                     cmTarget* target,
                                     std::vector<std::string> &missingTargets,
@@ -614,7 +618,8 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
 {
   if (replace == NoReplaceFreeTargets)
     {
-    this->ResolveTargetsInGeneratorExpression(input, target, missingTargets);
+    this->ResolveTargetsInGeneratorExpression(propName, input,
+                                              target, missingTargets);
     return;
     }
   std::vector<std::string> parts;
@@ -631,7 +636,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
       }
     else
       {
-      this->ResolveTargetsInGeneratorExpression(
+      this->ResolveTargetsInGeneratorExpression(propName,
                                     *li,
                                     target,
                                     missingTargets);
@@ -644,6 +649,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
 //----------------------------------------------------------------------------
 void
 cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
+                                    std::string const& propName,
                                     std::string &input,
                                     cmTarget* target,
                                     std::vector<std::string> &missingTargets)
@@ -709,7 +715,7 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
     lastPos = endPos;
     }
 
-  this->ReplaceInstallPrefix(input);
+  this->ReplaceInstallPrefix(target, propName, input);
 
   if (!errorString.empty())
     {
@@ -719,7 +725,8 @@ cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
 
 //----------------------------------------------------------------------------
 void
-cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
+cmExportFileGenerator::ReplaceInstallPrefix(cmTarget*,
+                                            std::string const&, std::string &)
 {
   // Do nothing
 }
@@ -792,9 +799,11 @@ cmExportFileGenerator
                                                          preprocessRule);
   if (!prepro.empty())
     {
-    this->ResolveTargetsInGeneratorExpressions(prepro, target,
-                                               missingTargets,
-                                               ReplaceFreeTargets);
+    this->ResolveTargetsInGeneratorExpressions(
+                                          "LINK_INTERFACE_LIBRARIES" + suffix,
+                                          prepro, target,
+                                          missingTargets,
+                                          ReplaceFreeTargets);
     properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
     }
 }
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index 919924e..d3b9fee 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -151,7 +151,9 @@ protected:
     NoReplaceFreeTargets
   };
 
-  void ResolveTargetsInGeneratorExpressions(std::string &input,
+  void ResolveTargetsInGeneratorExpressions(
+                          std::string const& propName,
+                          std::string &input,
                           cmTarget* target,
                           std::vector<std::string> &missingTargets,
                           FreeTargetsReplace replace = NoReplaceFreeTargets);
@@ -187,11 +189,15 @@ private:
   bool AddTargetNamespace(std::string &input, cmTarget* target,
                           std::vector<std::string> &missingTargets);
 
-  void ResolveTargetsInGeneratorExpression(std::string &input,
+  void ResolveTargetsInGeneratorExpression(
+                                    std::string const& propName,
+                                    std::string &input,
                                     cmTarget* target,
                                     std::vector<std::string> &missingTargets);
 
-  virtual void ReplaceInstallPrefix(std::string &input);
+  virtual void ReplaceInstallPrefix(cmTarget* target,
+                                    std::string const& propName,
+                                    std::string &input);
 
   virtual std::string InstallNameDir(cmTarget* target,
                                      const std::string& config) = 0;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 5bc36a5..ebe5b85 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -299,14 +299,68 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 }
 
 //----------------------------------------------------------------------------
+static bool checkCMP0057(cmTarget* target, std::string const& propName,
+                         std::string const& input, cmExportSet* exportSet)
+{
+  cmOStringStream e;
+  cmake::MessageType messageType = cmake::FATAL_ERROR;
+  cmMakefile* mf = target->GetMakefile();
+  switch(target->GetPolicyStatusCMP0057())
+    {
+    case cmPolicies::WARN:
+      e << (mf->GetPolicies()
+            ->GetPolicyWarning(cmPolicies::CMP0057)) << "\n";
+    case cmPolicies::OLD:
+      messageType = cmake::AUTHOR_WARNING;
+      break;
+    case cmPolicies::REQUIRED_ALWAYS:
+    case cmPolicies::REQUIRED_IF_USED:
+    case cmPolicies::NEW:
+      break;
+    }
+  e << "Target \""
+    << target->GetName()
+    << "\" is installed with a path relative to the installation "
+      "prefix\n  \"" << input << "\"\nin its " << propName
+    << " property.  The target is part of export set \""
+    << exportSet->GetName() << "\" which is installed "
+      "with an absolute path as its DESTINATION.  This mixing of "
+      "absolute and relative paths creates unusable target export files.";
+  mf->IssueMessage(messageType, e.str());
+  if (messageType == cmake::FATAL_ERROR)
+    {
+    return false;
+    }
+  return true;
+}
+
+//----------------------------------------------------------------------------
 void
-cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input)
+cmExportInstallFileGenerator::ReplaceInstallPrefix(cmTarget* target,
+                                                   std::string const& propName,
+                                                   std::string &input)
 {
   std::string::size_type pos = 0;
   std::string::size_type lastPos = pos;
 
+  if (input.find("${_IMPORT_PREFIX}") != std::string::npos
+      && this->ImportPrefix.empty())
+    {
+    if (!checkCMP0057(target, propName, input, this->IEGen->GetExportSet()))
+      {
+      return;
+      }
+    }
+
   while((pos = input.find("$<INSTALL_PREFIX>", lastPos)) != input.npos)
     {
+    if (this->ImportPrefix.empty())
+      {
+      if (!checkCMP0057(target, propName, input, this->IEGen->GetExportSet()))
+        {
+        return;
+        }
+      }
     std::string::size_type endPos = pos + sizeof("$<INSTALL_PREFIX>") - 1;
     input.replace(pos, endPos - pos, "${_IMPORT_PREFIX}");
     lastPos = endPos;
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index 3d7b0c6..0723085 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -62,7 +62,9 @@ protected:
                                    cmTarget* depender,
                                    cmTarget* dependee);
 
-  virtual void ReplaceInstallPrefix(std::string &input);
+  virtual void ReplaceInstallPrefix(cmTarget* target,
+                                    std::string const& propName,
+                                    std::string &input);
 
   void ComplainAboutMissingTarget(cmTarget* depender,
                                   cmTarget* dependee,
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-stderr.txt
new file mode 100644
index 0000000..2968b91
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error in CMakeLists.txt:
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\$<INSTALL_PREFIX>/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW.cmake
new file mode 100644
index 0000000..c7255db
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 NEW)
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-stderr.txt
new file mode 100644
index 0000000..860f62f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\$<INSTALL_PREFIX>/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD.cmake
new file mode 100644
index 0000000..1c27fd7
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 OLD)
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-stderr.txt
new file mode 100644
index 0000000..1426fff
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-stderr.txt
@@ -0,0 +1,15 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Policy CMP0057 is not set: Error on export with bad INCLUDES DESTINATION.
+  Run "cmake --help-policy CMP0057" for policy details.  Use the cmake_policy
+  command to set the policy and suppress this warning.
+
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\$<INSTALL_PREFIX>/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN.cmake
new file mode 100644
index 0000000..06e793e
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN.cmake
@@ -0,0 +1,11 @@
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-stderr.txt
new file mode 100644
index 0000000..0084903
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-stderr.txt
@@ -0,0 +1,10 @@
+CMake Error in CMakeLists.txt:
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\${_IMPORT_PREFIX}/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW.cmake
new file mode 100644
index 0000000..912aaef
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 NEW)
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-stderr.txt
new file mode 100644
index 0000000..9cad673
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-stderr.txt
@@ -0,0 +1,11 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\${_IMPORT_PREFIX}/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD.cmake
new file mode 100644
index 0000000..e6f5b96
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 OLD)
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-result.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-stderr.txt
new file mode 100644
index 0000000..e0b4627
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-stderr.txt
@@ -0,0 +1,15 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Policy CMP0057 is not set: Error on export with bad INCLUDES DESTINATION.
+  Run "cmake --help-policy CMP0057" for policy details.  Use the cmake_policy
+  command to set the policy and suppress this warning.
+
+  Target "somelib" is installed with a path relative to the installation
+  prefix
+
+    "\${_IMPORT_PREFIX}/include"
+
+  in its INTERFACE_INCLUDE_DIRECTORIES property.  The target is part of
+  export set "exp" which is installed with an absolute path as its
+  DESTINATION.  This mixing of absolute and relative paths creates unusable
+  target export files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN.cmake b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN.cmake
new file mode 100644
index 0000000..6d112b2
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN.cmake
@@ -0,0 +1,11 @@
+
+add_library(somelib SHARED empty.cpp)
+target_include_directories(somelib INTERFACE $<INSTALL_INTERFACE:include>)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 296d440..2ebe8c0 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -8,3 +8,9 @@ run_cmake(RelativeLibDir)
 run_cmake(RelativeIncludeDestination-CMP0057-NEW)
 run_cmake(RelativeIncludeDestination-CMP0057-OLD)
 run_cmake(RelativeIncludeDestination-CMP0057-WARN)
+run_cmake(RelativeIncludeDirectory-CMP0057-NEW)
+run_cmake(RelativeIncludeDirectory-CMP0057-OLD)
+run_cmake(RelativeIncludeDirectory-CMP0057-WARN)
+run_cmake(RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW)
+run_cmake(RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD)
+run_cmake(RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aab516bd77dd9922541fa911961a60756f035bd0
commit aab516bd77dd9922541fa911961a60756f035bd0
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Dec 7 22:34:44 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Dec 8 19:40:10 2014 +0100

    Export: Diagnose issues in INCLUDES DESTINATION while generating (#15258).
    
    The _IMPORT_PREFIX variable is generated in export files only if the
    installation destination is relative.  If packagers set the path to
    an absolute destination, the generated file must not have any
    references to the _IMPORT_PREFIX as it is undefined.
    
    A use of _IMPORT_PREFIX is generated for content passed to
    install(TARGETS) in the INCLUDES DESTINATION component, if the
    content is a relative path.  Issue a message to notify the user that
    that the generated file is unusable, and introduce policy CMP0057 to
    control the severity of the message.

diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 96f39e6..76ca5d4 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -114,3 +114,4 @@ All Policies
    /policy/CMP0054
    /policy/CMP0055
    /policy/CMP0056
+   /policy/CMP0057
diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst
new file mode 100644
index 0000000..4b456bf
--- /dev/null
+++ b/Help/policy/CMP0057.rst
@@ -0,0 +1,20 @@
+CMP0057
+-------
+
+Error on export with bad INCLUDES DESTINATION.
+
+CMake 3.1 and lower generated unusable files with the
+:command:`install(EXPORT)` command if an absolute ``DESTINATION`` was used
+with it, and a relative path was passed to the ``INCLUDES DESTINATION`` of a
+target in the specified export set.  In such cases, a use of an internal
+variable was generated, although the internal variable was unset.
+
+The ``OLD`` behavior for this policy is to issue a warning if a the
+:command:`install(EXPORT)` command generates such an unusable file.  The
+``NEW`` behavior for this policy is to issue an error instead of generating
+the file.
+
+This policy was introduced in CMake version 3.2.
+CMake version |release| warns when the policy is not set and uses
+``OLD`` behavior.  Use the :command:`cmake_policy` command to set it to
+``OLD`` or ``NEW`` explicitly.
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 23180f1..5bc36a5 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -37,15 +37,70 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
 }
 
 //----------------------------------------------------------------------------
+bool cmExportInstallFileGenerator
+::CheckIncludesDestinationContent(cmTargetExport* tei,
+                                  cmExportSet* exportSet)
+{
+  std::vector<std::string> parts;
+  cmGeneratorExpression::Split(tei->InterfaceIncludeDirectories, parts);
+  for (std::vector<std::string>::const_iterator it = parts.begin();
+       it != parts.end(); ++it)
+    {
+    if (!cmSystemTools::FileIsFullPath(*it))
+      {
+      if (cmGeneratorExpression::Find(*it) != 0)
+        {
+        if (this->ImportPrefix.empty())
+          {
+          cmOStringStream e;
+          cmake::MessageType messageType = cmake::FATAL_ERROR;
+          cmMakefile* mf = tei->Target->GetMakefile();
+          switch(tei->Target->GetPolicyStatusCMP0057())
+            {
+            case cmPolicies::WARN:
+              e << (mf->GetPolicies()
+                    ->GetPolicyWarning(cmPolicies::CMP0057)) << "\n";
+            case cmPolicies::OLD:
+              messageType = cmake::AUTHOR_WARNING;
+              break;
+            case cmPolicies::REQUIRED_ALWAYS:
+            case cmPolicies::REQUIRED_IF_USED:
+            case cmPolicies::NEW:
+              break;
+            }
+          e << "Target \""
+            << tei->Target->GetName()
+            << "\" is installed as part of export set \""
+            << exportSet->GetName() << "\" with an INCLUDES DESTINATION "
+              "containing relative path\n  \"" << *it
+            << "\"\nThe export set \""
+            << exportSet->GetName()
+            << "\" is installed with an absolute path as its DESTINATION.  "
+              "This mixing of absolute and relative paths creates unusable "
+              "target export files.";
+          mf->IssueMessage(messageType, e.str());
+          if (messageType == cmake::FATAL_ERROR)
+            {
+            return false;
+            }
+          }
+        }
+      }
+    }
+  return true;
+}
+
+//----------------------------------------------------------------------------
 bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 {
   std::vector<cmTargetExport*> allTargets;
+  cmExportSet* exportSet = this->IEGen->GetExportSet();
   {
   std::string expectedTargets;
   std::string sep;
   for(std::vector<cmTargetExport*>::const_iterator
-        tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
-      tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
+        tei = exportSet->GetTargetExports()->begin();
+      tei != exportSet->GetTargetExports()->end(); ++tei)
     {
     expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName();
     sep = " ";
@@ -58,7 +113,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
       {
       cmOStringStream e;
       e << "install(EXPORT \""
-        << this->IEGen->GetExportSet()->GetName()
+        << exportSet->GetName()
         << "\" ...) " << "includes target \"" << te->Target->GetName()
         << "\" more than once in the export set.";
       cmSystemTools::Error(e.str().c_str());
@@ -141,6 +196,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 
     ImportPropertyMap properties;
 
+    if (!this->CheckIncludesDestinationContent(*tei, exportSet))
+      {
+      return false;
+      }
+
     this->PopulateIncludeDirectoriesInterface(*tei,
                                   cmGeneratorExpression::InstallInterface,
                                   properties, missingTargets);
diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h
index b851ad5..3d7b0c6 100644
--- a/Source/cmExportInstallFileGenerator.h
+++ b/Source/cmExportInstallFileGenerator.h
@@ -16,6 +16,7 @@
 
 class cmInstallExportGenerator;
 class cmInstallTargetGenerator;
+class cmExportSet;
 
 /** \class cmExportInstallFileGenerator
  * \brief Generate a file exporting targets from an install tree.
@@ -87,6 +88,9 @@ protected:
 
   std::string InstallNameDir(cmTarget* target, const std::string& config);
 
+  bool CheckIncludesDestinationContent(cmTargetExport* tei,
+                                       cmExportSet* exportSet);
+
   cmInstallExportGenerator* IEGen;
 
   std::string ImportPrefix;
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 1a27a25..8110f6e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -374,6 +374,11 @@ cmPolicies::cmPolicies()
     CMP0056, "CMP0056",
     "Honor link flags in try_compile() source-file signature.",
     3,2,0, cmPolicies::WARN);
+
+  this->DefinePolicy(
+    CMP0057, "CMP0057",
+    "Error on export with bad INCLUDES DESTINATION.",
+    3,2,0, cmPolicies::WARN);
 }
 
 cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 2ad4890..26c351f 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -112,6 +112,7 @@ public:
     /// or keywords when unquoted.
     CMP0055, ///< Strict checking for break() command.
     CMP0056, ///< Honor link flags in try_compile() source-file signature.
+    CMP0057, ///< Error on export with bad INCLUDES DESTINATION.
 
     /** \brief Always the last entry.
      *
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index a3ecca0..dc4e6c6 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -34,7 +34,8 @@
   F(CMP0041) \
   F(CMP0042) \
   F(CMP0046) \
-  F(CMP0052)
+  F(CMP0052) \
+  F(CMP0057)
 
 class cmake;
 class cmMakefile;
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index f4b744b..7a59902 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -17,6 +17,7 @@
    \* CMP0042
    \* CMP0046
    \* CMP0052
+   \* CMP0057
 
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-result.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-stderr.txt
new file mode 100644
index 0000000..8cd27c2
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error in CMakeLists.txt:
+  Target "somelib" is installed as part of export set "exp" with an INCLUDES
+  DESTINATION containing relative path
+
+    "include"
+
+  The export set "exp" is installed with an absolute path as its DESTINATION.
+  This mixing of absolute and relative paths creates unusable target export
+  files.
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW.cmake b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW.cmake
new file mode 100644
index 0000000..cab9ac6
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 NEW)
+
+add_library(somelib SHARED empty.cpp)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+  INCLUDES DESTINATION include
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-result.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-stderr.txt
new file mode 100644
index 0000000..79c92a1
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-stderr.txt
@@ -0,0 +1,10 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Target "somelib" is installed as part of export set "exp" with an INCLUDES
+  DESTINATION containing relative path
+
+    "include"
+
+  The export set "exp" is installed with an absolute path as its DESTINATION.
+  This mixing of absolute and relative paths creates unusable target export
+  files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD.cmake b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD.cmake
new file mode 100644
index 0000000..58bcbb7
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0057 OLD)
+
+add_library(somelib SHARED empty.cpp)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+  INCLUDES DESTINATION include
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-result.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-stderr.txt b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-stderr.txt
new file mode 100644
index 0000000..fd9a743
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-stderr.txt
@@ -0,0 +1,14 @@
+CMake Warning \(dev\) in CMakeLists.txt:
+  Policy CMP0057 is not set: Error on export with bad INCLUDES DESTINATION.
+  Run "cmake --help-policy CMP0057" for policy details.  Use the cmake_policy
+  command to set the policy and suppress this warning.
+
+  Target "somelib" is installed as part of export set "exp" with an INCLUDES
+  DESTINATION containing relative path
+
+    "include"
+
+  The export set "exp" is installed with an absolute path as its DESTINATION.
+  This mixing of absolute and relative paths creates unusable target export
+  files.
+This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN.cmake b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN.cmake
new file mode 100644
index 0000000..82bde5d
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN.cmake
@@ -0,0 +1,11 @@
+
+add_library(somelib SHARED empty.cpp)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
+  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
+  INCLUDES DESTINATION include
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 32cf30c..296d440 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -5,3 +5,6 @@ run_cmake(AppendExport)
 run_cmake(OldIface)
 run_cmake(NoExportSet)
 run_cmake(RelativeLibDir)
+run_cmake(RelativeIncludeDestination-CMP0057-NEW)
+run_cmake(RelativeIncludeDestination-CMP0057-OLD)
+run_cmake(RelativeIncludeDestination-CMP0057-WARN)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4bf555b0f7635afde86a67cd3ef9eb2ab83d4064
commit 4bf555b0f7635afde86a67cd3ef9eb2ab83d4064
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu May 15 19:15:02 2014 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Dec 8 19:08:43 2014 +0100

    cmPolicies: Remove superfluous newline.

diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index c393c2f..2ad4890 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -107,7 +107,6 @@ public:
     CMP0051, ///< List TARGET_OBJECTS in SOURCES target property
     CMP0052, ///< Reject source and build dirs in installed
     /// INTERFACE_INCLUDE_DIRECTORIES
-
     CMP0053, ///< Simplify variable reference and escape sequence evaluation
     CMP0054, ///< Only interpret if() arguments as variables
     /// or keywords when unquoted.

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67f9fc26bdabee44e94cbaed52f2302f47f9a2d5
commit 67f9fc26bdabee44e94cbaed52f2302f47f9a2d5
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Dec 7 22:19:08 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Mon Dec 8 19:08:43 2014 +0100

    Export: Test error on export of target and export with mixed paths.
    
    If the export is installed to a DESTINATION path which is absolute,
    the LIBRARY DESTINATION must also be absolute.
    
    The LIBRARY DESTINATION is used as the IMPORTED_LOCATION of the generated
    IMPORTED target, and it may conditionally contain a reference to
    ${_IMPORT_PREFIX}, which is only generated if exported to a relative
    path.

diff --git a/Tests/RunCMake/export/RelativeLibDir-result.txt b/Tests/RunCMake/export/RelativeLibDir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeLibDir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/export/RelativeLibDir-stderr.txt b/Tests/RunCMake/export/RelativeLibDir-stderr.txt
new file mode 100644
index 0000000..98fd01f
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeLibDir-stderr.txt
@@ -0,0 +1 @@
+CMake Error: install\(EXPORT "exp"\) given absolute DESTINATION "[^"]*" but the export references an installation of target "somelib" which has relative DESTINATION "lib".
diff --git a/Tests/RunCMake/export/RelativeLibDir.cmake b/Tests/RunCMake/export/RelativeLibDir.cmake
new file mode 100644
index 0000000..a663451
--- /dev/null
+++ b/Tests/RunCMake/export/RelativeLibDir.cmake
@@ -0,0 +1,10 @@
+
+add_library(somelib SHARED empty.cpp)
+
+install(TARGETS somelib EXPORT exp
+  LIBRARY DESTINATION lib
+  ARCHIVE DESTINATION lib
+  RUNTIME DESTINATION bin
+)
+
+install(EXPORT exp DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake)
diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake
index 4b04f18..32cf30c 100644
--- a/Tests/RunCMake/export/RunCMakeTest.cmake
+++ b/Tests/RunCMake/export/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(TargetNotFound)
 run_cmake(AppendExport)
 run_cmake(OldIface)
 run_cmake(NoExportSet)
+run_cmake(RelativeLibDir)
diff --git a/Tests/RunCMake/export/empty.cpp b/Tests/RunCMake/export/empty.cpp
new file mode 100644
index 0000000..bfbbdde
--- /dev/null
+++ b/Tests/RunCMake/export/empty.cpp
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int empty()
+{
+  return 0;
+}

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

Summary of changes:
 Help/manual/cmake-policies.7.rst                   |    1 +
 Help/policy/CMP0057.rst                            |   20 ++++
 Source/cmExportFileGenerator.cxx                   |   33 ++++--
 Source/cmExportFileGenerator.h                     |   12 +-
 Source/cmExportInstallFileGenerator.cxx            |  122 +++++++++++++++++++-
 Source/cmExportInstallFileGenerator.h              |    8 +-
 Source/cmPolicies.cxx                              |    5 +
 Source/cmPolicies.h                                |    2 +-
 Source/cmTarget.h                                  |    3 +-
 .../RunCMake/TargetPolicies/PolicyList-stderr.txt  |    1 +
 ...ativeIncludeDestination-CMP0057-NEW-result.txt} |    0
 ...lativeIncludeDestination-CMP0057-NEW-stderr.txt |    9 ++
 .../RelativeIncludeDestination-CMP0057-NEW.cmake   |   13 +++
 ...ativeIncludeDestination-CMP0057-OLD-result.txt} |    0
 ...lativeIncludeDestination-CMP0057-OLD-stderr.txt |   10 ++
 .../RelativeIncludeDestination-CMP0057-OLD.cmake   |   13 +++
 ...tiveIncludeDestination-CMP0057-WARN-result.txt} |    0
 ...ativeIncludeDestination-CMP0057-WARN-stderr.txt |   14 +++
 .../RelativeIncludeDestination-CMP0057-WARN.cmake  |   11 ++
 ...irectory-CMP0057-INSTALL_PREFIX-NEW-result.txt} |    0
 ...Directory-CMP0057-INSTALL_PREFIX-NEW-stderr.txt |   10 ++
 ...cludeDirectory-CMP0057-INSTALL_PREFIX-NEW.cmake |   13 +++
 ...irectory-CMP0057-INSTALL_PREFIX-OLD-result.txt} |    0
 ...Directory-CMP0057-INSTALL_PREFIX-OLD-stderr.txt |   11 ++
 ...cludeDirectory-CMP0057-INSTALL_PREFIX-OLD.cmake |   13 +++
 ...rectory-CMP0057-INSTALL_PREFIX-WARN-result.txt} |    0
 ...irectory-CMP0057-INSTALL_PREFIX-WARN-stderr.txt |   15 +++
 ...ludeDirectory-CMP0057-INSTALL_PREFIX-WARN.cmake |   11 ++
 ...elativeIncludeDirectory-CMP0057-NEW-result.txt} |    0
 ...RelativeIncludeDirectory-CMP0057-NEW-stderr.txt |   10 ++
 .../RelativeIncludeDirectory-CMP0057-NEW.cmake     |   13 +++
 ...elativeIncludeDirectory-CMP0057-OLD-result.txt} |    0
 ...RelativeIncludeDirectory-CMP0057-OLD-stderr.txt |   11 ++
 .../RelativeIncludeDirectory-CMP0057-OLD.cmake     |   13 +++
 ...lativeIncludeDirectory-CMP0057-WARN-result.txt} |    0
 ...elativeIncludeDirectory-CMP0057-WARN-stderr.txt |   15 +++
 .../RelativeIncludeDirectory-CMP0057-WARN.cmake    |   11 ++
 .../RelativeLibDir-result.txt}                     |    0
 Tests/RunCMake/export/RelativeLibDir-stderr.txt    |    1 +
 Tests/RunCMake/export/RelativeLibDir.cmake         |   10 ++
 Tests/RunCMake/export/RunCMakeTest.cmake           |   10 ++
 Tests/RunCMake/{CMP0022 => export}/empty.cpp       |    0
 42 files changed, 422 insertions(+), 22 deletions(-)
 create mode 100644 Help/policy/CMP0057.rst
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => export/RelativeIncludeDestination-CMP0057-NEW-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-NEW.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDestination-CMP0057-OLD-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-OLD.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDestination-CMP0057-WARN-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDestination-CMP0057-WARN.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-NEW.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-OLD.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-INSTALL_PREFIX-WARN.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => export/RelativeIncludeDirectory-CMP0057-NEW-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-NEW.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDirectory-CMP0057-OLD-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-OLD.cmake
 copy Tests/RunCMake/{CMP0022/CMP0022-WARN-empty-old-result.txt => export/RelativeIncludeDirectory-CMP0057-WARN-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeIncludeDirectory-CMP0057-WARN.cmake
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => export/RelativeLibDir-result.txt} (100%)
 create mode 100644 Tests/RunCMake/export/RelativeLibDir-stderr.txt
 create mode 100644 Tests/RunCMake/export/RelativeLibDir.cmake
 copy Tests/RunCMake/{CMP0022 => export}/empty.cpp (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list