diff options
author | Brad King <brad.king@kitware.com> | 2014-12-15 14:52:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-12-15 16:45:49 (GMT) |
commit | dd089e08b578f20b7dc7d2ce658e3df05e346e35 (patch) | |
tree | 2bae57f141cbff3933ba867a2be0ec98430c27e8 /Tests/ExportImport/Import/A | |
parent | 1b3ab3318dcdabe074da3c95b54f9483d47f95be (diff) | |
download | CMake-dd089e08b578f20b7dc7d2ce658e3df05e346e35.zip CMake-dd089e08b578f20b7dc7d2ce658e3df05e346e35.tar.gz CMake-dd089e08b578f20b7dc7d2ce658e3df05e346e35.tar.bz2 |
install: Allow absolute EXPORT destination with relative targets (#15258)
When install(EXPORT) is given an absolute destination we cannot compute
the install prefix relative to the installed export file location.
Previously we disallowed installation of targets in such exports with a
relative destination, but did not enforce this for target property
values besides the location of the main target file. This could lead to
broken installations when the EXPORT is installed to an absolute path
but usage requirements are specified relative to the install prefix.
Since an EXPORT installed to an absolute destination cannot be relocated
we can just hard-code the value of CMAKE_INSTALL_PREFIX as the base for
relative paths. This will allow absolute install(EXPORT) destinations
to work with relative destinations for targets and usage requirements.
Extend the ExportImport test with a case covering this behavior.
Diffstat (limited to 'Tests/ExportImport/Import/A')
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/imp_testExeAbs1.c | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index eb0bbf8..9450c82 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -96,6 +96,16 @@ foreach(c DEBUG RELWITHDEBINFO) endforeach() #----------------------------------------------------------------------------- +include(${CMAKE_INSTALL_PREFIX}/lib/expAbs/expAbs.cmake) + +add_executable(imp_testExeAbs1 + imp_testExeAbs1.c + ) +target_link_libraries(imp_testExeAbs1 + expAbs_testLibAbs1 + ) + +#----------------------------------------------------------------------------- # Create a custom target to generate a header for the libraries below. # Drive the header generation through an indirect chain of imported # target dependencies. diff --git a/Tests/ExportImport/Import/A/imp_testExeAbs1.c b/Tests/ExportImport/Import/A/imp_testExeAbs1.c new file mode 100644 index 0000000..069c3f0 --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testExeAbs1.c @@ -0,0 +1,15 @@ +#include "testLibAbs1.h" +#include "testLibAbs1a.h" +#include "testLibAbs1b.h" +#ifndef testLibAbs1a +# error "testLibAbs1a not defined" +#endif +#ifndef testLibAbs1b +# error "testLibAbs1b not defined" +#endif +int main() +{ + return 0 + + testLibAbs1() + ; +} |