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 a56d580574e11b13a9adb8de0632c6c0b4a8a4da (commit) via 4ac168031fc4819d41851a9fee7e61881a37de27 (commit) via 0e4c8bebeec03167707571e1f3c6c0ee156c5a3b (commit) via b58c846b24475aa2f7fdb57139d04717d6d3007e (commit) via 93bd212735198d7420de6613bc5557ff0acc2d5a (commit) from 3aea9271e7d727191e862f67cb29341334a73b4b (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=a56d580574e11b13a9adb8de0632c6c0b4a8a4da commit a56d580574e11b13a9adb8de0632c6c0b4a8a4da Merge: 3aea927 4ac1680 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Fri Feb 6 13:14:05 2015 -0500 Commit: CMake Topic Stage <kwro...@kitware.com> CommitDate: Fri Feb 6 13:14:05 2015 -0500 Merge topic 'export-interface-source-files' into next 4ac16803 Add release notes for export-interface-source-files. 0e4c8beb Allow export of targets with INTERFACE_SOURCES. b58c846b Tests: Move build-property-paths test stderr files. 93bd2127 Tests: Run build-property-paths tests with a parameter. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ac168031fc4819d41851a9fee7e61881a37de27 commit 4ac168031fc4819d41851a9fee7e61881a37de27 Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Thu Feb 5 20:40:51 2015 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Fri Feb 6 19:12:41 2015 +0100 Add release notes for export-interface-source-files. diff --git a/Help/release/dev/export-interface-source-files.rst b/Help/release/dev/export-interface-source-files.rst new file mode 100644 index 0000000..00dcd25 --- /dev/null +++ b/Help/release/dev/export-interface-source-files.rst @@ -0,0 +1,6 @@ +export-interface-source-files +----------------------------- + +* It is now possible to export targets which populate the + :prop_tgt:`INTERFACE_SOURCES` target property using the + :command:`install(EXPORT)` and :command:`export()` commands. http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e4c8bebeec03167707571e1f3c6c0ee156c5a3b commit 0e4c8bebeec03167707571e1f3c6c0ee156c5a3b Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Fri Nov 28 18:58:38 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Fri Feb 6 19:12:41 2015 +0100 Allow export of targets with INTERFACE_SOURCES. Use the same rules for paths in source and binary dirs in installed INTERFACE_SOURCES as are used for INTERFACE_INCLUDE_DIRECTORIES. diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 832240a..d6f148d 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -22,10 +22,6 @@ items will populate the :prop_tgt:`SOURCES` property of following arguments specify sources. Repeated calls for the same ``<target>`` append items in the order called. -Targets with :prop_tgt:`INTERFACE_SOURCES` may not be exported with the -:command:`export` or :command:`install(EXPORT)` commands. This limitation may be -lifted in a future version of CMake. - Arguments to ``target_sources`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Help/prop_tgt/INTERFACE_SOURCES.rst b/Help/prop_tgt/INTERFACE_SOURCES.rst index 696ee95..a224b68 100644 --- a/Help/prop_tgt/INTERFACE_SOURCES.rst +++ b/Help/prop_tgt/INTERFACE_SOURCES.rst @@ -12,10 +12,6 @@ When target dependencies are specified using :command:`target_link_libraries`, CMake will read this property from all target dependencies to determine the sources of the consumer. -Targets with ``INTERFACE_SOURCES`` may not be exported with the -:command:`export` or :command:`install(EXPORT)` commands. This limitation may be -lifted in a future version of CMake. - Contents of ``INTERFACE_SOURCES`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index a28ec48..b1203dd 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -68,16 +68,6 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) tei != this->Exports.end(); ++tei) { cmTarget* te = *tei; - if (te->GetProperty("INTERFACE_SOURCES")) - { - std::ostringstream e; - e << "Target \"" - << te->GetName() - << "\" has a populated INTERFACE_SOURCES property. This is not " - "currently supported."; - cmSystemTools::Error(e.str().c_str()); - return false; - } this->GenerateImportTargetCode(os, te); te->AppendBuildInterfaceIncludes(); @@ -87,6 +77,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te, cmGeneratorExpression::BuildInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_SOURCES", te, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te, cmGeneratorExpression::BuildInterface, properties, missingTargets); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index af4ce8b..71728be 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -224,7 +224,7 @@ static bool isSubDirectory(const char* a, const char* b) //---------------------------------------------------------------------------- static bool checkInterfaceDirs(const std::string &prepro, - cmTarget *target) + cmTarget *target, const std::string& prop) { const char* installDir = target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); @@ -250,20 +250,27 @@ static bool checkInterfaceDirs(const std::string &prepro, std::ostringstream e; if (genexPos != std::string::npos) { - switch (target->GetPolicyStatusCMP0041()) + if (prop == "INTERFACE_INCLUDE_DIRECTORIES") { - case cmPolicies::WARN: - messageType = cmake::WARNING; - e << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; - break; - case cmPolicies::OLD: - continue; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - hadFatalError = true; - break; // Issue fatal message. + switch (target->GetPolicyStatusCMP0041()) + { + case cmPolicies::WARN: + messageType = cmake::WARNING; + e << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0041) << "\n"; + break; + case cmPolicies::OLD: + continue; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + hadFatalError = true; + break; // Issue fatal message. + } + } + else + { + hadFatalError = true; } } if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}")) @@ -272,8 +279,8 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (!cmSystemTools::FileIsFullPath(li->c_str())) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains relative path:\n" " \"" << *li << "\""; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -289,32 +296,35 @@ static bool checkInterfaceDirs(const std::string &prepro, (!inBinary || isSubDirectory(installDir, topBinaryDir)) && (!inSource || isSubDirectory(installDir, topSourceDir)); - if (!shouldContinue) + if (prop == "INTERFACE_INCLUDE_DIRECTORIES") { - switch(target->GetPolicyStatusCMP0052()) + if (!shouldContinue) { - case cmPolicies::WARN: + switch(target->GetPolicyStatusCMP0052()) { - std::ostringstream s; - s << target->GetMakefile()->GetPolicies() - ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; - s << "Directory:\n \"" << *li << "\"\nin " - "INTERFACE_INCLUDE_DIRECTORIES of target \"" - << target->GetName() << "\" is a subdirectory of the install " - "directory:\n \"" << installDir << "\"\nhowever it is also " - "a subdirectory of the " << (inBinary ? "build" : "source") - << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) - << "\"" << std::endl; - target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, - s.str()); + case cmPolicies::WARN: + { + std::ostringstream s; + s << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << "Directory:\n \"" << *li << "\"\nin " + "INTERFACE_INCLUDE_DIRECTORIES of target \"" + << target->GetName() << "\" is a subdirectory of the install " + "directory:\n \"" << installDir << "\"\nhowever it is also " + "a subdirectory of the " << (inBinary ? "build" : "source") + << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) + << "\"" << std::endl; + target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, + s.str()); + } + case cmPolicies::OLD: + shouldContinue = true; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; } - case cmPolicies::OLD: - shouldContinue = true; - break; - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::NEW: - break; } } if (shouldContinue) @@ -324,8 +334,8 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (inBinary) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -333,8 +343,8 @@ static bool checkInterfaceDirs(const std::string &prepro, { if (inSource) { - e << "Target \"" << target->GetName() << "\" " - "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" + e << "Target \"" << target->GetName() << "\" " << prop << + " property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; target->GetMakefile()->IssueMessage(messageType, e.str()); } @@ -365,6 +375,46 @@ static void prefixItems(std::string &exportDirs) } //---------------------------------------------------------------------------- +void cmExportFileGenerator::PopulateSourcesInterface( + cmTargetExport *tei, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector<std::string> &missingTargets) +{ + cmTarget *target = tei->Target; + assert(preprocessRule == cmGeneratorExpression::InstallInterface); + + const char *propName = "INTERFACE_SOURCES"; + const char *input = target->GetProperty(propName); + + if (!input) + { + return; + } + + if (!*input) + { + properties[propName] = ""; + return; + } + + std::string prepro = cmGeneratorExpression::Preprocess(input, + preprocessRule, + true); + if (!prepro.empty()) + { + this->ResolveTargetsInGeneratorExpressions(prepro, target, + missingTargets); + + if (!checkInterfaceDirs(prepro, target, propName)) + { + return; + } + properties[propName] = prepro; + } +} + +//---------------------------------------------------------------------------- void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( cmTargetExport *tei, cmGeneratorExpression::PreprocessContext preprocessRule, @@ -424,7 +474,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( this->ResolveTargetsInGeneratorExpressions(prepro, target, missingTargets); - if (!checkInterfaceDirs(prepro, target)) + if (!checkInterfaceDirs(prepro, target, propName)) { return; } diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 919924e..b6f4166 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -139,6 +139,11 @@ protected: cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap &properties, std::vector<std::string> &missingTargets); + void PopulateSourcesInterface( + cmTargetExport *target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap &properties, + std::vector<std::string> &missingTargets); void SetImportLinkInterface(const std::string& config, std::string const& suffix, diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 98ed818..a0d9013 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -123,6 +123,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) bool require2_8_12 = false; bool require3_0_0 = false; + bool require3_1_0 = false; bool requiresConfigFiles = false; // Create all the imported targets. for(std::vector<cmTargetExport*>::const_iterator @@ -131,17 +132,6 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { cmTarget* te = (*tei)->Target; - if (te->GetProperty("INTERFACE_SOURCES")) - { - std::ostringstream e; - e << "Target \"" - << te->GetName() - << "\" has a populated INTERFACE_SOURCES property. This is not " - "currently supported."; - cmSystemTools::Error(e.str().c_str()); - return false; - } - requiresConfigFiles = requiresConfigFiles || te->GetType() != cmTarget::INTERFACE_LIBRARY; @@ -152,6 +142,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateIncludeDirectoriesInterface(*tei, cmGeneratorExpression::InstallInterface, properties, missingTargets); + this->PopulateSourcesInterface(*tei, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", te, cmGeneratorExpression::InstallInterface, @@ -190,6 +183,13 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) { require3_0_0 = true; } + if(te->GetProperty("INTERFACE_SOURCES")) + { + // We can only generate INTERFACE_SOURCES in CMake 3.3, but CMake 3.1 + // can consume them. + require3_1_0 = true; + } + this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", te, properties); this->PopulateCompatibleInterfaceProperties(te, properties); @@ -197,7 +197,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateInterfaceProperties(te, os, properties); } - if (require3_0_0) + if (require3_1_0) + { + this->GenerateRequiredCMakeVersion(os, "3.1.0"); + } + else if (require3_0_0) { this->GenerateRequiredCMakeVersion(os, "3.0.0"); } diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt index 523fc29..00a5375 100644 --- a/Tests/ExportImport/Export/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt @@ -29,7 +29,17 @@ target_compile_features(use_auto_type INTERFACE cxx_auto_type) add_library(use_c_restrict INTERFACE) target_compile_features(use_c_restrict INTERFACE c_restrict) -install(TARGETS headeronly sharediface use_auto_type use_c_restrict +add_library(source_target INTERFACE) +target_sources(source_target INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/source_target.cpp> + $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/src/source_target_for_install.cpp> +) +install(FILES + source_target_for_install.cpp + DESTINATION src +) + +install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target EXPORT expInterface ) install(TARGETS sharedlib diff --git a/Tests/ExportImport/Export/Interface/source_target.cpp b/Tests/ExportImport/Export/Interface/source_target.cpp new file mode 100644 index 0000000..037191c --- /dev/null +++ b/Tests/ExportImport/Export/Interface/source_target.cpp @@ -0,0 +1,13 @@ + +#ifndef USE_FROM_BUILD_DIR +#error Expected define USE_FROM_BUILD_DIR +#endif + +#ifdef USE_FROM_INSTALL_DIR +#error Unexpected define USE_FROM_INSTALL_DIR +#endif + +int source_symbol() +{ + return 42; +} diff --git a/Tests/ExportImport/Export/Interface/source_target_for_install.cpp b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp new file mode 100644 index 0000000..64514ed --- /dev/null +++ b/Tests/ExportImport/Export/Interface/source_target_for_install.cpp @@ -0,0 +1,13 @@ + +#ifdef USE_FROM_BUILD_DIR +#error Unexpected define USE_FROM_BUILD_DIR +#endif + +#ifndef USE_FROM_INSTALL_DIR +#error Expected define USE_FROM_INSTALL_DIR +#endif + +int source_symbol() +{ + return 42; +} diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt index 4028405..51d518e 100644 --- a/Tests/ExportImport/Import/Interface/CMakeLists.txt +++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt @@ -82,6 +82,14 @@ endmacro() do_try_compile(bld) +add_executable(source_target_test_bld source_target_test.cpp) +target_link_libraries(source_target_test_bld bld::source_target) +target_compile_definitions(source_target_test_bld PRIVATE USE_FROM_BUILD_DIR) + +add_executable(source_target_test_exp source_target_test.cpp) +target_link_libraries(source_target_test_exp exp::source_target) +target_compile_definitions(source_target_test_exp PRIVATE USE_FROM_INSTALL_DIR) + add_executable(headeronlytest_exp headeronlytest.cpp) target_link_libraries(headeronlytest_exp exp::headeronly) diff --git a/Tests/ExportImport/Import/Interface/source_target_test.cpp b/Tests/ExportImport/Import/Interface/source_target_test.cpp new file mode 100644 index 0000000..0e8ec5f --- /dev/null +++ b/Tests/ExportImport/Import/Interface/source_target_test.cpp @@ -0,0 +1,7 @@ + +extern int source_symbol(); + +int main() +{ + return source_symbol() - 42; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index a6a4100..6519682 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -192,6 +192,9 @@ add_RunCMake_test(ExternalProject) set(build-property-paths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) add_RunCMake_test(build-property-paths_INCLUDE_DIRECTORIES TEST_DIR build-property-paths) +set(build-property-paths_SOURCES_ARGS -DTEST_PROP=SOURCES) +add_RunCMake_test(build-property-paths_SOURCES TEST_DIR build-property-paths) + if(RPMBUILD) add_RunCMake_test(CPackRPM) endif() diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/TargetSources/ExportBuild-result.txt index d00491f..573541a 100644 --- a/Tests/RunCMake/TargetSources/ExportBuild-result.txt +++ b/Tests/RunCMake/TargetSources/ExportBuild-result.txt @@ -1 +1 @@ -1 +0 diff --git a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt b/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt deleted file mode 100644 index 0d65a55..0000000 --- a/Tests/RunCMake/TargetSources/ExportBuild-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt b/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt deleted file mode 100644 index 0d65a55..0000000 --- a/Tests/RunCMake/TargetSources/ExportInstall-stderr.txt +++ /dev/null @@ -1 +0,0 @@ -CMake Error: Target "iface" has a populated INTERFACE_SOURCES property. This is not currently supported. diff --git a/Tests/RunCMake/TargetSources/ExportInstall.cmake b/Tests/RunCMake/TargetSources/ExportInstall.cmake deleted file mode 100644 index 8e7c9f9..0000000 --- a/Tests/RunCMake/TargetSources/ExportInstall.cmake +++ /dev/null @@ -1,6 +0,0 @@ - -add_library(iface INTERFACE) -target_sources(iface INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty_1.cpp") - -install(TARGETS iface EXPORT exp) -install(EXPORT exp DESTINATION cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index 1b4ef0b..4416ef9 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -10,4 +10,3 @@ endif() run_cmake(CMP0026-LOCATION) run_cmake(RelativePathInInterface) run_cmake(ExportBuild) -run_cmake(ExportInstall) diff --git a/Tests/RunCMake/TargetSources/ExportInstall-result.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-result.txt similarity index 100% rename from Tests/RunCMake/TargetSources/ExportInstall-result.txt rename to Tests/RunCMake/build-property-paths/BinInInstallPrefix-result.txt diff --git a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 0000000..fa39ff8 --- /dev/null +++ b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths_SOURCES/prefix/BinInInstallPrefix-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..bed2424 --- /dev/null +++ b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths_SOURCES/BinaryDirectoryInInterface-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface.cmake b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface.cmake index 67ee7de..7001f3f 100644 --- a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface.cmake +++ b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/build-property-paths/DirInInstallPrefix.cmake b/Tests/RunCMake/build-property-paths/DirInInstallPrefix.cmake index fab7717..f5f3005 100644 --- a/Tests/RunCMake/build-property-paths/DirInInstallPrefix.cmake +++ b/Tests/RunCMake/build-property-paths/DirInInstallPrefix.cmake @@ -1,6 +1,11 @@ enable_language(CXX) add_library(testTarget empty.cpp) -target_include_directories(testTarget INTERFACE "${CMAKE_INSTALL_PREFIX}/dir") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/dir") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_INSTALL_PREFIX}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr_SOURCES.txt new file mode 100644 index 0000000..02a8198 --- /dev/null +++ b/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths_SOURCES/InstallInBinDir-build/empty.cpp" + + which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr_SOURCES.txt new file mode 100644 index 0000000..aece1ab --- /dev/null +++ b/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths_SOURCES/copy/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr_SOURCES.txt new file mode 100644 index 0000000..2311af9 --- /dev/null +++ b/Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" contains relative path in its INTERFACE_SOURCES: + + "empty.cpp" diff --git a/Tests/RunCMake/build-property-paths/RelativePathInGenex.cmake b/Tests/RunCMake/build-property-paths/RelativePathInGenex.cmake index 070a381..489c3a1 100644 --- a/Tests/RunCMake/build-property-paths/RelativePathInGenex.cmake +++ b/Tests/RunCMake/build-property-paths/RelativePathInGenex.cmake @@ -2,7 +2,12 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") + +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<1:foo>") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "$<1:empty.cpp>") +endif() add_library(userTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") target_link_libraries(userTarget testTarget) diff --git a/Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..f0f002c --- /dev/null +++ b/Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr_SOURCES.txt @@ -0,0 +1,4 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains relative path: + + "empty.cpp" diff --git a/Tests/RunCMake/build-property-paths/RelativePathInInterface.cmake b/Tests/RunCMake/build-property-paths/RelativePathInInterface.cmake index 4c4727d..e974aac 100644 --- a/Tests/RunCMake/build-property-paths/RelativePathInInterface.cmake +++ b/Tests/RunCMake/build-property-paths/RelativePathInInterface.cmake @@ -2,8 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") - +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib ) diff --git a/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr_SOURCES.txt new file mode 100644 index 0000000..187ccdf --- /dev/null +++ b/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface.cmake b/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface.cmake index f814a3c..d80cbec 100644 --- a/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface.cmake +++ b/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface.cmake @@ -2,7 +2,11 @@ enable_language(CXX) add_library(testTarget "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") -target_include_directories(testTarget INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/foo") +if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + set_property(TARGET testTarget PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/foo") +else() + set_property(TARGET testTarget PROPERTY INTERFACE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/empty.cpp") +endif() install(TARGETS testTarget EXPORT testTargets DESTINATION lib diff --git a/Tests/RunCMake/TargetSources/ExportBuild-result.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-result.txt similarity index 100% copy from Tests/RunCMake/TargetSources/ExportBuild-result.txt copy to Tests/RunCMake/build-property-paths/SrcInInstallPrefix-result.txt diff --git a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-stderr_SOURCES.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-stderr_SOURCES.txt new file mode 100644 index 0000000..6a123f7 --- /dev/null +++ b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-stderr_SOURCES.txt @@ -0,0 +1,6 @@ +CMake Error in CMakeLists.txt: + Target "testTarget" INTERFACE_SOURCES property contains path: + + ".*Tests/RunCMake/build-property-paths_SOURCES/prefix/src/empty.cpp" + + which is prefixed in the source directory. diff --git a/Tests/RunCMake/build-property-paths/export-NOWARN.cmake b/Tests/RunCMake/build-property-paths/export-NOWARN.cmake index 50720a0..592572c 100644 --- a/Tests/RunCMake/build-property-paths/export-NOWARN.cmake +++ b/Tests/RunCMake/build-property-paths/export-NOWARN.cmake @@ -1,19 +1,34 @@ enable_language(CXX) add_library(foo empty.cpp) + set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<0:>/include/subdir) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_PREFIX>/include/subdir) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<0:>/include/subdir/empty.cpp) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_PREFIX>/include/subdir/empty.cpp) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/subdir>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/subdir>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include/$<0:>>) set_property(TARGET foo APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<0:>/include>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/subdir/empty.cpp>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:include/subdir/empty.cpp>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:include/subdir/empty.cpp$<0:>>) +set_property(TARGET foo APPEND PROPERTY INTERFACE_SOURCES $<INSTALL_INTERFACE:$<0:>/include/subdir/empty.cpp>) # target_include_directories(foo INTERFACE include/subdir) # Does and should warn. INSTALL_INTERFACE must not list src dir paths. target_include_directories(foo INTERFACE $<0:>/include/subdir) # Does not and should not should warn, because it starts with a genex. target_include_directories(foo INTERFACE $<INSTALL_PREFIX>/include/subdir) +target_sources(foo INTERFACE $<0:>/include/subdir/empty.cpp) +target_sources(foo INTERFACE $<INSTALL_PREFIX>/include/subdir/empty.cpp) target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/subdir>) target_include_directories(foo INTERFACE $<INSTALL_INTERFACE:include/$<0:>>) +target_sources(foo INTERFACE $<INSTALL_INTERFACE:include/subdir/empty.cpp>) +target_sources(foo INTERFACE $<INSTALL_INTERFACE:include/subdir/empty.cpp$<0:>>) + +install(FILES include/subdir/empty.cpp + DESTINATION include/subdir +) install(TARGETS foo EXPORT FooTargets DESTINATION lib) install(EXPORT FooTargets DESTINATION lib/cmake) http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b58c846b24475aa2f7fdb57139d04717d6d3007e commit b58c846b24475aa2f7fdb57139d04717d6d3007e Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sun Nov 30 13:54:18 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Fri Feb 6 19:12:31 2015 +0100 Tests: Move build-property-paths test stderr files. Rename the files with a property-specific name, so that additional properties can be easily tested. Extend the RunCMake infrastructure to allow specifying a non-uniform stderr file location. diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 33b745d..6389ef4 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -18,7 +18,10 @@ function(run_cmake test) set(expect_result 0) endif() foreach(o out err) - if(EXISTS ${top_src}/${test}-std${o}.txt) + if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) + file(READ ${top_src}/${RunCMake-std${o}-file} expect_std${o}) + string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") + elseif(EXISTS ${top_src}/${test}-std${o}.txt) file(READ ${top_src}/${test}-std${o}.txt expect_std${o}) string(REGEX REPLACE "\n+$" "" expect_std${o} "${expect_std${o}}") else() diff --git a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt rename to Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt b/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt rename to Tests/RunCMake/build-property-paths/InstallInBinDir-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt b/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt rename to Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr.txt b/Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr.txt rename to Tests/RunCMake/build-property-paths/RelativePathInGenex-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr.txt b/Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr.txt rename to Tests/RunCMake/build-property-paths/RelativePathInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake b/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake index eefdbf7..54d0cd8 100644 --- a/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake +++ b/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake @@ -2,6 +2,7 @@ include(RunCMake) macro(run_cmake test) list(APPEND RunCMake_TEST_OPTIONS -DTEST_PROP=${TEST_PROP}) + set(RunCMake-stderr-file ${test}-stderr_${TEST_PROP}.txt) _run_cmake(${test}) endmacro() diff --git a/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr.txt b/Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr.txt rename to Tests/RunCMake/build-property-paths/SourceDirectoryInInterface-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt rename to Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr_INCLUDE_DIRECTORIES.txt diff --git a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt similarity index 100% rename from Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt rename to Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr_INCLUDE_DIRECTORIES.txt http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=93bd212735198d7420de6613bc5557ff0acc2d5a commit 93bd212735198d7420de6613bc5557ff0acc2d5a Author: Stephen Kelly <steve...@gmail.com> AuthorDate: Sun Nov 30 13:42:00 2014 +0100 Commit: Stephen Kelly <steve...@gmail.com> CommitDate: Fri Feb 6 19:12:31 2015 +0100 Tests: Run build-property-paths tests with a parameter. Run the tests for the INCLUDE_DIRECTORIES INTERFACE property in a specific build location, and update the stderr expectation to match the new output. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 88f4ab2..a6a4100 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1,17 +1,28 @@ # See adjacent README.rst for documentation of this test infrastructure. macro(add_RunCMake_test test) + set(TEST_ARGS ${ARGN}) + if ("${ARGV1}" STREQUAL "TEST_DIR") + if ("${ARGV2}" STREQUAL "") + message(FATAL_ERROR "Invalid args") + endif() + set(Test_Dir ${ARGV2}) + list(REMOVE_AT TEST_ARGS 0) + list(REMOVE_AT TEST_ARGS 0) + else() + set(Test_Dir ${test}) + endif() add_test(NAME RunCMake.${test} COMMAND ${CMAKE_CMAKE_COMMAND} -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} -DRunCMake_GENERATOR=${CMAKE_GENERATOR} -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} - -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir} -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${test} ${${test}_ARGS} - ${ARGN} - -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ${TEST_ARGS} + -P "${CMAKE_CURRENT_SOURCE_DIR}/${Test_Dir}/RunCMakeTest.cmake" ) endmacro() @@ -177,7 +188,9 @@ add_RunCMake_test(CommandLine) add_RunCMake_test(install) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) -add_RunCMake_test(build-property-paths) + +set(build-property-paths_INCLUDE_DIRECTORIES_ARGS -DTEST_PROP=INCLUDE_DIRECTORIES) +add_RunCMake_test(build-property-paths_INCLUDE_DIRECTORIES TEST_DIR build-property-paths) if(RPMBUILD) add_RunCMake_test(CPackRPM) diff --git a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt index e8c47b1..8db7283 100644 --- a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/build-property-paths/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-NEW-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt index c0c4806..6473efe 100644 --- a/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/build-property-paths/BinInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/build-property-paths/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/build-property-paths/prefix" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix" however it is also a subdirectory of the build tree: - ".*Tests/RunCMake/build-property-paths/prefix/BinInInstallPrefix-CMP0052-WARN-build" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/BinInInstallPrefix-CMP0052-WARN-build" This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt index 332c237..94c46ab 100644 --- a/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt +++ b/Tests/RunCMake/build-property-paths/BinaryDirectoryInInterface-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*RunCMake/build-property-paths/BinaryDirectoryInInterface-build/foo" + ".*RunCMake/build-property-paths_INCLUDE_DIRECTORIES/BinaryDirectoryInInterface-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt b/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt index 504e332..83ae34c 100644 --- a/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt +++ b/Tests/RunCMake/build-property-paths/InstallInBinDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/build-property-paths/InstallInBinDir-build/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/InstallInBinDir-build/foo" which is prefixed in the build directory. diff --git a/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt b/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt index 5f0a3ea..a7a5af4 100644 --- a/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt +++ b/Tests/RunCMake/build-property-paths/InstallInSrcDir-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/build-property-paths/copy/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/copy/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake b/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake index 2add175..eefdbf7 100644 --- a/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake +++ b/Tests/RunCMake/build-property-paths/RunCMakeTest.cmake @@ -1,5 +1,10 @@ include(RunCMake) +macro(run_cmake test) + list(APPEND RunCMake_TEST_OPTIONS -DTEST_PROP=${TEST_PROP}) + _run_cmake(${test}) +endmacro() + run_cmake(RelativePathInInterface) run_cmake(RelativePathInGenex) run_cmake(export-NOWARN) @@ -57,12 +62,15 @@ configure_file( COPYONLY ) -foreach(policyStatus "" NEW OLD) - if (NOT "${policyStatus}" STREQUAL "") - set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) - else() - unset(policyOption) - set(policyStatus WARN) +foreach(policyStatus NEW OLD "") + if (TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + if (NOT "${policyStatus}" STREQUAL "") + set(policyOption -DCMAKE_POLICY_DEFAULT_CMP0052=${policyStatus}) + else() + unset(policyOption) + set(policyStatus WARN) + endif() + set(policySuffix -CMP0052-${policyStatus}) endif() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} @@ -73,16 +81,20 @@ foreach(policyStatus "" NEW OLD) # a subdirectory or the source directory, which is allowed and tested separately # below. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/prefix/src") - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix-CMP0052-${policyStatus}-build") - run_cmake(BinInInstallPrefix-CMP0052-${policyStatus}) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/prefix/BinInInstallPrefix${policySuffix}-build") + run_cmake(BinInInstallPrefix${policySuffix}) unset(RunCMake_TEST_BINARY_DIR) set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/prefix" ${policyOption} "-DTEST_FILE=${RunCMake_BINARY_DIR}/prefix/src/SourceDirectoryInInterface.cmake" ) - run_cmake(SrcInInstallPrefix-CMP0052-${policyStatus}) + run_cmake(SrcInInstallPrefix${policySuffix}) unset(RunCMake_TEST_SOURCE_DIR) + + if (NOT TEST_PROP STREQUAL INCLUDE_DIRECTORIES) + break() + endif() endforeach() set(RunCMake_TEST_OPTIONS "-DCMAKE_INSTALL_PREFIX=${RunCMake_BINARY_DIR}/InstallPrefixInInterface-build/prefix") diff --git a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt index 4838a53..2af50d5 100644 --- a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt +++ b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-NEW-stderr.txt @@ -1,6 +1,6 @@ CMake Error in CMakeLists.txt: Target "testTarget" INTERFACE_INCLUDE_DIRECTORIES property contains path: - ".*Tests/RunCMake/build-property-paths/prefix/src/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/src/foo" which is prefixed in the source directory. diff --git a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt index 8b2d69d..56aaa2c 100644 --- a/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt +++ b/Tests/RunCMake/build-property-paths/SrcInInstallPrefix-CMP0052-WARN-stderr.txt @@ -6,15 +6,15 @@ CMake Warning \(dev\) in CMakeLists.txt: Directory: - ".*Tests/RunCMake/build-property-paths/prefix/src/foo" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/src/foo" in INTERFACE_INCLUDE_DIRECTORIES of target "testTarget" is a subdirectory of the install directory: - ".*Tests/RunCMake/build-property-paths/prefix" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix" however it is also a subdirectory of the source tree: - ".*Tests/RunCMake/build-property-paths/prefix/src" + ".*Tests/RunCMake/build-property-paths_INCLUDE_DIRECTORIES/prefix/src" This warning is for project developers. Use -Wno-dev to suppress it. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org http://public.kitware.com/mailman/listinfo/cmake-commits