diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-11-26 01:38:55 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-11-26 09:30:18 (GMT) |
commit | 38afc82e764ed9071748df9f5386c53f26657fe5 (patch) | |
tree | fa1f5dbe9f03b57c6f5070dd2da27a8defe7ef7b | |
parent | da6b86f4f031b189768dc474721145a1b99f71ea (diff) | |
download | CMake-38afc82e764ed9071748df9f5386c53f26657fe5.zip CMake-38afc82e764ed9071748df9f5386c53f26657fe5.tar.gz CMake-38afc82e764ed9071748df9f5386c53f26657fe5.tar.bz2 |
target_include_directories: Allow relative path with genex
Treat paths which are relative and which contain a generator
expression which is not at the beginning as relative to the
source directory.
This matches the behavior of paths which are relative but contain
no generator expression at all.
Previously this would generate a relative path with the IMPORTED
target on export(), which would be a reported as a non-existent
path on import. If used directly in the buildsystem, it would be
reported as a relative path, which is also an error. There is no
need for a policy in this case.
4 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index e7b906c..913bdab 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -50,7 +50,7 @@ std::string cmTargetIncludeDirectoriesCommand it != content.end(); ++it) { if (cmSystemTools::FileIsFullPath(it->c_str()) - || cmGeneratorExpression::Find(*it) != std::string::npos) + || cmGeneratorExpression::Find(*it) == 0) { dirs += sep + *it; } diff --git a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt index 21b8e15..8a564c7 100644 --- a/Tests/CMakeCommands/target_include_directories/CMakeLists.txt +++ b/Tests/CMakeCommands/target_include_directories/CMakeLists.txt @@ -45,7 +45,8 @@ add_executable(consumer target_include_directories(consumer PRIVATE $<TARGET_PROPERTY:target_include_directories,INTERFACE_INCLUDE_DIRECTORIES> - relative_dir + relative_dir + relative_dir/$<TARGET_PROPERTY:NAME> ) # Test no items diff --git a/Tests/CMakeCommands/target_include_directories/consumer.cpp b/Tests/CMakeCommands/target_include_directories/consumer.cpp index 82b800a..7e3443e 100644 --- a/Tests/CMakeCommands/target_include_directories/consumer.cpp +++ b/Tests/CMakeCommands/target_include_directories/consumer.cpp @@ -3,6 +3,7 @@ #include "publicinclude.h" #include "interfaceinclude.h" #include "relative_dir.h" +#include "consumer.h" #ifdef PRIVATEINCLUDE_DEFINE #error Unexpected PRIVATEINCLUDE_DEFINE @@ -24,4 +25,8 @@ #error Expected RELATIVE_DIR_DEFINE #endif +#ifndef CONSUMER_DEFINE +#error Expected CONSUMER_DEFINE +#endif + int main() { return 0; } diff --git a/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h b/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h new file mode 100644 index 0000000..b915373 --- /dev/null +++ b/Tests/CMakeCommands/target_include_directories/relative_dir/consumer/consumer.h @@ -0,0 +1,2 @@ + +#define CONSUMER_DEFINE |