[Cmake-commits] CMake branch, next, updated. v3.1.0-rc3-1103-g2ac7065
Stephen Kelly
steveire at gmail.com
Tue Dec 9 02:21:15 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 2ac7065953475fdc254e2f64efdf922ca1839229 (commit)
via 2bdb47b2c3d2848175cceb4b6adfd88ef8911bac (commit)
from 2a7d72c38f023c6a8491f11e9a470fa6a8f7297b (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=2ac7065953475fdc254e2f64efdf922ca1839229
commit 2ac7065953475fdc254e2f64efdf922ca1839229
Merge: 2a7d72c 2bdb47b
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Dec 9 02:21:14 2014 -0500
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 9 02:21:14 2014 -0500
Merge topic 'diagnose-invalid-_IMPORT_PREFIX-generation' into next
2bdb47b2 Export: Issue error if generating unusable export file (#15258).
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2bdb47b2c3d2848175cceb4b6adfd88ef8911bac
commit 2bdb47b2c3d2848175cceb4b6adfd88ef8911bac
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Mon Dec 8 19:29:56 2014 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Dec 9 08:21:12 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.
Extend policy CMP0057 to cover this diagnostic.
diff --git a/Help/policy/CMP0057.rst b/Help/policy/CMP0057.rst
index 79da0b9..ddd2bf1 100644
--- a/Help/policy/CMP0057.rst
+++ b/Help/policy/CMP0057.rst
@@ -6,8 +6,12 @@ Error on absolute export with relative usage requirements.
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.
+target in the specified export set. Unusable files could also be generated
+if the ``$<INSTALL_PREFIX>`` generator expression was used, despite an
+export with an absolute ``DESTINATION``, or if the ``$<INSTALL_INTERFACE>``
+generator expression was used containing a relative path. 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
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..b519a98 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -299,14 +299,81 @@ 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())
+ {
+ std::string userFacingInput = input;
+ while((pos = userFacingInput.find("${_IMPORT_PREFIX}/", lastPos))
+ != userFacingInput.npos)
+ {
+ std::string::size_type endPos = pos + sizeof("${_IMPORT_PREFIX}/") - 1;
+ userFacingInput.erase(pos, endPos - pos);
+ lastPos = endPos;
+ }
+
+ if (!checkCMP0057(target, propName, userFacingInput,
+ this->IEGen->GetExportSet()))
+ {
+ return;
+ }
+ }
+
+ pos = 0;
+ lastPos = pos;
+
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..a5ece0d
--- /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 absolute export with relative usage
+ requirements. 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..a11f06a
--- /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
+
+ "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..32cc756
--- /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
+
+ "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..1c2acb5
--- /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 absolute export with relative usage
+ requirements. 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
+
+ "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)
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list