From kwrobot at kitware.com Thu Mar 1 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 1 Mar 2018 00:05:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-114-ge02f4f0 Message-ID: <20180301050505.C0F3A10A7F9@public.kitware.com> 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, master has been updated via e02f4f066011d5b5c493e99f5e21ea0d64cf9aa2 (commit) from 730eeceb75bf9c9074f5abb8bcf6f3ed41115d2b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e02f4f066011d5b5c493e99f5e21ea0d64cf9aa2 commit e02f4f066011d5b5c493e99f5e21ea0d64cf9aa2 Author: Kitware Robot AuthorDate: Thu Mar 1 00:01:06 2018 -0500 Commit: Kitware Robot CommitDate: Thu Mar 1 00:01:06 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 307b65d..879f23f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180228) +set(CMake_VERSION_PATCH 20180301) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 1 07:55:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 1 Mar 2018 07:55:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-116-g61f92e6 Message-ID: <20180301125507.43E7310A83A@public.kitware.com> 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, master has been updated via 61f92e69c013e55fcf031eab26f930341c41d97f (commit) via ea0ce73a195e1cc0f672f1e7519c42a240592f15 (commit) from e02f4f066011d5b5c493e99f5e21ea0d64cf9aa2 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61f92e69c013e55fcf031eab26f930341c41d97f commit 61f92e69c013e55fcf031eab26f930341c41d97f Merge: e02f4f0 ea0ce73 Author: Brad King AuthorDate: Thu Mar 1 12:54:09 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 1 07:54:20 2018 -0500 Merge topic 'object-library-export-as-interface' ea0ce73a19 install,export: Maybe transform OBJECT libraries to INTERFACE libraries Acked-by: Kitware Robot Merge-request: !1811 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea0ce73a195e1cc0f672f1e7519c42a240592f15 commit ea0ce73a195e1cc0f672f1e7519c42a240592f15 Author: Brad King AuthorDate: Wed Feb 28 10:58:07 2018 -0500 Commit: Brad King CommitDate: Wed Feb 28 10:58:10 2018 -0500 install,export: Maybe transform OBJECT libraries to INTERFACE libraries Teach the `install` and `export` commands to support installing and exporting `OBJECT` libraries without their object files. Transform them to `INTERFACE` libraries in such cases. For `install(TARGETS)`, activate this when no destination for the object files is specified. For `export`, activate this only under Xcode with multiple architectures when we have no well-defined object file locations to give to clients. diff --git a/Help/command/export.rst b/Help/command/export.rst index 53675a7..17fcecb 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -40,6 +40,13 @@ policy CMP0022 is NEW. If a library target is included in the export but a target to which it links is not included the behavior is unspecified. +.. note:: + + :ref:`Object Libraries` under :generator:`Xcode` have special handling if + multiple architectures are listed in :variable:`CMAKE_OSX_ARCHITECTURES`. + In this case they will be exported as :ref:`Interface Libraries` with + no object files available to clients. + :: export(PACKAGE ) diff --git a/Help/command/install.rst b/Help/command/install.rst index 2506f98..1cedc35 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -183,6 +183,11 @@ export called ````. It must appear before any ``RUNTIME``, ``LIBRARY``, ``ARCHIVE``, or ``OBJECTS`` options. To actually install the export file itself, call ``install(EXPORT)``, documented below. +:ref:`Interface Libraries` may be listed among the targets to install. +They install no artifacts but will be included in an associated ``EXPORT``. +If :ref:`Object Libraries` are listed but given no destination for their +object files, they will be exported as :ref:`Interface Libraries`. + Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 6f31a2d..61eea88 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -40,7 +40,8 @@ void cmExportBuildAndroidMKGenerator::GenerateExpectedTargetsCode( } void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( - std::ostream& os, const cmGeneratorTarget* target) + std::ostream& os, cmGeneratorTarget const* target, + cmStateEnums::TargetType /*targetType*/) { std::string targetName = this->Namespace; targetName += target->GetExportName(); diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h index c80839b..a9b6107 100644 --- a/Source/cmExportBuildAndroidMKGenerator.h +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -11,6 +11,7 @@ #include "cmExportBuildFileGenerator.h" #include "cmExportFileGenerator.h" +#include "cmStateTypes.h" class cmGeneratorTarget; @@ -47,8 +48,9 @@ protected: void GenerateImportHeaderCode(std::ostream& os, const std::string& config = "") override; void GenerateImportFooterCode(std::ostream& os) override; - void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target) override; + void GenerateImportTargetCode( + std::ostream& os, cmGeneratorTarget const* target, + cmStateEnums::TargetType /*targetType*/) override; void GenerateExpectedTargetsCode( std::ostream& os, const std::string& expectedTargets) override; void GenerateImportPropertyCode( diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index f7aa6e8..a276d01 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -59,7 +59,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->LG->GetMakefile()->GetBacktrace()); return false; } - if (te->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + if (this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY) { this->GenerateRequiredCMakeVersion(os, "3.0.0"); } } @@ -71,7 +71,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) // Create all the imported targets. for (cmGeneratorTarget* gte : this->Exports) { - this->GenerateImportTargetCode(os, gte); + this->GenerateImportTargetCode(os, gte, this->GetExportTargetType(gte)); gte->Target->AppendBuildInterfaceIncludes(); @@ -128,12 +128,13 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig( // Collect import properties for this target. ImportPropertyMap properties; - if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + if (this->GetExportTargetType(target) != cmStateEnums::INTERFACE_LIBRARY) { this->SetImportLocationProperty(config, suffix, target, properties); } if (!properties.empty()) { // Get the rest of the target details. - if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + if (this->GetExportTargetType(target) != + cmStateEnums::INTERFACE_LIBRARY) { this->SetImportDetailProperties(config, suffix, target, properties, missingTargets); this->SetImportLinkInterface(config, suffix, @@ -153,6 +154,19 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig( } } +cmStateEnums::TargetType cmExportBuildFileGenerator::GetExportTargetType( + cmGeneratorTarget const* target) const +{ + cmStateEnums::TargetType targetType = target->GetType(); + // An object library exports as an interface library if we cannot + // tell clients where to find the objects. + if (targetType == cmStateEnums::OBJECT_LIBRARY && + !this->LG->GetGlobalGenerator()->HasKnownObjectFileLocation(nullptr)) { + targetType = cmStateEnums::INTERFACE_LIBRARY; + } + return targetType; +} + void cmExportBuildFileGenerator::SetExportSet(cmExportSet* exportSet) { this->ExportSet = exportSet; diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 6457a77..ada2709 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmExportFileGenerator.h" +#include "cmStateTypes.h" #include #include @@ -53,6 +54,8 @@ protected: void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, std::vector& missingTargets) override; + cmStateEnums::TargetType GetExportTargetType( + cmGeneratorTarget const* target) const; void HandleMissingTarget(std::string& link_libs, std::vector& missingTargets, cmGeneratorTarget* depender, diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index c8a727d..655ebe8 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -146,17 +146,6 @@ bool cmExportCommand::InitialPass(std::vector const& args, } if (cmTarget* target = gg->FindTarget(currentTarget)) { - if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { - std::string reason; - if (!this->Makefile->GetGlobalGenerator() - ->HasKnownObjectFileLocation(&reason)) { - std::ostringstream e; - e << "given OBJECT library \"" << currentTarget - << "\" which may not be exported" << reason << "."; - this->SetError(e.str()); - return false; - } - } if (target->GetType() == cmStateEnums::UTILITY) { this->SetError("given custom target \"" + currentTarget + "\" which may not be exported."); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 434abdc..0f1d745 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -901,8 +901,10 @@ void cmExportFileGenerator::GenerateExpectedTargetsCode( "\n\n"; /* clang-format on */ } + void cmExportFileGenerator::GenerateImportTargetCode( - std::ostream& os, const cmGeneratorTarget* target) + std::ostream& os, cmGeneratorTarget const* target, + cmStateEnums::TargetType targetType) { // Construct the imported target name. std::string targetName = this->Namespace; @@ -911,7 +913,7 @@ void cmExportFileGenerator::GenerateImportTargetCode( // Create the imported target. os << "# Create imported target " << targetName << "\n"; - switch (target->GetType()) { + switch (targetType) { case cmStateEnums::EXECUTABLE: os << "add_executable(" << targetName << " IMPORTED)\n"; break; diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 985c8f6..e541372 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmGeneratorExpression.h" +#include "cmStateTypes.h" #include "cmVersion.h" #include "cmVersionConfig.h" @@ -76,7 +77,8 @@ protected: virtual void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); virtual void GenerateImportTargetCode(std::ostream& os, - cmGeneratorTarget const* target); + cmGeneratorTarget const* target, + cmStateEnums::TargetType targetType); virtual void GenerateImportPropertyCode(std::ostream& os, const std::string& config, cmGeneratorTarget const* target, diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx index fe565e6..9bc8089 100644 --- a/Source/cmExportInstallAndroidMKGenerator.cxx +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -55,7 +55,8 @@ void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) } void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode( - std::ostream& os, const cmGeneratorTarget* target) + std::ostream& os, cmGeneratorTarget const* target, + cmStateEnums::TargetType /*targetType*/) { std::string targetName = this->Namespace; targetName += target->GetExportName(); diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h index 91554ee..8883ffa 100644 --- a/Source/cmExportInstallAndroidMKGenerator.h +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -12,6 +12,7 @@ #include "cmExportFileGenerator.h" #include "cmExportInstallFileGenerator.h" +#include "cmStateTypes.h" class cmGeneratorTarget; class cmInstallExportGenerator; @@ -41,8 +42,9 @@ protected: void GenerateImportHeaderCode(std::ostream& os, const std::string& config = "") override; void GenerateImportFooterCode(std::ostream& os) override; - void GenerateImportTargetCode(std::ostream& os, - const cmGeneratorTarget* target) override; + void GenerateImportTargetCode( + std::ostream& os, cmGeneratorTarget const* target, + cmStateEnums::TargetType /*targetType*/) override; void GenerateExpectedTargetsCode( std::ostream& os, const std::string& expectedTargets) override; void GenerateImportPropertyCode( diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 954b561..93ba2ce 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -75,11 +75,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) // Create all the imported targets. for (cmTargetExport* te : allTargets) { cmGeneratorTarget* gt = te->Target; + cmStateEnums::TargetType targetType = this->GetExportTargetType(te); requiresConfigFiles = - requiresConfigFiles || gt->GetType() != cmStateEnums::INTERFACE_LIBRARY; + requiresConfigFiles || targetType != cmStateEnums::INTERFACE_LIBRARY; - this->GenerateImportTargetCode(os, gt); + this->GenerateImportTargetCode(os, gt, targetType); ImportPropertyMap properties; @@ -114,7 +115,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) require2_8_12 = true; } } - if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + if (targetType == cmStateEnums::INTERFACE_LIBRARY) { require3_0_0 = true; } if (gt->GetProperty("INTERFACE_SOURCES")) { @@ -308,7 +309,7 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig( // Add each target in the set to the export. for (cmTargetExport* te : *this->IEGen->GetExportSet()->GetTargetExports()) { // Collect import properties for this target. - if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + if (this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -426,6 +427,19 @@ void cmExportInstallFileGenerator::SetImportLocationProperty( } } +cmStateEnums::TargetType cmExportInstallFileGenerator::GetExportTargetType( + cmTargetExport const* targetExport) const +{ + cmStateEnums::TargetType targetType = targetExport->Target->GetType(); + // An OBJECT library installed with no OBJECTS DESTINATION + // is transformed to an INTERFACE library. + if (targetType == cmStateEnums::OBJECT_LIBRARY && + targetExport->ObjectsGenerator == nullptr) { + targetType = cmStateEnums::INTERFACE_LIBRARY; + } + return targetType; +} + void cmExportInstallFileGenerator::HandleMissingTarget( std::string& link_libs, std::vector& missingTargets, cmGeneratorTarget* depender, cmGeneratorTarget* dependee) diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index cda8433..ea607fb 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -6,6 +6,7 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmExportFileGenerator.h" +#include "cmStateTypes.h" #include #include @@ -17,6 +18,7 @@ class cmGeneratorTarget; class cmGlobalGenerator; class cmInstallExportGenerator; class cmInstallTargetGenerator; +class cmTargetExport; /** \class cmExportInstallFileGenerator * \brief Generate a file exporting targets from an install tree. @@ -57,6 +59,8 @@ protected: void GenerateImportTargetsConfig( std::ostream& os, const std::string& config, std::string const& suffix, std::vector& missingTargets) override; + cmStateEnums::TargetType GetExportTargetType( + cmTargetExport const* targetExport) const; void HandleMissingTarget(std::string& link_libs, std::vector& missingTargets, cmGeneratorTarget* depender, diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 1fb9cf8..798f2e6 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -32,7 +32,7 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os) this->Exports.pop_back(); if (emitted.insert(te).second) { emittedDeps.insert(te); - this->GenerateImportTargetCode(os, te); + this->GenerateImportTargetCode(os, te, te->GetType()); ImportPropertyMap properties; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 394f976..008a5e0 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -360,17 +360,6 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) this->SetError(e.str()); return false; } - if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { - std::string reason; - if (!this->Makefile->GetGlobalGenerator()->HasKnownObjectFileLocation( - &reason)) { - std::ostringstream e; - e << "TARGETS given OBJECT library \"" << tgt - << "\" which may not be installed" << reason << "."; - this->SetError(e.str()); - return false; - } - } // Store the target in the list to be installed. targets.push_back(target); } else { @@ -534,15 +523,23 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) case cmStateEnums::OBJECT_LIBRARY: { // Objects use OBJECT properties. if (!objectArgs.GetDestination().empty()) { + // Verify that we know where the objects are to install them. + std::string reason; + if (!this->Makefile->GetGlobalGenerator() + ->HasKnownObjectFileLocation(&reason)) { + std::ostringstream e; + e << "TARGETS given OBJECT library \"" << target.GetName() + << "\" whose objects may not be installed" << reason << "."; + this->SetError(e.str()); + return false; + } + objectGenerator = CreateInstallTargetGenerator(target, objectArgs, false); } else { - std::ostringstream e; - e << "TARGETS given no OBJECTS DESTINATION for object library " - "target \"" - << target.GetName() << "\"."; - this->SetError(e.str()); - return false; + // Installing an OBJECT library without a destination transforms + // it to an INTERFACE library. It installs no files but can be + // exported. } } break; case cmStateEnums::EXECUTABLE: { diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index eeae3f0..4f663f6 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -83,11 +83,13 @@ set_property(TARGET testLib7 PROPERTY OUTPUT_NAME testLib7-$) add_library(testLib8 OBJECT testLib8A.c testLib8B.c sub/testLib8C.c) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") - set(maybe_testLib8 testLib8) + set(maybe_OBJECTS_DESTINATION OBJECTS DESTINATION $<1:lib>) else() - set(maybe_testLib8 "") + set(maybe_OBJECTS_DESTINATION "") endif() +add_library(testLib9Obj OBJECT testLib9Obj.c) + # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries # providing the same two symbols. In each library one of the symbols @@ -483,7 +485,7 @@ install( TARGETS testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4 testExe2lib testLib4lib testLib4libdbg testLib4libopt - testLib6 testLib7 ${maybe_testLib8} + testLib6 testLib7 testLib8 testLibCycleA testLibCycleB testLibNoSONAME cmp0022NEW cmp0022OLD @@ -492,10 +494,15 @@ install( RUNTIME DESTINATION $<1:bin> LIBRARY DESTINATION $<1:lib> NAMELINK_SKIP ARCHIVE DESTINATION $<1:lib> - OBJECTS DESTINATION $<1:lib> + ${maybe_OBJECTS_DESTINATION} FRAMEWORK DESTINATION Frameworks BUNDLE DESTINATION Applications ) +install( + TARGETS + testLib9Obj + EXPORT exp + ) if (APPLE) file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/testLib4.framework/Headers) file(COPY testLib4.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/testLib4.framework/Headers) @@ -545,7 +552,8 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 FILE ExportBuildTree.cmake ) export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib - ${maybe_testLib8} + testLib8 + testLib9Obj testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibNoSONAME diff --git a/Tests/ExportImport/Export/testLib9Obj.c b/Tests/ExportImport/Export/testLib9Obj.c new file mode 100644 index 0000000..6a13e48 --- /dev/null +++ b/Tests/ExportImport/Export/testLib9Obj.c @@ -0,0 +1,4 @@ +int testLib9Obj(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 01960ea..6d16cb7 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -229,6 +229,8 @@ add_library(imp_lib1b STATIC imp_lib1.c) target_link_libraries(imp_lib1b bld_testLib2) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") + set(bld_objlib_type OBJECT_LIBRARY) + # Create a executable that is using objects imported from the install tree add_executable(imp_testLib8 imp_testLib8.c $) @@ -236,6 +238,18 @@ if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES " # Create a executable that is using objects imported from the build tree add_executable(imp_testLib8b imp_testLib8.c $) endif() +else() + set(bld_objlib_type INTERFACE_LIBRARY) +endif() + +# Check that object libraries were transformed on export as expected. +get_property(type TARGET exp_testLib9Obj PROPERTY TYPE) +if(NOT type STREQUAL INTERFACE_LIBRARY) + message(FATAL_ERROR "exp_testLib9Obj type is '${type}', not 'INTERFACE_LIBRARY'") +endif() +get_property(type TARGET bld_testLib9Obj PROPERTY TYPE) +if(NOT type STREQUAL "${bld_objlib_type}") + message(FATAL_ERROR "bld_testLib9Obj type is '${type}', not '${bld_objlib_type}'") endif() #----------------------------------------------------------------------------- diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt deleted file mode 100644 index 5420159..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -CMake Error at ExportNotSupported.cmake:[0-9]+ \(export\): - export given OBJECT library "A" which may not be exported under Xcode with - multiple architectures. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake b/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake deleted file mode 100644 index a3f104e..0000000 --- a/Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(A OBJECT a.c) -export(TARGETS A FILE AExport.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt index 35a0e4f..a7004c1 100644 --- a/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/InstallNotSupported-stderr.txt @@ -1,5 +1,5 @@ CMake Error at InstallNotSupported.cmake:[0-9]+ \(install\): - install TARGETS given OBJECT library "A" which may not be installed under - Xcode with multiple architectures. + install TARGETS given OBJECT library "A" whose objects may not be installed + under Xcode with multiple architectures. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index b8eed73..5c9dd65 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -6,14 +6,13 @@ run_cmake(BadSourceExpression3) run_cmake(BadObjSource1) run_cmake(BadObjSource2) if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]") - run_cmake(ExportNotSupported) run_cmake(ImportNotSupported) run_cmake(InstallNotSupported) else() - run_cmake(Export) run_cmake(Import) run_cmake(Install) endif() +run_cmake(Export) run_cmake(LinkObjLHS) run_cmake(LinkObjRHS1) run_cmake(LinkObjRHS2) ----------------------------------------------------------------------- Summary of changes: Help/command/export.rst | 7 +++++ Help/command/install.rst | 5 ++++ Source/cmExportBuildAndroidMKGenerator.cxx | 3 +- Source/cmExportBuildAndroidMKGenerator.h | 6 ++-- Source/cmExportBuildFileGenerator.cxx | 22 +++++++++++--- Source/cmExportBuildFileGenerator.h | 3 ++ Source/cmExportCommand.cxx | 11 ------- Source/cmExportFileGenerator.cxx | 6 ++-- Source/cmExportFileGenerator.h | 4 ++- Source/cmExportInstallAndroidMKGenerator.cxx | 3 +- Source/cmExportInstallAndroidMKGenerator.h | 6 ++-- Source/cmExportInstallFileGenerator.cxx | 22 +++++++++++--- Source/cmExportInstallFileGenerator.h | 4 +++ Source/cmExportTryCompileFileGenerator.cxx | 2 +- Source/cmInstallCommand.cxx | 31 +++++++++----------- Tests/ExportImport/Export/CMakeLists.txt | 18 ++++++++---- Tests/ExportImport/Export/testLib9Obj.c | 4 +++ Tests/ExportImport/Import/A/CMakeLists.txt | 14 +++++++++ .../ObjectLibrary/ExportNotSupported-result.txt | 1 - .../ObjectLibrary/ExportNotSupported-stderr.txt | 5 ---- .../ObjectLibrary/ExportNotSupported.cmake | 2 -- .../ObjectLibrary/InstallNotSupported-stderr.txt | 4 +-- Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 3 +- 23 files changed, 123 insertions(+), 63 deletions(-) create mode 100644 Tests/ExportImport/Export/testLib9Obj.c delete mode 100644 Tests/RunCMake/ObjectLibrary/ExportNotSupported-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/ExportNotSupported-stderr.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/ExportNotSupported.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 2 00:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 2 Mar 2018 00:05:07 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-117-gdc13ed1 Message-ID: <20180302050507.4E92B10A980@public.kitware.com> 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, master has been updated via dc13ed1f84601a8d9710cc2a8c76d0331be561b8 (commit) from 61f92e69c013e55fcf031eab26f930341c41d97f (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc13ed1f84601a8d9710cc2a8c76d0331be561b8 commit dc13ed1f84601a8d9710cc2a8c76d0331be561b8 Author: Kitware Robot AuthorDate: Fri Mar 2 00:01:06 2018 -0500 Commit: Kitware Robot CommitDate: Fri Mar 2 00:01:06 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 879f23f..6fe9698 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180301) +set(CMake_VERSION_PATCH 20180302) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 3 00:05:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 3 Mar 2018 00:05:09 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-118-gdbfdb90 Message-ID: <20180303050509.BE87210AAC7@public.kitware.com> 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, master has been updated via dbfdb90430c7a55b9b6589d30df16ca2aaad52b8 (commit) from dc13ed1f84601a8d9710cc2a8c76d0331be561b8 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dbfdb90430c7a55b9b6589d30df16ca2aaad52b8 commit dbfdb90430c7a55b9b6589d30df16ca2aaad52b8 Author: Kitware Robot AuthorDate: Sat Mar 3 00:01:12 2018 -0500 Commit: Kitware Robot CommitDate: Sat Mar 3 00:01:12 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6fe9698..7e9ba0d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180302) +set(CMake_VERSION_PATCH 20180303) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 4 00:05:10 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 4 Mar 2018 00:05:10 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-119-g0e362b2 Message-ID: <20180304050510.DD3C710A7BA@public.kitware.com> 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, master has been updated via 0e362b23e10e0d2b6c3726a94f42ac603304f63a (commit) from dbfdb90430c7a55b9b6589d30df16ca2aaad52b8 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e362b23e10e0d2b6c3726a94f42ac603304f63a commit 0e362b23e10e0d2b6c3726a94f42ac603304f63a Author: Kitware Robot AuthorDate: Sun Mar 4 00:01:07 2018 -0500 Commit: Kitware Robot CommitDate: Sun Mar 4 00:01:07 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7e9ba0d..256f75c 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180303) +set(CMake_VERSION_PATCH 20180304) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 5 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 5 Mar 2018 00:05:04 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-120-g2fbd771 Message-ID: <20180305050504.BB7FA10AC72@public.kitware.com> 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, master has been updated via 2fbd77124e4990a381143f0351b1caed12db5107 (commit) from 0e362b23e10e0d2b6c3726a94f42ac603304f63a (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fbd77124e4990a381143f0351b1caed12db5107 commit 2fbd77124e4990a381143f0351b1caed12db5107 Author: Kitware Robot AuthorDate: Mon Mar 5 00:01:06 2018 -0500 Commit: Kitware Robot CommitDate: Mon Mar 5 00:01:06 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 256f75c..7ec49e8 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180304) +set(CMake_VERSION_PATCH 20180305) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 5 09:05:13 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 5 Mar 2018 09:05:13 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-136-g49e777a Message-ID: <20180305140513.B06EB10AE79@public.kitware.com> 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, master has been updated via 49e777aeb1dbb141383faf1e5cb20c7443952302 (commit) via dc38970f8388e21227c8cdc50df93431c3719030 (commit) via b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3 (commit) via 7776ce98c3fc1fc656c646ea783c23aee27261a2 (commit) via bafe655b11c876b45a5ce1fbaf4643593bdd22a3 (commit) via 57538224d06225ce039f9c883465c6743186c2f4 (commit) via 9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996 (commit) via dfb6e84082884f908ffad4594d2712d9edfd2cc0 (commit) via 51249e69eaab33fe43805b9fe2262b4ddab01b56 (commit) via e22c45d4c97c713734b8349132fa881f602f7ae3 (commit) via 0a21d820d3533309daff2f7fbf3389cd900cf9b8 (commit) via f93cc4158e0df5f7cc39c97e275bdc58c54698bd (commit) via 915b71010c1c48ccd8e84df825579dd5595afc9a (commit) via fcaa134c6c36e2de8d454a3d5132dee19f9f7b95 (commit) via cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63 (commit) via 1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b (commit) from 2fbd77124e4990a381143f0351b1caed12db5107 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49e777aeb1dbb141383faf1e5cb20c7443952302 commit 49e777aeb1dbb141383faf1e5cb20c7443952302 Merge: dc38970 0a21d82 Author: Brad King AuthorDate: Mon Mar 5 14:02:07 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 5 09:02:14 2018 -0500 Merge topic 'general_cleanup_enhance' 0a21d820d3 Remove c_str() from calls to converttorelativeformake in XCode Generator f93cc4158e Refactor cmCacheManager::LoadCache to use ostringstream 915b71010c Enhance RunCMake test coverage for file(GLOB) fcaa134c6c Refactor HandleGlobCommand cf5d0b49e8 Adjust class description in cmFileTimeComparison.h Acked-by: Kitware Robot Merge-request: !1810 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc38970f8388e21227c8cdc50df93431c3719030 commit dc38970f8388e21227c8cdc50df93431c3719030 Merge: b39a9dd 7776ce9 Author: Brad King AuthorDate: Mon Mar 5 14:01:24 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 5 09:01:42 2018 -0500 Merge topic 'object-library-linking' 7776ce98c3 Tests: Add cases for usage requirements of linked object libs bafe655b11 Help: Document linking behavior of OBJECT libraries 57538224d0 objlib: Link object-files from `OBJECT` libraries. 9a7f039ee7 objlib: Allow `OBJECT` libraries to link to `OBJECT` libraries. dfb6e84082 objlib: Allow other libraries to link to `OBJECT` libraries. 51249e69ea objlib: Allow `OBJECT` libraries to link to other libraries. e22c45d4c9 Tests: Teach RunCMake to ignore AIX ld warnings about GNU atexit Acked-by: Kitware Robot Acked-by: Pavel Solodovnikov Acked-by: John Drouhard Merge-request: !1524 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3 commit b39a9dd897f3062273acb4d2ea3dbf4d9c7343c3 Merge: 2fbd771 1ac042a Author: Brad King AuthorDate: Mon Mar 5 14:00:18 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 5 09:00:30 2018 -0500 Merge topic 'def-generate-windows-only' 1ac042aa67 Do not generate rules for .def generation where not supported Acked-by: Kitware Robot Merge-request: !1809 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7776ce98c3fc1fc656c646ea783c23aee27261a2 commit 7776ce98c3fc1fc656c646ea783c23aee27261a2 Author: Brad King AuthorDate: Thu Mar 1 09:25:50 2018 -0500 Commit: Brad King CommitDate: Thu Mar 1 09:28:00 2018 -0500 Tests: Add cases for usage requirements of linked object libs Add tests to cover transitive usage requirements on installation and export of targets that link to object libraries. Issue: #14778 diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 4f663f6..cbc8c6b 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -88,7 +88,17 @@ else() set(maybe_OBJECTS_DESTINATION "") endif() -add_library(testLib9Obj OBJECT testLib9Obj.c) +cmake_policy(PUSH) +cmake_policy(SET CMP0022 NEW) +add_library(testLib9ObjPub OBJECT testLib9ObjPub.c) +target_compile_definitions(testLib9ObjPub INTERFACE testLib9ObjPub_USED) +add_library(testLib9ObjPriv OBJECT testLib9ObjPriv.c) +target_compile_definitions(testLib9ObjPriv INTERFACE testLib9ObjPriv_USED) +add_library(testLib9ObjIface OBJECT testLib9ObjIface.c) +target_compile_definitions(testLib9ObjIface INTERFACE testLib9ObjIface_USED) +add_library(testLib9 STATIC testLib9.c) +target_link_libraries(testLib9 INTERFACE testLib9ObjIface PUBLIC testLib9ObjPub PRIVATE testLib9ObjPriv) +cmake_policy(POP) # Test using the target_link_libraries command to set the # LINK_INTERFACE_LIBRARIES* properties. We construct two libraries @@ -486,6 +496,7 @@ install( testExe1 testLib1 testLib2 testExe2 testLib3 testLib4 testExe3 testExe4 testExe2lib testLib4lib testLib4libdbg testLib4libopt testLib6 testLib7 testLib8 + testLib9 testLibCycleA testLibCycleB testLibNoSONAME cmp0022NEW cmp0022OLD @@ -500,7 +511,7 @@ install( ) install( TARGETS - testLib9Obj + testLib9ObjPub testLib9ObjPriv testLib9ObjIface EXPORT exp ) if (APPLE) @@ -553,7 +564,7 @@ export(TARGETS testExe1 testLib1 testLib2 testLib3 ) export(TARGETS testExe2 testLib4 testLib5 testLib6 testLib7 testExe3 testExe4 testExe2lib testLib8 - testLib9Obj + testLib9 testLib9ObjPub testLib9ObjPriv testLib9ObjIface testLib4lib testLib4libdbg testLib4libopt testLibCycleA testLibCycleB testLibNoSONAME diff --git a/Tests/ExportImport/Export/testLib9.c b/Tests/ExportImport/Export/testLib9.c new file mode 100644 index 0000000..fe8610b --- /dev/null +++ b/Tests/ExportImport/Export/testLib9.c @@ -0,0 +1,15 @@ +#ifndef testLib9ObjPub_USED +#error "testLib9ObjPub_USED not defined!" +#endif +#ifndef testLib9ObjPriv_USED +#error "testLib9ObjPriv_USED not defined!" +#endif +#ifdef testLib9ObjIface_USED +#error "testLib9ObjIface_USED defined but should not be!" +#endif +int testLib9ObjPub(void); +int testLib9ObjPriv(void); +int testLib9(void) +{ + return (testLib9ObjPub() + testLib9ObjPriv()); +} diff --git a/Tests/ExportImport/Export/testLib9Obj.c b/Tests/ExportImport/Export/testLib9Obj.c deleted file mode 100644 index 6a13e48..0000000 --- a/Tests/ExportImport/Export/testLib9Obj.c +++ /dev/null @@ -1,4 +0,0 @@ -int testLib9Obj(void) -{ - return 0; -} diff --git a/Tests/ExportImport/Export/testLib9ObjIface.c b/Tests/ExportImport/Export/testLib9ObjIface.c new file mode 100644 index 0000000..e75440a --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjIface.c @@ -0,0 +1,11 @@ +/* Duplicate symbols from other sources to verify that this source + is not included when the object library is used. */ +int testLib9ObjMissing(void); +int testLib9ObjPub(void) +{ + return testLib9ObjMissing(); +} +int testLib9ObjPriv(void) +{ + return testLib9ObjMissing(); +} diff --git a/Tests/ExportImport/Export/testLib9ObjPriv.c b/Tests/ExportImport/Export/testLib9ObjPriv.c new file mode 100644 index 0000000..6fa63cc --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPriv.c @@ -0,0 +1,4 @@ +int testLib9ObjPriv(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Export/testLib9ObjPub.c b/Tests/ExportImport/Export/testLib9ObjPub.c new file mode 100644 index 0000000..66e2624 --- /dev/null +++ b/Tests/ExportImport/Export/testLib9ObjPub.c @@ -0,0 +1,4 @@ +int testLib9ObjPub(void) +{ + return 0; +} diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 6d16cb7..4e8eac2 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -231,26 +231,41 @@ target_link_libraries(imp_lib1b bld_testLib2) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT CMAKE_OSX_ARCHITECTURES MATCHES "[;$]") set(bld_objlib_type OBJECT_LIBRARY) - # Create a executable that is using objects imported from the install tree - add_executable(imp_testLib8 imp_testLib8.c $) + # Create executables using objects imported from the install tree + add_executable(imp_testLib8_src imp_testLib8.c $) + add_executable(imp_testLib8_link imp_testLib8.c) + target_link_libraries(imp_testLib8_link exp_testLib8) if(NOT CMAKE_GENERATOR STREQUAL "Xcode" OR NOT XCODE_VERSION VERSION_LESS 5) - # Create a executable that is using objects imported from the build tree - add_executable(imp_testLib8b imp_testLib8.c $) + # Create executables using objects imported from the build tree + add_executable(imp_testLib8b_src imp_testLib8.c $) + add_executable(imp_testLib8b_link imp_testLib8.c) + target_link_libraries(imp_testLib8b_link bld_testLib8) endif() else() set(bld_objlib_type INTERFACE_LIBRARY) endif() +# Create an executable that uses a library imported from the install tree +# that itself was built using an object library. Verify we get the usage +# requirements. +add_executable(imp_testLib9 imp_testLib9.c) +target_link_libraries(imp_testLib9 exp_testLib9) +# Similarly for importing from the build tree. +add_executable(imp_testLib9b imp_testLib9.c) +target_link_libraries(imp_testLib9b bld_testLib9) + # Check that object libraries were transformed on export as expected. -get_property(type TARGET exp_testLib9Obj PROPERTY TYPE) -if(NOT type STREQUAL INTERFACE_LIBRARY) - message(FATAL_ERROR "exp_testLib9Obj type is '${type}', not 'INTERFACE_LIBRARY'") -endif() -get_property(type TARGET bld_testLib9Obj PROPERTY TYPE) -if(NOT type STREQUAL "${bld_objlib_type}") - message(FATAL_ERROR "bld_testLib9Obj type is '${type}', not '${bld_objlib_type}'") -endif() +foreach(vis Pub Priv Iface) + get_property(type TARGET exp_testLib9Obj${vis} PROPERTY TYPE) + if(NOT type STREQUAL INTERFACE_LIBRARY) + message(FATAL_ERROR "exp_testLib9Obj${vis} type is '${type}', not 'INTERFACE_LIBRARY'") + endif() + get_property(type TARGET bld_testLib9Obj${vis} PROPERTY TYPE) + if(NOT type STREQUAL "${bld_objlib_type}") + message(FATAL_ERROR "bld_testLib9Obj${vis} type is '${type}', not '${bld_objlib_type}'") + endif() +endforeach() #----------------------------------------------------------------------------- # Test that handling imported targets, including transitive dependencies, diff --git a/Tests/ExportImport/Import/A/imp_testLib9.c b/Tests/ExportImport/Import/A/imp_testLib9.c new file mode 100644 index 0000000..f9c05fd --- /dev/null +++ b/Tests/ExportImport/Import/A/imp_testLib9.c @@ -0,0 +1,16 @@ +#ifndef testLib9ObjPub_USED +#error "testLib9ObjPub_USED not defined!" +#endif +#ifdef testLib9ObjPriv_USED +#error "testLib9ObjPriv_USED defined but should not be!" +#endif +#ifndef testLib9ObjIface_USED +#error "testLib9ObjIface_USED not defined!" +#endif + +int testLib9(void); + +int main() +{ + return testLib9(); +} diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt new file mode 100644 index 0000000..f2f0f94 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt @@ -0,0 +1 @@ +CMake Error: install\(EXPORT "exp" ...\) includes target "UseA" which requires target "A" that is not in the export set. diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake new file mode 100644 index 0000000..9e24609 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake new file mode 100644 index 0000000..cdda962 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake @@ -0,0 +1,6 @@ +add_library(A OBJECT a.c) +add_library(UseA STATIC) +target_link_libraries(UseA PUBLIC A) + +install(TARGETS UseA A EXPORT exp ARCHIVE DESTINATION lib) +install(EXPORT exp DESTINATION lib/cmake/exp) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 61be23d..c73732f 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -11,6 +11,8 @@ if(RunCMake_GENERATOR STREQUAL "Xcode" AND "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCH else() run_cmake(Import) run_cmake(Install) + run_cmake(InstallLinkedObj1) + run_cmake(InstallLinkedObj2) endif() run_cmake(Export) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bafe655b11c876b45a5ce1fbaf4643593bdd22a3 commit bafe655b11c876b45a5ce1fbaf4643593bdd22a3 Author: Brad King AuthorDate: Thu Mar 1 09:25:45 2018 -0500 Commit: Brad King CommitDate: Thu Mar 1 09:27:50 2018 -0500 Help: Document linking behavior of OBJECT libraries Inspired-by: Deniz Bahadir Issue: #14778 diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst index 3706153..8fa0df7 100644 --- a/Help/command/add_library.rst +++ b/Help/command/add_library.rst @@ -110,10 +110,10 @@ along with those compiled from their own sources. Object libraries may contain only sources that compile, header files, and other files that would not affect linking of a normal library (e.g. ``.txt``). They may contain custom commands generating such sources, but not -``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Object libraries -cannot be linked. Some native build systems (such as Xcode) may not like -targets that have only object files, so consider adding at least one real -source file to any target that references ``$``. +``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands. Some native build +systems (such as Xcode) may not like targets that have only object files, so +consider adding at least one real source file to any target that references +``$``. Alias Libraries ^^^^^^^^^^^^^^^ diff --git a/Help/command/export.rst b/Help/command/export.rst index 17fcecb..0c676c6 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -45,7 +45,9 @@ unspecified. :ref:`Object Libraries` under :generator:`Xcode` have special handling if multiple architectures are listed in :variable:`CMAKE_OSX_ARCHITECTURES`. In this case they will be exported as :ref:`Interface Libraries` with - no object files available to clients. + no object files available to clients. This is sufficient to satisfy + transitive usage requirements of other targets that link to the + object libraries in their implementation. :: diff --git a/Help/command/install.rst b/Help/command/install.rst index 1cedc35..eb7b07c 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -187,6 +187,8 @@ export file itself, call ``install(EXPORT)``, documented below. They install no artifacts but will be included in an associated ``EXPORT``. If :ref:`Object Libraries` are listed but given no destination for their object files, they will be exported as :ref:`Interface Libraries`. +This is sufficient to satisfy transitive usage requirements of other +targets that link to the object libraries in their implementation. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property set to ``TRUE`` has undefined behavior. diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst index 2ec8744..fcc2c07 100644 --- a/Help/command/target_link_libraries.rst +++ b/Help/command/target_link_libraries.rst @@ -183,6 +183,70 @@ is not ``NEW``, they are also appended to the ``general`` (or without any keyword) are treated as if specified for both ``debug`` and ``optimized``. +Linking Object Libraries +^^^^^^^^^^^^^^^^^^^^^^^^ + +:ref:`Object Libraries` may be used as the ```` (first) argument +of ``target_link_libraries`` to specify dependencies of their sources +on other libraries. For example, the code + +.. code-block:: cmake + + add_library(A SHARED a.c) + target_compile_definitions(A PUBLIC A) + + add_library(obj OBJECT obj.c) + target_compile_definitions(obj PUBLIC OBJ) + target_link_libraries(obj PUBLIC A) + +compiles ``obj.c`` with ``-DA -DOBJ`` and establishes usage requirements +for ``obj`` that propagate to its dependents. + +Normal libraries and executables may link to :ref:`Object Libraries` +to get their objects and usage requirements. Continuing the above +example, the code + +.. code-block:: cmake + + add_library(B SHARED b.c) + target_link_libraries(B PUBLIC obj) + +compiles ``b.c`` with ``-DA -DOBJ``, creates shared library ``B`` +with object files from ``b.c`` and ``obj.c``, and links ``B`` to ``A``. +Furthermore, the code + +.. code-block:: cmake + + add_executable(main main.c) + target_link_libraries(main B) + +compiles ``main.c`` with ``-DA -DOBJ`` and links executable ``main`` +to ``B`` and ``A``. The object library's usage requirements are +propagated transitively through ``B``, but its object files are not. + +:ref:`Object Libraries` may "link" to other object libraries to get +usage requirements, but since they do not have a link step nothing +is done with their object files. Continuing from the above example, +the code: + +.. code-block:: cmake + + add_library(obj2 OBJECT obj2.c) + target_link_libraries(obj2 PUBLIC obj) + + add_executable(main2 main2.c) + target_link_libraries(main2 obj2) + +compiles ``obj2.c`` with ``-DA -DOBJ``, creates executable ``main2`` +with object files from ``main2.c`` and ``obj2.c``, and links ``main2`` +to ``A``. + +In other words, when :ref:`Object Libraries` appear in a target's +:prop_tgt:`INTERFACE_LINK_LIBRARIES` property they will be +treated as :ref:`Interface Libraries`, but when they appear in +a target's :prop_tgt:`LINK_LIBRARIES` property their object files +will be included in the link too. + Cyclic Dependencies of Static Libraries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst index ae538ed..3516d48 100644 --- a/Help/manual/cmake-buildsystem.7.rst +++ b/Help/manual/cmake-buildsystem.7.rst @@ -113,9 +113,9 @@ and it uniquely identifies the bundle. Object Libraries ^^^^^^^^^^^^^^^^ -The ``OBJECT`` library type is also not linked to. It defines a non-archival -collection of object files resulting from compiling the given source files. -The object files collection can be used as source inputs to other targets: +The ``OBJECT`` library type defines a non-archival collection of object files +resulting from compiling the given source files. The object files collection +may be used as source inputs to other targets: .. code-block:: cmake @@ -125,22 +125,31 @@ The object files collection can be used as source inputs to other targets: add_executable(test_exe $ test.cpp) -``OBJECT`` libraries may not be used in the right hand side of -:command:`target_link_libraries`. They also may not be used as the ``TARGET`` -in a use of the :command:`add_custom_command(TARGET)` command signature. They -may be installed, and will be exported as an INTERFACE library. +The link (or archiving) step of those other targets will use the object +files collection in addition to those from their own sources. -Although object libraries may not be named directly in calls to -the :command:`target_link_libraries` command, they can be "linked" -indirectly by using an :ref:`Interface Library ` -whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name -``$``. +Alternatively, object libraries may be linked into other targets: -Although object libraries may not be used as the ``TARGET`` -in a use of the :command:`add_custom_command(TARGET)` command signature, -the list of objects can be used by :command:`add_custom_command(OUTPUT)` or -:command:`file(GENERATE)` by using ``$``. +.. code-block:: cmake + + add_library(archive OBJECT archive.cpp zip.cpp lzma.cpp) + + add_library(archiveExtras STATIC extras.cpp) + target_link_libraries(archiveExtras PUBLIC archive) + + add_executable(test_exe test.cpp) + target_link_libraries(test_exe archive) + +The link (or archiving) step of those other targets will use the object +files from object libraries that are *directly* linked. Additionally, +usage requirements of the object libraries will be honored when compiling +sources in those other targets. Furthermore, those usage requirements +will propagate transitively to dependents of those other targets. +Object libraries may not be used as the ``TARGET`` in a use of the +:command:`add_custom_command(TARGET)` command signature. However, +the list of objects can be used by :command:`add_custom_command(OUTPUT)` +or :command:`file(GENERATE)` by using ``$``. Build Specification and Usage Requirements ========================================== diff --git a/Help/release/dev/object-library-linking.rst b/Help/release/dev/object-library-linking.rst new file mode 100644 index 0000000..131430f --- /dev/null +++ b/Help/release/dev/object-library-linking.rst @@ -0,0 +1,6 @@ +object-library-linking +---------------------- + +* The :command:`target_link_libraries` command now supports + :ref:`Object Libraries`. Linking to an object library uses its object + files in direct dependents and also propagates usage requirements. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=57538224d06225ce039f9c883465c6743186c2f4 commit 57538224d06225ce039f9c883465c6743186c2f4 Author: Deniz Bahadir AuthorDate: Thu Dec 14 16:47:22 2017 +0100 Commit: Brad King CommitDate: Thu Mar 1 09:24:25 2018 -0500 objlib: Link object-files from `OBJECT` libraries. Note: This finally links the object-files of the `OBJECT` library from the right-hand side of `target_link_libraries` to the target on the left-hand side. However, this will only happen with directly linked `OBJECT` libraries, not with `OBJECT` libraries "linked" through property `INTERFACE_LINK_LIBRARIES` of a target on the right-hand side! Fixes: #14778 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3aa57d2..2f581fc 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -809,6 +809,26 @@ static void AddInterfaceEntries( } } +static void AddObjectEntries( + cmGeneratorTarget const* thisTarget, std::string const& config, + std::vector& entries) +{ + if (cmLinkImplementationLibraries const* impl = + thisTarget->GetLinkImplementationLibraries(config)) { + for (cmLinkImplItem const& lib : impl->Libraries) { + if (lib.Target && + lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) { + std::string genex = "$"; + cmGeneratorExpression ge(lib.Backtrace); + std::unique_ptr cge = ge.Parse(genex); + cge->SetEvaluateForBuildsystem(true); + entries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(std::move(cge), lib)); + } + } + } +} + static bool processSources( cmGeneratorTarget const* tgt, const std::vector& entries, @@ -849,13 +869,10 @@ static bool processSources( std::ostringstream err; if (!targetName.empty()) { err << "Target \"" << targetName - << "\" contains relative " - "path in its INTERFACE_SOURCES:\n" - " \"" + << "\" contains relative path in its INTERFACE_SOURCES:\n \"" << src << "\""; } else { - err << "Found relative path while evaluating sources of " - "\"" + err << "Found relative path while evaluating sources of \"" << tgt->GetName() << "\":\n \"" << src << "\"\n"; } tgt->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, err.str()); @@ -932,23 +949,32 @@ void cmGeneratorTarget::GetSourceFiles(std::vector& files, processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker, config, debugSources); + // Collect INTERFACE_SOURCES of all direct link-dependencies. std::vector linkInterfaceSourcesEntries; - AddInterfaceEntries(this, config, "INTERFACE_SOURCES", linkInterfaceSourcesEntries); - std::vector::size_type numFilesBefore = files.size(); bool contextDependentInterfaceSources = processSources(this, linkInterfaceSourcesEntries, files, uniqueSrcs, &dagChecker, config, debugSources); + // Collect TARGET_OBJECTS of direct object link-dependencies. + std::vector linkObjectsEntries; + AddObjectEntries(this, config, linkObjectsEntries); + std::vector::size_type numFilesBefore2 = files.size(); + bool contextDependentObjects = + processSources(this, linkObjectsEntries, files, uniqueSrcs, &dagChecker, + config, debugSources); + if (!contextDependentDirectSources && - !(contextDependentInterfaceSources && numFilesBefore < files.size())) { + !(contextDependentInterfaceSources && numFilesBefore < files.size()) && + !(contextDependentObjects && numFilesBefore2 < files.size())) { this->LinkImplementationLanguageIsContextDependent = false; } cmDeleteAll(linkInterfaceSourcesEntries); + cmDeleteAll(linkObjectsEntries); } void cmGeneratorTarget::GetSourceFiles(std::vector& files, diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake new file mode 100644 index 0000000..e2e5fa2 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake @@ -0,0 +1,14 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake new file mode 100644 index 0000000..9e1ab6d --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake @@ -0,0 +1,11 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c) +target_link_libraries(A PRIVATE AnObjLib) +target_compile_definitions(A INTERFACE $) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 287331b..61be23d 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -40,6 +40,8 @@ run_object_lib_build(LinkObjLHSStatic) run_object_lib_build(LinkObjRHSShared) run_object_lib_build(LinkObjRHSStatic) run_object_lib_build2(LinkObjRHSObject) +run_object_lib_build(LinkObjRHSShared2) +run_object_lib_build(LinkObjRHSStatic2) run_object_lib_build2(LinkObjRHSObject2) run_cmake(MissingSource) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996 commit 9a7f039ee7d3f40d6d041fd0d1ef43f92faf8996 Author: Deniz Bahadir AuthorDate: Thu Dec 14 20:26:51 2017 +0100 Commit: Brad King CommitDate: Thu Mar 1 09:24:25 2018 -0500 objlib: Allow `OBJECT` libraries to link to `OBJECT` libraries. Note: This still does not link the object-files of the `OBJECT` library from the right-hand side of `target_link_libraries` to the target on the left-hand side. (In this particular case of another `OBJECT` library on the left-hand side this would not make any sense anyway. The target on the left-hand side has no link-step.) Issue: #14778 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f6fd6d1..3aa57d2 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1054,9 +1054,6 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, kind = SourceKindHeader; } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { kind = SourceKindExternalObject; - if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) { - badObjLib.push_back(sf); - } } else if (!sf->GetLanguage().empty()) { kind = SourceKindObjectSource; } else if (ext == "def") { diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt b/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt deleted file mode 100644 index b91ffd0..0000000 --- a/Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt +++ /dev/null @@ -1,9 +0,0 @@ -CMake Error at BadObjSource2.cmake:1 \(add_library\): - OBJECT library "A" contains: - - bad.obj - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt new file mode 100644 index 0000000..4eeb096 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt @@ -0,0 +1 @@ +REQUIRED needs to be defined diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake new file mode 100644 index 0000000..db571a3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PRIVATE AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt new file mode 100644 index 0000000..e27f06b --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt @@ -0,0 +1 @@ +[1-9][0-9]* diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake new file mode 100644 index 0000000..6bb8d5e --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake @@ -0,0 +1,12 @@ +cmake_policy(SET CMP0022 NEW) + +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(AnotherObjLib OBJECT b.c) +target_link_libraries(AnotherObjLib PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe AnotherObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt deleted file mode 100644 index aadc5e0..0000000 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Error at ObjWithObj.cmake:[0-9]+ \(add_library\): - OBJECT library \"B\" contains: - - [^ -]*a(\.c)?\.o(bj)? - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 6724da1..287331b 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -24,10 +24,23 @@ function (run_object_lib_build name) run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) endfunction () +function (run_object_lib_build2 name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + run_object_lib_build(LinkObjLHSShared) run_object_lib_build(LinkObjLHSStatic) run_object_lib_build(LinkObjRHSShared) run_object_lib_build(LinkObjRHSStatic) +run_object_lib_build2(LinkObjRHSObject) +run_object_lib_build2(LinkObjRHSObject2) run_cmake(MissingSource) run_cmake(ObjWithObj) diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt deleted file mode 100644 index 6183f80..0000000 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt +++ /dev/null @@ -1,10 +0,0 @@ -^CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - OBJECT library \"TestObjectLibWithoutSources\" contains: - - [^ -]*test(\.cpp)?\.o(bj)? - - but may contain only sources that compile, header files, and other files - that would not affect linking of a normal library. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfb6e84082884f908ffad4594d2712d9edfd2cc0 commit dfb6e84082884f908ffad4594d2712d9edfd2cc0 Author: Deniz Bahadir AuthorDate: Fri Nov 24 17:20:18 2017 +0100 Commit: Brad King CommitDate: Thu Mar 1 09:24:24 2018 -0500 objlib: Allow other libraries to link to `OBJECT` libraries. Note: This only allows `OBJECT` libraries to be on the right-hand side of `target_link_libraries` but still does not link its object-files to the target on the left-hand side. Issue: #14778 diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 8a5a6de..e00450f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -611,6 +611,9 @@ void cmComputeLinkInformation::AddItem(std::string const& item, if (!libName.empty()) { this->AddItem(libName, nullptr); } + } else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { + // Ignore object library! + // Its object-files should already have been extracted for linking. } else { // Decide whether to use an import library. bool implib = diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 18767a3..efdd3a5 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -211,11 +211,11 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) if (depender->GetType() != cmStateEnums::EXECUTABLE && depender->GetType() != cmStateEnums::STATIC_LIBRARY && depender->GetType() != cmStateEnums::SHARED_LIBRARY && - depender->GetType() != cmStateEnums::MODULE_LIBRARY) { + depender->GetType() != cmStateEnums::MODULE_LIBRARY && + depender->GetType() != cmStateEnums::OBJECT_LIBRARY) { this->GlobalGenerator->GetCMakeInstance()->IssueMessage( cmake::FATAL_ERROR, - "Only executables and non-OBJECT libraries may " - "reference target objects.", + "Only executables and libraries may reference target objects.", depender->GetBacktrace()); return; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index a276d01..f0ae47b 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -159,7 +159,9 @@ cmStateEnums::TargetType cmExportBuildFileGenerator::GetExportTargetType( { cmStateEnums::TargetType targetType = target->GetType(); // An object library exports as an interface library if we cannot - // tell clients where to find the objects. + // tell clients where to find the objects. This is sufficient + // to support transitive usage requirements on other targets that + // use the object library. if (targetType == cmStateEnums::OBJECT_LIBRARY && !this->LG->GetGlobalGenerator()->HasKnownObjectFileLocation(nullptr)) { targetType = cmStateEnums::INTERFACE_LIBRARY; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e9b6daf..f6fd6d1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -240,13 +240,16 @@ const char* cmGeneratorTarget::GetOutputTargetType( case cmStateEnums::MODULE_LIBRARY: switch (artifact) { case cmStateEnums::RuntimeBinaryArtifact: - // Module import libraries are treated as archive targets. + // Module libraries are always treated as library targets. return "LIBRARY"; case cmStateEnums::ImportLibraryArtifact: - // Module libraries are always treated as library targets. + // Module import libraries are treated as archive targets. return "ARCHIVE"; } break; + case cmStateEnums::OBJECT_LIBRARY: + // Object libraries are always treated as object targets. + return "OBJECT"; case cmStateEnums::EXECUTABLE: switch (artifact) { case cmStateEnums::RuntimeBinaryArtifact: @@ -1671,6 +1674,7 @@ bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const return this->GetType() == cmStateEnums::STATIC_LIBRARY || this->GetType() == cmStateEnums::SHARED_LIBRARY || this->GetType() == cmStateEnums::MODULE_LIBRARY || + this->GetType() == cmStateEnums::OBJECT_LIBRARY || this->GetType() == cmStateEnums::EXECUTABLE; } @@ -5323,20 +5327,6 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink( tgt = nullptr; } - if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { - std::ostringstream e; - e << "Target \"" << this->GetName() << "\" links to " - "OBJECT library \"" - << tgt->GetName() - << "\" but this is not " - "allowed. " - "One may link only to STATIC or SHARED libraries, or to executables " - "with the ENABLE_EXPORTS property set."; - cmake* cm = this->LocalGenerator->GetCMakeInstance(); - cm->IssueMessage(cmake::FATAL_ERROR, e.str(), this->GetBacktrace()); - tgt = nullptr; - } - return tgt; } @@ -5400,6 +5390,7 @@ bool cmGeneratorTarget::IsLinkable() const this->GetType() == cmStateEnums::SHARED_LIBRARY || this->GetType() == cmStateEnums::MODULE_LIBRARY || this->GetType() == cmStateEnums::UNKNOWN_LIBRARY || + this->GetType() == cmStateEnums::OBJECT_LIBRARY || this->GetType() == cmStateEnums::INTERFACE_LIBRARY || this->IsExecutableWithExports()); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 734ac93..bb21022 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -114,15 +114,12 @@ const char* cmTargetPropertyComputer::GetSources( } if (!noMessage) { e << "Target \"" << tgt->GetName() - << "\" contains " - "$ generator expression in its sources " - "list. " - "This content was not previously part of the SOURCES " - "property " - "when that property was read at configure time. Code " - "reading " - "that property needs to be adapted to ignore the generator " - "expression using the string(GENEX_STRIP) command."; + << "\" contains $ generator expression in its " + "sources list. This content was not previously part of the " + "SOURCES property when that property was read at configure " + "time. Code reading that property needs to be adapted to " + "ignore the generator expression using the string(GENEX_STRIP) " + "command."; messenger->IssueMessage(messageType, e.str(), context); } if (addContent) { @@ -742,7 +739,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, } if (cmGeneratorExpression::Find(lib) != std::string::npos || - (tgt && tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) || + (tgt && (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY || + tgt->GetType() == cmStateEnums::OBJECT_LIBRARY)) || (this->Name == lib)) { return; } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 47c29db..699fff8 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -391,14 +391,15 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) && (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) && (tgt->GetType() != cmStateEnums::UNKNOWN_LIBRARY) && + (tgt->GetType() != cmStateEnums::OBJECT_LIBRARY) && (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) && !tgt->IsExecutableWithExports()) { std::ostringstream e; e << "Target \"" << lib << "\" of type " << cmState::GetTargetTypeName(tgt->GetType()) << " may not be linked into another target. One may link only to " - "INTERFACE, STATIC or SHARED libraries, or to executables with the " - "ENABLE_EXPORTS property set."; + "INTERFACE, OBJECT, STATIC or SHARED libraries, or to executables " + "with the ENABLE_EXPORTS property set."; this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); } diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt deleted file mode 100644 index d5ee4f9..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\): - Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another - target. One may link only to INTERFACE, STATIC or SHARED libraries, or to - executables with the ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake deleted file mode 100644 index 113d6a8..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A STATIC a.c) -add_library(AnObjLib OBJECT a.c) -target_link_libraries(A AnObjLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt deleted file mode 100644 index 3295fca..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt +++ /dev/null @@ -1,6 +0,0 @@ -CMake Error at LinkObjRHS2.cmake:1 \(add_library\): - Target "A" links to OBJECT library "AnObjLib" but this is not allowed. One - may link only to STATIC or SHARED libraries, or to executables with the - ENABLE_EXPORTS property set. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake deleted file mode 100644 index 6163729..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake +++ /dev/null @@ -1,3 +0,0 @@ -add_library(A SHARED a.c) -target_link_libraries(A AnObjLib) -add_library(AnObjLib OBJECT a.c) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake new file mode 100644 index 0000000..b9030b3 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +add_definitions(-DCOMPILE_FOR_SHARED_LIB) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) +set_target_properties(AnObjLib PROPERTIES POSITION_INDEPENDENT_CODE ON) + +add_library(A SHARED b.c $) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake new file mode 100644 index 0000000..73fad06 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake @@ -0,0 +1,10 @@ +enable_language(C) + +add_library(AnObjLib OBJECT a.c) +target_compile_definitions(AnObjLib INTERFACE REQUIRED) + +add_library(A STATIC b.c $) +target_link_libraries(A PUBLIC AnObjLib) + +add_executable(exe exe.c) +target_link_libraries(exe A) diff --git a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt index d67b4ae..aadc5e0 100644 --- a/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt @@ -1,4 +1,10 @@ -CMake Error at ObjWithObj.cmake:2 \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. +^CMake Error at ObjWithObj.cmake:[0-9]+ \(add_library\): + OBJECT library \"B\" contains: + + [^ +]*a(\.c)?\.o(bj)? + + but may contain only sources that compile, header files, and other files + that would not affect linking of a normal library. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 1660779..6724da1 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -26,9 +26,9 @@ endfunction () run_object_lib_build(LinkObjLHSShared) run_object_lib_build(LinkObjLHSStatic) +run_object_lib_build(LinkObjRHSShared) +run_object_lib_build(LinkObjRHSStatic) -run_cmake(LinkObjRHS1) -run_cmake(LinkObjRHS2) run_cmake(MissingSource) run_cmake(ObjWithObj) run_cmake(OwnSources) diff --git a/Tests/RunCMake/ObjectLibrary/a.c b/Tests/RunCMake/ObjectLibrary/a.c index 1636303..5beb3f1 100644 --- a/Tests/RunCMake/ObjectLibrary/a.c +++ b/Tests/RunCMake/ObjectLibrary/a.c @@ -1,4 +1,10 @@ -int a(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +EXPORT int a(void) { return 0; } diff --git a/Tests/RunCMake/ObjectLibrary/b.c b/Tests/RunCMake/ObjectLibrary/b.c index 6751907..7549abf 100644 --- a/Tests/RunCMake/ObjectLibrary/b.c +++ b/Tests/RunCMake/ObjectLibrary/b.c @@ -1,4 +1,14 @@ -int b(void) +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT +#endif + +extern int a(void); +EXPORT int b() { - return 0; + return a(); } +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/ObjectLibrary/exe.c b/Tests/RunCMake/ObjectLibrary/exe.c new file mode 100644 index 0000000..6efdae7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/exe.c @@ -0,0 +1,14 @@ +#if defined(_WIN32) && defined(COMPILE_FOR_SHARED_LIB) +#define IMPORT __declspec(dllimport) +#else +#define IMPORT +#endif + +extern IMPORT int b(void); +int main() +{ + return b(); +} +#ifndef REQUIRED +#error "REQUIRED needs to be defined" +#endif diff --git a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt index 77a72f1..6183f80 100644 --- a/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt @@ -7,10 +7,4 @@ but may contain only sources that compile, header files, and other files that would not affect linking of a normal library. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\) - - -CMake Error at OBJECTwithOnlyObjectSources.cmake:[0-9]+ \(add_library\): - Only executables and non-OBJECT libraries may reference target objects. -Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51249e69eaab33fe43805b9fe2262b4ddab01b56 commit 51249e69eaab33fe43805b9fe2262b4ddab01b56 Author: Deniz Bahadir AuthorDate: Thu Nov 23 12:59:20 2017 +0100 Commit: Brad King CommitDate: Thu Mar 1 09:24:24 2018 -0500 objlib: Allow `OBJECT` libraries to link to other libraries. The proper way to use libraries is now through `target_link_libraries` for things such as usage requirements, compile definitions, include directories, etc. To facilitate this, allow `OBJECT` libraries to "link" to other libraries. Co-Author: Ben Boeckel Issue: #14778 diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 9e4575a..47c29db 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -94,16 +94,6 @@ bool cmTargetLinkLibrariesCommand::InitialPass( return true; } - // OBJECT libraries are not allowed on the LHS of the command. - if (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) { - std::ostringstream e; - e << "Object library target \"" << args[0] << "\" " - << "may not link to anything."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - cmSystemTools::SetFatalErrorOccured(); - return true; - } - // Having a UTILITY library on the LHS is a bug. if (this->Target->GetType() == cmStateEnums::UTILITY) { std::ostringstream e; diff --git a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt index a17c8cd..d1b0d2c 100644 --- a/Tests/RunCMake/ObjectLibrary/CMakeLists.txt +++ b/Tests/RunCMake/ObjectLibrary/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.10) project(${RunCMake_TEST} C) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt b/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt deleted file mode 100644 index 90e828b..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -CMake Error at LinkObjLHS.cmake:2 \(target_link_libraries\): - Object library target "AnObjLib" may not link to anything. -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake deleted file mode 100644 index 5d7831a..0000000 --- a/Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake +++ /dev/null @@ -1,2 +0,0 @@ -add_library(AnObjLib OBJECT a.c) -target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake new file mode 100644 index 0000000..4aa7bba --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSShared C) + +add_library(OtherLib SHARED a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake new file mode 100644 index 0000000..261bee7 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake @@ -0,0 +1,7 @@ +project(LinkObjLHSStatic C) + +add_library(OtherLib STATIC a.c) +target_compile_definitions(OtherLib INTERFACE REQUIRED) + +add_library(AnObjLib OBJECT requires.c) +target_link_libraries(AnObjLib OtherLib) diff --git a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake index 5c9dd65..1660779 100644 --- a/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake +++ b/Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake @@ -13,7 +13,20 @@ else() run_cmake(Install) endif() run_cmake(Export) -run_cmake(LinkObjLHS) + +function (run_object_lib_build name) + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${name}) + run_cmake_command(${name}-build ${CMAKE_COMMAND} --build .) +endfunction () + +run_object_lib_build(LinkObjLHSShared) +run_object_lib_build(LinkObjLHSStatic) + run_cmake(LinkObjRHS1) run_cmake(LinkObjRHS2) run_cmake(MissingSource) diff --git a/Tests/RunCMake/ObjectLibrary/requires.c b/Tests/RunCMake/ObjectLibrary/requires.c new file mode 100644 index 0000000..d524952 --- /dev/null +++ b/Tests/RunCMake/ObjectLibrary/requires.c @@ -0,0 +1,8 @@ +#ifdef REQUIRED +int required() +{ + return 0; +} +#else +#error "REQUIRED not defined" +#endif diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt index cd6f1e0..1bcc114 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -1,5 +1,4 @@ -^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(target_link_libraries\): - Object library target \"TestObjectLibWithoutSources\" may not link to - anything. +^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): + No SOURCES given to target: TestObjectLibWithoutSources Call Stack \(most recent call first\): CMakeLists.txt:[0-9]+ \(include\)$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e22c45d4c97c713734b8349132fa881f602f7ae3 commit e22c45d4c97c713734b8349132fa881f602f7ae3 Author: Brad King AuthorDate: Wed Feb 28 13:42:09 2018 -0500 Commit: Brad King CommitDate: Thu Mar 1 07:56:38 2018 -0500 Tests: Teach RunCMake to ignore AIX ld warnings about GNU atexit diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e688830..36a122f 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -112,6 +112,8 @@ function(run_cmake test) "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" "|Error kstat returned" "|Hit xcodebuild bug" + "|ld: 0711-224 WARNING: Duplicate symbol: .__init_aix_libgcc_cxa_atexit" + "|ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information" "|[^\n]*is a member of multiple groups" "|[^\n]*from Time Machine by path" "|[^\n]*Bullseye Testing Technology" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a21d820d3533309daff2f7fbf3389cd900cf9b8 commit 0a21d820d3533309daff2f7fbf3389cd900cf9b8 Author: Shane Parris AuthorDate: Wed Feb 14 10:50:14 2018 -0500 Commit: Shane Parris CommitDate: Wed Feb 28 09:51:42 2018 -0500 Remove c_str() from calls to converttorelativeformake in XCode Generator diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 0d5dad2..7fdf896 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -466,7 +466,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( if (regenerate && (isTopLevel || !generateTopLevelProjectOnly)) { this->CreateReRunCMakeFile(root, gens); std::string file = - this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str()); + this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile); cmSystemTools::ReplaceString(file, "\\ ", " "); cmTarget* check = mf->AddUtilityCommand( CMAKE_CHECK_BUILD_SYSTEM_TARGET, cmMakefile::TargetOrigin::Generator, @@ -553,7 +553,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( for (const auto& lfile : lfiles) { makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard " - << this->ConvertToRelativeForMake(lfile.c_str()) << "))\n"; + << this->ConvertToRelativeForMake(lfile) << "))\n"; } std::string checkCache = root->GetBinaryDirectory(); @@ -562,11 +562,11 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( checkCache += "cmake.check_cache"; makefileStream << "\n" - << this->ConvertToRelativeForMake(checkCache.c_str()) + << this->ConvertToRelativeForMake(checkCache) << ": $(TARGETS)\n"; makefileStream << "\t" << this->ConvertToRelativeForMake( - cmSystemTools::GetCMakeCommand().c_str()) + cmSystemTools::GetCMakeCommand()) << " -H" << this->ConvertToRelativeForMake(root->GetSourceDirectory()) << " -B" @@ -1571,12 +1571,11 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase( } std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); - cdir = this->ConvertToRelativeForMake(cdir.c_str()); + cdir = this->ConvertToRelativeForMake(cdir); std::string makecmd = "make -C "; makecmd += cdir; makecmd += " -f "; - makecmd += - this->ConvertToRelativeForMake((makefile + "$CONFIGURATION").c_str()); + makecmd += this->ConvertToRelativeForMake((makefile + "$CONFIGURATION")); makecmd += " all"; buildphase->AddAttribute("shellScript", this->CreateString(makecmd)); buildphase->AddAttribute("showEnvVarsInLog", this->CreateString("0")); @@ -1611,8 +1610,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( const std::vector& outputs = ccg.GetOutputs(); if (!outputs.empty()) { for (auto const& output : outputs) { - makefileStream << "\\\n\t" - << this->ConvertToRelativeForMake(output.c_str()); + makefileStream << "\\\n\t" << this->ConvertToRelativeForMake(output); } } else { std::ostringstream str; @@ -1633,8 +1631,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( // There is at least one output, start the rule for it const char* sep = ""; for (auto const& output : outputs) { - makefileStream << sep - << this->ConvertToRelativeForMake(output.c_str()); + makefileStream << sep << this->ConvertToRelativeForMake(output); sep = " "; } makefileStream << ": "; @@ -1646,8 +1643,7 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( std::string dep; if (this->CurrentLocalGenerator->GetRealDependency(d, configName, dep)) { - makefileStream << "\\\n" - << this->ConvertToRelativeForMake(dep.c_str()); + makefileStream << "\\\n" << this->ConvertToRelativeForMake(dep); } } makefileStream << "\n"; @@ -1664,12 +1660,12 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile( // Build the command line in a single string. std::string cmd2 = ccg.GetCommand(c); cmSystemTools::ReplaceString(cmd2, "/./", "/"); - cmd2 = this->ConvertToRelativeForMake(cmd2.c_str()); + cmd2 = this->ConvertToRelativeForMake(cmd2); std::string cmd; std::string wd = ccg.GetWorkingDirectory(); if (!wd.empty()) { cmd += "cd "; - cmd += this->ConvertToRelativeForMake(wd.c_str()); + cmd += this->ConvertToRelativeForMake(wd); cmd += " && "; } cmd += cmd2; @@ -3190,7 +3186,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( gt->GetType() == cmStateEnums::SHARED_LIBRARY || gt->GetType() == cmStateEnums::MODULE_LIBRARY) { std::string tfull = gt->GetFullPath(configName); - std::string trel = this->ConvertToRelativeForMake(tfull.c_str()); + std::string trel = this->ConvertToRelativeForMake(tfull); // Add this target to the post-build phases of its dependencies. std::map::const_iterator y = @@ -3218,7 +3214,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( target->GetDependLibraries().find(configName); if (x != target->GetDependLibraries().end()) { for (auto const& deplib : x->second) { - std::string file = this->ConvertToRelativeForMake(deplib.c_str()); + std::string file = this->ConvertToRelativeForMake(deplib); makefileStream << "\\\n\t" << file; dummyRules.insert(file); } @@ -3233,7 +3229,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( d += objLibName; d += ".a"; - std::string dependency = this->ConvertToRelativeForMake(d.c_str()); + std::string dependency = this->ConvertToRelativeForMake(d); makefileStream << "\\\n\t" << dependency; dummyRules.insert(dependency); } @@ -3241,8 +3237,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( // Write the action to remove the target if it is out of date. makefileStream << "\n"; makefileStream << "\t/bin/rm -f " - << this->ConvertToRelativeForMake(tfull.c_str()) - << "\n"; + << this->ConvertToRelativeForMake(tfull) << "\n"; // if building for more than one architecture // then remove those executables as well if (this->Architectures.size() > 1) { @@ -3254,8 +3249,7 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( universalFile += "/"; universalFile += gt->GetFullName(configName); makefileStream << "\t/bin/rm -f " - << this->ConvertToRelativeForMake( - universalFile.c_str()) + << this->ConvertToRelativeForMake(universalFile) << "\n"; } } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f93cc4158e0df5f7cc39c97e275bdc58c54698bd commit f93cc4158e0df5f7cc39c97e275bdc58c54698bd Author: Shane Parris AuthorDate: Tue Feb 13 12:33:49 2018 -0500 Commit: Shane Parris CommitDate: Wed Feb 28 09:34:47 2018 -0500 Refactor cmCacheManager::LoadCache to use ostringstream diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index fab2445..85ac985 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -160,14 +160,14 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, currentcwd += "/CMakeCache.txt"; oldcwd += "/CMakeCache.txt"; if (!cmSystemTools::SameFile(oldcwd, currentcwd)) { - std::string message = - std::string("The current CMakeCache.txt directory ") + currentcwd + - std::string(" is different than the directory ") + - std::string(this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR")) + - std::string(" where CMakeCache.txt was created. This may result " - "in binaries being created in the wrong place. If you " - "are not sure, reedit the CMakeCache.txt"); - cmSystemTools::Error(message.c_str()); + std::ostringstream message; + message << "The current CMakeCache.txt directory " << currentcwd + << " is different than the directory " + << this->GetInitializedCacheValue("CMAKE_CACHEFILE_DIR") + << " where CMakeCache.txt was created. This may result " + "in binaries being created in the wrong place. If you " + "are not sure, reedit the CMakeCache.txt"; + cmSystemTools::Error(message.str().c_str()); } } return true; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=915b71010c1c48ccd8e84df825579dd5595afc9a commit 915b71010c1c48ccd8e84df825579dd5595afc9a Author: Shane Parris AuthorDate: Tue Feb 13 12:40:55 2018 -0500 Commit: Shane Parris CommitDate: Wed Feb 28 09:34:47 2018 -0500 Enhance RunCMake test coverage for file(GLOB) diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..af3cb2e --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file FOLLOW_SYMLINKS is not a valid parameter for GLOB\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..6d467a0 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt new file mode 100644 index 0000000..30cec89 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-error-RELATIVE-no-arg\.cmake:[0-9]+ \(file\): + file GLOB requires a directory after the RELATIVE tag\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake new file mode 100644 index 0000000..a555881 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE) diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt new file mode 100644 index 0000000..ee6cb0b --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the bool\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt new file mode 100644 index 0000000..9c66631 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB-noexp-RELATIVE\.cmake:[0-9]+ \(file\): + file GLOB requires a glob expression after the directory\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake new file mode 100644 index 0000000..7b2d404 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake @@ -0,0 +1 @@ +file(GLOB CONTENT_LIST RELATIVE "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt new file mode 100644 index 0000000..d0b2bff --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GLOB_RECURSE-noexp-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): + file GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS\. +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake new file mode 100644 index 0000000..5e5ce92 --- /dev/null +++ b/Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake @@ -0,0 +1 @@ +file(GLOB_RECURSE CONTENT_LIST FOLLOW_SYMLINKS) diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 9a72333..27305d0 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -35,11 +35,15 @@ run_cmake(LOCK-lowercase) run_cmake(READ_ELF) run_cmake(GLOB) run_cmake(GLOB_RECURSE) -# test is valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) + +# tests are valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-error-FOLLOW_SYMLINKS) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) -# test is valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) +run_cmake(GLOB-error-RELATIVE-no-arg) run_cmake(GLOB-noexp-LIST_DIRECTORIES) +run_cmake(GLOB-noexp-RELATIVE) if(NOT WIN32 OR CYGWIN) run_cmake(GLOB_RECURSE-cyclic-recursion) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fcaa134c6c36e2de8d454a3d5132dee19f9f7b95 commit fcaa134c6c36e2de8d454a3d5132dee19f9f7b95 Author: Shane Parris AuthorDate: Tue Feb 13 12:33:11 2018 -0500 Commit: Shane Parris CommitDate: Wed Feb 28 09:34:47 2018 -0500 Refactor HandleGlobCommand diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 8492c17..b5215a5 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -757,9 +757,10 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } - std::string output; + std::ostringstream outputStream; bool first = true; - for (; i != args.end(); ++i) { + bool warnFollowedSymlinks = false; + while (i != args.end()) { if (*i == "LIST_DIRECTORIES") { ++i; if (i != args.end()) { @@ -777,103 +778,109 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, this->SetError("LIST_DIRECTORIES missing bool value."); return false; } - continue; - } - - if (recurse && (*i == "FOLLOW_SYMLINKS")) { + ++i; + if (i == args.end()) { + this->SetError("GLOB requires a glob expression after the bool."); + return false; + } + } else if (*i == "FOLLOW_SYMLINKS") { + if (!recurse) { + this->SetError("FOLLOW_SYMLINKS is not a valid parameter for GLOB."); + return false; + } explicitFollowSymlinks = true; g.RecurseThroughSymlinksOn(); ++i; if (i == args.end()) { this->SetError( - "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS"); + "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS."); return false; } - } - - if (*i == "RELATIVE") { + } else if (*i == "RELATIVE") { ++i; // skip RELATIVE if (i == args.end()) { - this->SetError("GLOB requires a directory after the RELATIVE tag"); + this->SetError("GLOB requires a directory after the RELATIVE tag."); return false; } g.SetRelative(i->c_str()); ++i; if (i == args.end()) { - this->SetError("GLOB requires a glob expression after the directory"); + this->SetError("GLOB requires a glob expression after the directory."); return false; } - } - - cmsys::Glob::GlobMessages globMessages; - if (!cmsys::SystemTools::FileIsFullPath(*i)) { - std::string expr = this->Makefile->GetCurrentSourceDirectory(); - // Handle script mode - if (!expr.empty()) { - expr += "/" + *i; - g.FindFiles(expr, &globMessages); - } else { - g.FindFiles(*i, &globMessages); - } } else { - g.FindFiles(*i, &globMessages); - } - - if (!globMessages.empty()) { - bool shouldExit = false; - for (cmsys::Glob::Message const& globMessage : globMessages) { - if (globMessage.type == cmsys::Glob::cyclicRecursion) { - this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, - "Cyclic recursion detected while globbing for '" + *i + "':\n" + - globMessage.content); + std::string expr = *i; + if (!cmsys::SystemTools::FileIsFullPath(*i)) { + expr = this->Makefile->GetCurrentSourceDirectory(); + // Handle script mode + if (!expr.empty()) { + expr += "/" + *i; } else { - this->Makefile->IssueMessage( - cmake::FATAL_ERROR, "Error has occurred while globbing for '" + - *i + "' - " + globMessage.content); - shouldExit = true; + expr = *i; } } - if (shouldExit) { - return false; + + cmsys::Glob::GlobMessages globMessages; + g.FindFiles(expr, &globMessages); + + if (!globMessages.empty()) { + bool shouldExit = false; + for (cmsys::Glob::Message const& globMessage : globMessages) { + if (globMessage.type == cmsys::Glob::cyclicRecursion) { + this->Makefile->IssueMessage( + cmake::AUTHOR_WARNING, + "Cyclic recursion detected while globbing for '" + *i + "':\n" + + globMessage.content); + } else { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, "Error has occurred while globbing for '" + + *i + "' - " + globMessage.content); + shouldExit = true; + } + } + if (shouldExit) { + return false; + } } - } - std::vector::size_type cc; - std::vector& files = g.GetFiles(); - std::sort(files.begin(), files.end()); - for (cc = 0; cc < files.size(); cc++) { - if (!first) { - output += ";"; + if (recurse && !explicitFollowSymlinks && + g.GetFollowedSymlinkCount() != 0) { + warnFollowedSymlinks = true; } - output += files[cc]; - first = false; - } - } - if (recurse && !explicitFollowSymlinks) { - switch (status) { - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - // Correct behavior, yay! - break; - case cmPolicies::OLD: - // Probably not really the expected behavior, but the author explicitly - // asked for the old behavior... no warning. - case cmPolicies::WARN: - // Possibly unexpected old behavior *and* we actually traversed - // symlinks without being explicitly asked to: warn the author. - if (g.GetFollowedSymlinkCount() != 0) { - this->Makefile->IssueMessage( - cmake::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); + std::vector& files = g.GetFiles(); + std::sort(files.begin(), files.end()); + for (std::string const& file : files) { + if (!first) { + outputStream << ";"; } - break; + outputStream << file; + first = false; + } + ++i; } } - this->Makefile->AddDefinition(variable, output.c_str()); + switch (status) { + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Correct behavior, yay! + break; + case cmPolicies::OLD: + // Probably not really the expected behavior, but the author explicitly + // asked for the old behavior... no warning. + case cmPolicies::WARN: + // Possibly unexpected old behavior *and* we actually traversed + // symlinks without being explicitly asked to: warn the author. + if (warnFollowedSymlinks) { + this->Makefile->IssueMessage( + cmake::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0009)); + } + break; + } + this->Makefile->AddDefinition(variable, outputStream.str().c_str()); return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63 commit cf5d0b49e8505ca9e17c5c5a44bbdce933f3cb63 Author: Shane Parris AuthorDate: Wed Jan 31 09:45:55 2018 -0500 Commit: Shane Parris CommitDate: Wed Feb 28 09:34:47 2018 -0500 Adjust class description in cmFileTimeComparison.h diff --git a/Source/cmFileTimeComparison.h b/Source/cmFileTimeComparison.h index b1f8ed6..114989b 100644 --- a/Source/cmFileTimeComparison.h +++ b/Source/cmFileTimeComparison.h @@ -8,9 +8,9 @@ class cmFileTimeComparisonInternal; /** \class cmFileTimeComparison - * \brief Helper class for performing globbing searches. + * \brief Helper class for comparing file modification times. * - * Finds all files that match a given globbing expression. + * Compare file modification times or test if file modification times differ. */ class cmFileTimeComparison { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b commit 1ac042aa67c0e0ab531cd38977cb2f65fd96ed4b Author: Brad King AuthorDate: Wed Feb 28 08:43:28 2018 -0500 Commit: Brad King CommitDate: Wed Feb 28 08:52:19 2018 -0500 Do not generate rules for .def generation where not supported Our `cmake -E __create_def` helper used for `WINDOWS_EXPORT_ALL_SYMBOLS` and merging of multiple `.def` files is available only with CMake hosted on Windows. However, we may generate use of it on other platforms since commit v3.9.0-rc1~405^2 (Support WINDOWS_EXPORT_ALL_SYMBOLS with `.def` files, 2017-03-13) when multiple `.def` files are listed. This results in a build error because the tool doesn't exist. Fix our logic to avoid using the tool on non-Windows platforms. Instead silently ignore all but the first `.def` source as we did before. Issue: #17773 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e9b6daf..abbc3d0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1999,8 +1999,13 @@ void cmGeneratorTarget::ComputeModuleDefinitionInfo( info.WindowsExportAllSymbols = this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") && this->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS"); +#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) info.DefFileGenerated = info.WindowsExportAllSymbols || info.Sources.size() > 1; +#else + // Our __create_def helper is only available on Windows. + info.DefFileGenerated = false; +#endif if (info.DefFileGenerated) { info.DefFile = this->ObjectDirectory /* has slash */ + "exports.def"; } else if (!info.Sources.empty()) { ----------------------------------------------------------------------- Summary of changes: Help/command/add_library.rst | 8 +- Help/command/export.rst | 4 +- Help/command/install.rst | 2 + Help/command/target_link_libraries.rst | 64 +++++++++ Help/manual/cmake-buildsystem.7.rst | 41 +++--- Help/release/dev/object-library-linking.rst | 6 + Source/cmCacheManager.cxx | 16 +-- Source/cmComputeLinkInformation.cxx | 3 + Source/cmComputeTargetDepends.cxx | 6 +- Source/cmExportBuildFileGenerator.cxx | 4 +- Source/cmFileCommand.cxx | 149 ++++++++++---------- Source/cmFileTimeComparison.h | 4 +- Source/cmGeneratorTarget.cxx | 73 ++++++---- Source/cmGlobalXCodeGenerator.cxx | 38 +++-- Source/cmTarget.cxx | 18 ++- Source/cmTargetLinkLibrariesCommand.cxx | 15 +- Tests/ExportImport/Export/CMakeLists.txt | 17 ++- Tests/ExportImport/Export/testLib9.c | 15 ++ Tests/ExportImport/Export/testLib9Obj.c | 4 - Tests/ExportImport/Export/testLib9ObjIface.c | 11 ++ Tests/ExportImport/Export/testLib9ObjPriv.c | 4 + Tests/ExportImport/Export/testLib9ObjPub.c | 4 + Tests/ExportImport/Import/A/CMakeLists.txt | 39 +++-- Tests/ExportImport/Import/A/imp_testLib9.c | 16 +++ .../ObjectLibrary/BadObjSource2-result.txt | 1 - .../ObjectLibrary/BadObjSource2-stderr.txt | 9 -- Tests/RunCMake/ObjectLibrary/CMakeLists.txt | 2 +- .../InstallLinkedObj1-result.txt} | 0 .../ObjectLibrary/InstallLinkedObj1-stderr.txt | 1 + .../RunCMake/ObjectLibrary/InstallLinkedObj1.cmake | 6 + .../RunCMake/ObjectLibrary/InstallLinkedObj2.cmake | 6 + Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt | 1 - Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt | 4 - Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake | 2 - .../RunCMake/ObjectLibrary/LinkObjLHSShared.cmake | 7 + .../RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake | 7 + .../RunCMake/ObjectLibrary/LinkObjRHS1-result.txt | 1 - .../RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt | 6 - Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake | 3 - .../RunCMake/ObjectLibrary/LinkObjRHS2-result.txt | 1 - .../RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt | 6 - Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake | 3 - .../LinkObjRHSObject-build-result.txt | 1 + .../LinkObjRHSObject-build-stdout.txt | 1 + .../RunCMake/ObjectLibrary/LinkObjRHSObject.cmake | 12 ++ .../LinkObjRHSObject2-build-result.txt | 1 + .../RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake | 12 ++ .../RunCMake/ObjectLibrary/LinkObjRHSShared.cmake | 13 ++ .../RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake | 14 ++ .../RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake | 10 ++ .../RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake | 11 ++ Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt | 1 - Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt | 4 - Tests/RunCMake/ObjectLibrary/RunCMakeTest.cmake | 36 ++++- Tests/RunCMake/ObjectLibrary/a.c | 8 +- Tests/RunCMake/ObjectLibrary/b.c | 14 +- Tests/RunCMake/ObjectLibrary/exe.c | 14 ++ Tests/RunCMake/ObjectLibrary/requires.c | 8 ++ Tests/RunCMake/RunCMake.cmake | 2 + .../OBJECTwithNoSourcesButLinkObjects-stderr.txt | 5 +- .../OBJECTwithOnlyObjectSources-result.txt | 1 - .../OBJECTwithOnlyObjectSources-stderr.txt | 16 --- .../GLOB-error-FOLLOW_SYMLINKS-result.txt} | 0 .../file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt | 4 + .../RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake | 1 + .../GLOB-error-RELATIVE-no-arg-result.txt} | 0 .../file/GLOB-error-RELATIVE-no-arg-stderr.txt | 4 + .../RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake | 1 + .../GLOB-noexp-LIST_DIRECTORIES-result.txt} | 0 .../file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt | 4 + .../GLOB-noexp-RELATIVE-result.txt} | 0 Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt | 4 + Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake | 1 + .../GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt} | 0 .../GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt | 4 + .../file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake | 1 + Tests/RunCMake/file/RunCMakeTest.cmake | 8 +- 77 files changed, 576 insertions(+), 267 deletions(-) create mode 100644 Help/release/dev/object-library-linking.rst create mode 100644 Tests/ExportImport/Export/testLib9.c delete mode 100644 Tests/ExportImport/Export/testLib9Obj.c create mode 100644 Tests/ExportImport/Export/testLib9ObjIface.c create mode 100644 Tests/ExportImport/Export/testLib9ObjPriv.c create mode 100644 Tests/ExportImport/Export/testLib9ObjPub.c create mode 100644 Tests/ExportImport/Import/A/imp_testLib9.c delete mode 100644 Tests/RunCMake/ObjectLibrary/BadObjSource2-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/BadObjSource2-stderr.txt copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => ObjectLibrary/InstallLinkedObj1-result.txt} (100%) create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj1-stderr.txt create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj1.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/InstallLinkedObj2.cmake delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS-stderr.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHS.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHSShared.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjLHSStatic.cmake delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1-stderr.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS1.cmake delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2-stderr.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHS2.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-result.txt create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject-build-stdout.txt create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2-build-result.txt create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSObject2.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSShared.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSShared2.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic.cmake create mode 100644 Tests/RunCMake/ObjectLibrary/LinkObjRHSStatic2.cmake delete mode 100644 Tests/RunCMake/ObjectLibrary/ObjWithObj-result.txt delete mode 100644 Tests/RunCMake/ObjectLibrary/ObjWithObj-stderr.txt create mode 100644 Tests/RunCMake/ObjectLibrary/exe.c create mode 100644 Tests/RunCMake/ObjectLibrary/requires.c delete mode 100644 Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-result.txt delete mode 100644 Tests/RunCMake/add_library/OBJECTwithOnlyObjectSources-stderr.txt copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-error-FOLLOW_SYMLINKS-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-error-RELATIVE-no-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-error-RELATIVE-no-arg.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-noexp-LIST_DIRECTORIES-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB-noexp-RELATIVE-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB-noexp-RELATIVE-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-noexp-RELATIVE.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-result.txt} (100%) create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB_RECURSE-noexp-FOLLOW_SYMLINKS.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 6 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 6 Mar 2018 00:05:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-137-g674c5b3 Message-ID: <20180306050508.CF739107BB1@public.kitware.com> 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, master has been updated via 674c5b306671129bc4a854137c304f19e2c3bf65 (commit) from 49e777aeb1dbb141383faf1e5cb20c7443952302 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=674c5b306671129bc4a854137c304f19e2c3bf65 commit 674c5b306671129bc4a854137c304f19e2c3bf65 Author: Kitware Robot AuthorDate: Tue Mar 6 00:01:23 2018 -0500 Commit: Kitware Robot CommitDate: Tue Mar 6 00:01:23 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7ec49e8..c4acb16 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180305) +set(CMake_VERSION_PATCH 20180306) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 7 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 7 Mar 2018 00:05:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-138-g086f84a Message-ID: <20180307050505.C231B10AAD6@public.kitware.com> 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, master has been updated via 086f84aa20ac975ddf85ddf74434c13e00e9c9e6 (commit) from 674c5b306671129bc4a854137c304f19e2c3bf65 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=086f84aa20ac975ddf85ddf74434c13e00e9c9e6 commit 086f84aa20ac975ddf85ddf74434c13e00e9c9e6 Author: Kitware Robot AuthorDate: Wed Mar 7 00:01:11 2018 -0500 Commit: Kitware Robot CommitDate: Wed Mar 7 00:01:11 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c4acb16..df45cf6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180306) +set(CMake_VERSION_PATCH 20180307) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 7 07:15:12 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 7 Mar 2018 07:15:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-150-g29b41ba Message-ID: <20180307121512.53159103069@public.kitware.com> 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, master has been updated via 29b41babdb78b5e305ed9fc6b84dd69c1795dc69 (commit) via ae4205d219c6c9c6cc3d6b7ac959f9e68a2942cd (commit) via a6f1eabee0f6c7572f1fd3cfa8ec973deb21897e (commit) via 4f29bf56724aa8a71ce85b540f6b620454692ade (commit) via 8070abf784e0b12fdc5dfbafecdbe604f96c44a9 (commit) via 50b7be6d1f2022483cb75a5347a1e1a70a2994e0 (commit) via 566f8fa2f3bee5bf24902bcc125535435e6a9599 (commit) via eb1a9be4b63a807759ba81e4057219e1d6960eac (commit) via 6be53c6695e8d82d3633681f893b79db1de466f0 (commit) via c5428d8db2aebb215b418d72eae99f4a106a82b0 (commit) via 24de561a1a7529b919215edb0322279449c5e6c0 (commit) via 43d6e5a71f7cb68578c72ece1cb5046b929ebdc0 (commit) from 086f84aa20ac975ddf85ddf74434c13e00e9c9e6 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=29b41babdb78b5e305ed9fc6b84dd69c1795dc69 commit 29b41babdb78b5e305ed9fc6b84dd69c1795dc69 Merge: ae4205d 6be53c6 Author: Brad King AuthorDate: Wed Mar 7 12:14:24 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 7 07:14:35 2018 -0500 Merge topic 'ctest-affinity' 6be53c6695 CTest: Add options to control test process affinity to CPUs c5428d8db2 libuv: disable process affinity during CMake bootstrap 24de561a1a libuv: unix,win: add uv_spawn option to set child CPU affinity mask 43d6e5a71f libuv: misc: add function to get CPU affinity mask size Acked-by: Kitware Robot Merge-request: !1814 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae4205d219c6c9c6cc3d6b7ac959f9e68a2942cd commit ae4205d219c6c9c6cc3d6b7ac959f9e68a2942cd Merge: a6f1eab 8070abf Author: Brad King AuthorDate: Wed Mar 7 07:13:09 2018 -0500 Commit: Brad King CommitDate: Wed Mar 7 07:13:09 2018 -0500 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a6f1eabee0f6c7572f1fd3cfa8ec973deb21897e commit a6f1eabee0f6c7572f1fd3cfa8ec973deb21897e Merge: 4f29bf5 50b7be6 Author: Brad King AuthorDate: Wed Mar 7 12:12:31 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 7 07:12:50 2018 -0500 Merge topic 'autogen-empty-source-file-fix' 50b7be6d1f Autogen: Check if a file is empty before reading it Acked-by: Kitware Robot Merge-request: !1825 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f29bf56724aa8a71ce85b540f6b620454692ade commit 4f29bf56724aa8a71ce85b540f6b620454692ade Merge: 086f84a eb1a9be Author: Brad King AuthorDate: Wed Mar 7 12:11:57 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 7 07:12:02 2018 -0500 Merge topic 'xl-new-compiler-macros' eb1a9be4b6 XL: Recognize compilers identified by __ibmxl__ Acked-by: Kitware Robot Acked-by: Chuck Atkins Merge-request: !1820 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6be53c6695e8d82d3633681f893b79db1de466f0 commit 6be53c6695e8d82d3633681f893b79db1de466f0 Author: Brad King AuthorDate: Thu Mar 1 10:38:15 2018 -0500 Commit: Brad King CommitDate: Mon Mar 5 09:21:32 2018 -0500 CTest: Add options to control test process affinity to CPUs In commit v2.8.0~170 (ENH: Added ctest test options PROCESSORS and RUN_SERIAL, 2009-09-07) CTest learned to track the number of processors allocated to running tests in order to balance it against the desired level of parallelism. Extend this idea by introducing a new `PROCESSOR_AFFINITY` test property to ask that CTest run a test with the CPU affinity mask set. This will allow a set of tests that are running concurrently to use disjoint CPU resources. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d3e58d0..9d4a7e8 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -348,6 +348,7 @@ Properties on Tests /prop_test/LABELS /prop_test/MEASUREMENT /prop_test/PASS_REGULAR_EXPRESSION + /prop_test/PROCESSOR_AFFINITY /prop_test/PROCESSORS /prop_test/REQUIRED_FILES /prop_test/RESOURCE_LOCK diff --git a/Help/prop_test/PROCESSORS.rst b/Help/prop_test/PROCESSORS.rst index a1211fb..a927c10 100644 --- a/Help/prop_test/PROCESSORS.rst +++ b/Help/prop_test/PROCESSORS.rst @@ -2,6 +2,7 @@ PROCESSORS ---------- Set to specify how many process slots this test requires. +If not set, the default is ``1`` processor. Denotes the number of processors that this test will require. This is typically used for MPI tests, and should be used in conjunction with @@ -11,3 +12,5 @@ This will also be used to display a weighted test timing result in label and subproject summaries in the command line output of :manual:`ctest(1)`. The wall clock time for the test run will be multiplied by this property to give a better idea of how much cpu resource CTest allocated for the test. + +See also the :prop_test:`PROCESSOR_AFFINITY` test property. diff --git a/Help/prop_test/PROCESSOR_AFFINITY.rst b/Help/prop_test/PROCESSOR_AFFINITY.rst new file mode 100644 index 0000000..38ec179 --- /dev/null +++ b/Help/prop_test/PROCESSOR_AFFINITY.rst @@ -0,0 +1,11 @@ +PROCESSOR_AFFINITY +------------------ + +Set to a true value to ask CTest to launch the test process with CPU affinity +for a fixed set of processors. If enabled and supported for the current +platform, CTest will choose a set of processors to place in the CPU affinity +mask when launching the test process. The number of processors in the set is +determined by the :prop_test:`PROCESSORS` test property or the number of +processors available to CTest, whichever is smaller. The set of processors +chosen will be disjoint from the processors assigned to other concurrently +running tests that also have the ``PROCESSOR_AFFINITY`` property enabled. diff --git a/Help/release/dev/ctest-affinity.rst b/Help/release/dev/ctest-affinity.rst new file mode 100644 index 0000000..f4f72a5 --- /dev/null +++ b/Help/release/dev/ctest-affinity.rst @@ -0,0 +1,6 @@ +ctest-affinity +-------------- + +* A :prop_test:`PROCESSOR_AFFINITY` test property was added to request + that CTest run a test with CPU affinity for a set of processors + disjoint from other concurrently running tests with the property set. diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a0010a2..e547356 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -131,6 +131,8 @@ set(SRCS LexerParser/cmListFileLexer.c LexerParser/cmListFileLexer.in.l + cmAffinity.cxx + cmAffinity.h cmArchiveWrite.cxx cmBase32.cxx cmCacheManager.cxx diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 50c2d86..99cf551 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestMultiProcessHandler.h" +#include "cmAffinity.h" #include "cmCTest.h" #include "cmCTestRunTest.h" #include "cmCTestScriptHandler.h" @@ -53,6 +54,8 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() this->TestLoad = 0; this->Completed = 0; this->RunningCount = 0; + this->ProcessorsAvailable = cmAffinity::GetProcessorsAvailable(); + this->HaveAffinity = this->ProcessorsAvailable.size(); this->StopTimePassed = false; this->HasCycles = false; this->SerialTestRunning = false; @@ -127,6 +130,21 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) return false; } + if (this->HaveAffinity && this->Properties[test]->WantAffinity) { + size_t needProcessors = this->GetProcessorsUsed(test); + if (needProcessors > this->ProcessorsAvailable.size()) { + return false; + } + std::vector affinity; + affinity.reserve(needProcessors); + for (size_t i = 0; i < needProcessors; ++i) { + auto p = this->ProcessorsAvailable.begin(); + affinity.push_back(*p); + this->ProcessorsAvailable.erase(p); + } + this->Properties[test]->Affinity = std::move(affinity); + } + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "test " << test << "\n", this->Quiet); this->TestRunningMap[test] = true; // mark the test as running @@ -200,6 +218,11 @@ inline size_t cmCTestMultiProcessHandler::GetProcessorsUsed(int test) if (processors > this->ParallelLevel) { processors = this->ParallelLevel; } + // Cap tests that want affinity to the maximum affinity available. + if (this->HaveAffinity && processors > this->HaveAffinity && + this->Properties[test]->WantAffinity) { + processors = this->HaveAffinity; + } return processors; } @@ -398,6 +421,11 @@ void cmCTestMultiProcessHandler::FinishTestProcess(cmCTestRunTest* runner, this->UnlockResources(test); this->RunningCount -= GetProcessorsUsed(test); + for (auto p : properties->Affinity) { + this->ProcessorsAvailable.insert(p); + } + properties->Affinity.clear(); + delete runner; if (started) { this->StartNextTests(); diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 7837ff9..19e1a35 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -119,6 +119,8 @@ protected: // Number of tests that are complete size_t Completed; size_t RunningCount; + std::set ProcessorsAvailable; + size_t HaveAffinity; bool StopTimePassed; // list of test properties (indices concurrent to the test map) PropertiesMap Properties; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 30ad38c..1ae36f7 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -515,7 +515,8 @@ bool cmCTestRunTest::StartTest(size_t total) } return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout, - &this->TestProperties->Environment); + &this->TestProperties->Environment, + &this->TestProperties->Affinity); } void cmCTestRunTest::ComputeArguments() @@ -591,7 +592,8 @@ void cmCTestRunTest::DartProcessing() } bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, - std::vector* environment) + std::vector* environment, + std::vector* affinity) { this->TestProcess = cm::make_unique(*this); this->TestProcess->SetId(this->Index); @@ -637,7 +639,8 @@ bool cmCTestRunTest::ForkProcess(cmDuration testTimeOut, bool explicitTimeout, cmSystemTools::AppendEnv(*environment); } - return this->TestProcess->StartProcess(this->MultiTestHandler.Loop); + return this->TestProcess->StartProcess(this->MultiTestHandler.Loop, + affinity); } void cmCTestRunTest::WriteLogOutputTop(size_t completed, size_t total) diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 4d57357..073af11 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -83,7 +83,8 @@ private: void DartProcessing(); void ExeNotFound(std::string exe); bool ForkProcess(cmDuration testTimeOut, bool explicitTimeout, - std::vector* environment); + std::vector* environment, + std::vector* affinity); void WriteLogOutputTop(size_t completed, size_t total); // Run post processing of the process output for MemCheck void MemCheckPostProcess(); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 84d8926..d1affd4 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2165,6 +2165,9 @@ bool cmCTestTestHandler::SetTestsProperties( rt.Processors = 1; } } + if (key == "PROCESSOR_AFFINITY") { + rt.WantAffinity = cmSystemTools::IsOn(val.c_str()); + } if (key == "SKIP_RETURN_CODE") { rt.SkipReturnCode = atoi(val.c_str()); if (rt.SkipReturnCode < 0 || rt.SkipReturnCode > 255) { @@ -2336,6 +2339,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.ExplicitTimeout = false; test.Cost = 0; test.Processors = 1; + test.WantAffinity = false; test.SkipReturnCode = -1; test.PreviousRuns = 0; if (this->UseIncludeRegExpFlag && diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index f4978b6..d2694a1 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -130,6 +130,8 @@ public: int Index; // Requested number of process slots int Processors; + bool WantAffinity; + std::vector Affinity; // return code of test which will mark test as "not run" int SkipReturnCode; std::vector Environment; diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx index 09ed0a9..5c9b169 100644 --- a/Source/CTest/cmProcess.cxx +++ b/Source/CTest/cmProcess.cxx @@ -83,7 +83,7 @@ void cmProcess::SetCommandArguments(std::vector const& args) this->Arguments = args; } -bool cmProcess::StartProcess(uv_loop_t& loop) +bool cmProcess::StartProcess(uv_loop_t& loop, std::vector* affinity) { this->ProcessState = cmProcess::State::Error; if (this->Command.empty()) { @@ -138,6 +138,22 @@ bool cmProcess::StartProcess(uv_loop_t& loop) options.stdio_count = 3; // in, out and err options.exit_cb = &cmProcess::OnExitCB; options.stdio = stdio; +#if !defined(CMAKE_USE_SYSTEM_LIBUV) + std::vector cpumask; + if (affinity && !affinity->empty()) { + cpumask.resize(static_cast(uv_cpumask_size()), 0); + for (auto p : *affinity) { + cpumask[p] = 1; + } + options.cpumask = cpumask.data(); + options.cpumask_size = cpumask.size(); + } else { + options.cpumask = nullptr; + options.cpumask_size = 0; + } +#else + static_cast(affinity); +#endif status = uv_read_start(pipe_reader, &cmProcess::OnAllocateCB, &cmProcess::OnReadCB); diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 20e24b9..b2d87fa 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -36,7 +36,7 @@ public: void ChangeTimeout(cmDuration t); void ResetStartTime(); // Return true if the process starts - bool StartProcess(uv_loop_t& loop); + bool StartProcess(uv_loop_t& loop, std::vector* affinity); enum class State { diff --git a/Source/cmAffinity.cxx b/Source/cmAffinity.cxx new file mode 100644 index 0000000..bdf1f42 --- /dev/null +++ b/Source/cmAffinity.cxx @@ -0,0 +1,62 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmAffinity.h" + +#include "cm_uv.h" + +#ifndef CMAKE_USE_SYSTEM_LIBUV +#ifdef _WIN32 +#define CM_HAVE_CPU_AFFINITY +#include +#elif defined(__linux__) || defined(__FreeBSD__) +#define CM_HAVE_CPU_AFFINITY +#include +#include +#if defined(__FreeBSD__) +#include +#include +#include +#endif +#if defined(__linux__) +typedef cpu_set_t cm_cpuset_t; +#else +typedef cpuset_t cm_cpuset_t; +#endif +#endif +#endif + +namespace cmAffinity { + +std::set GetProcessorsAvailable() +{ + std::set processorsAvailable; +#ifdef CM_HAVE_CPU_AFFINITY + int cpumask_size = uv_cpumask_size(); + if (cpumask_size > 0) { +#ifdef _WIN32 + DWORD_PTR procmask; + DWORD_PTR sysmask; + if (GetProcessAffinityMask(GetCurrentProcess(), &procmask, &sysmask) != + 0) { + for (int i = 0; i < cpumask_size; ++i) { + if (procmask & (((DWORD_PTR)1) << i)) { + processorsAvailable.insert(i); + } + } + } +#else + cm_cpuset_t cpuset; + CPU_ZERO(&cpuset); // NOLINT(clang-tidy) + if (pthread_getaffinity_np(pthread_self(), sizeof(cpuset), &cpuset) == 0) { + for (int i = 0; i < cpumask_size; ++i) { + if (CPU_ISSET(i, &cpuset)) { + processorsAvailable.insert(i); + } + } + } +#endif + } +#endif + return processorsAvailable; +} +} diff --git a/Source/cmAffinity.h b/Source/cmAffinity.h new file mode 100644 index 0000000..3775bae --- /dev/null +++ b/Source/cmAffinity.h @@ -0,0 +1,12 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once +#include "cmConfigure.h" // IWYU pragma: keep + +#include +#include + +namespace cmAffinity { + +std::set GetProcessorsAvailable(); +} diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt index 06df53f..126076d 100644 --- a/Tests/CMakeLib/CMakeLists.txt +++ b/Tests/CMakeLib/CMakeLists.txt @@ -49,3 +49,6 @@ if(TEST_CompileCommandOutput) endif() add_subdirectory(PseudoMemcheck) + +add_executable(testAffinity testAffinity.cxx) +target_link_libraries(testAffinity CMakeLib) diff --git a/Tests/CMakeLib/testAffinity.cxx b/Tests/CMakeLib/testAffinity.cxx new file mode 100644 index 0000000..4b82280 --- /dev/null +++ b/Tests/CMakeLib/testAffinity.cxx @@ -0,0 +1,18 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmAffinity.h" + +#include +#include +#include + +int main() +{ + std::set cpus = cmAffinity::GetProcessorsAvailable(); + if (!cpus.empty()) { + std::cout << "CPU affinity mask count is '" << cpus.size() << "'.\n"; + } else { + std::cout << "CPU affinity not supported on this platform.\n"; + } + return 0; +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 31069fa..beadb1d 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -339,6 +339,9 @@ add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) add_RunCMake_test(FetchContent) +if(NOT CMake_TEST_EXTERNAL_CMAKE) + set(CTestCommandLine_ARGS -DTEST_AFFINITY=$) +endif() add_RunCMake_test(CTestCommandLine) add_RunCMake_test(CacheNewline) # Only run this test on unix platforms that support diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index 0fafea5..3033c9c 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -141,3 +141,23 @@ function(run_TestOutputSize) ) endfunction() run_TestOutputSize() + +function(run_TestAffinity) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestAffinity) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + # Create a test with affinity enabled. The default PROCESSORS + # value is 1, so our expected output checks that this is the + # number of processors in the mask. + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(Affinity \"${TEST_AFFINITY}\") + set_tests_properties(Affinity PROPERTIES PROCESSOR_AFFINITY ON) +") + # Run ctest with a large parallel level so that the value is + # not responsible for capping the number of processors available. + run_cmake_command(TestAffinity ${CMAKE_CTEST_COMMAND} -V -j 64) +endfunction() +if(TEST_AFFINITY) + run_TestAffinity() +endif() diff --git a/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt new file mode 100644 index 0000000..e23d30b --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt @@ -0,0 +1 @@ +1: CPU affinity (mask count is '1'|not supported on this platform)\. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c5428d8db2aebb215b418d72eae99f4a106a82b0 commit c5428d8db2aebb215b418d72eae99f4a106a82b0 Author: Brad King AuthorDate: Mon Mar 5 09:18:53 2018 -0500 Commit: Brad King CommitDate: Mon Mar 5 09:21:31 2018 -0500 libuv: disable process affinity during CMake bootstrap Avoid depending on platform-specific pthread features during bootstrap. diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c index d7b6ad3..47ab1dc 100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@ -45,6 +45,7 @@ extern char **environ; # include #endif +#ifndef CMAKE_BOOTSTRAP #if defined(__linux__) # define uv__cpu_set_t cpu_set_t #elif defined(__FreeBSD__) @@ -53,6 +54,7 @@ extern char **environ; # include # define uv__cpu_set_t cpuset_t #endif +#endif static void uv__chld(uv_signal_t* handle, int signum) { uv_process_t* process; @@ -294,12 +296,14 @@ static void uv__process_child_init(const uv_process_options_t* options, int err; int fd; int n; +#ifndef CMAKE_BOOTSTRAP #if defined(__linux__) || defined(__FreeBSD__) int r; int i; int cpumask_size; uv__cpu_set_t cpuset; #endif +#endif if (options->flags & UV_PROCESS_DETACHED) setsid(); @@ -390,6 +394,7 @@ static void uv__process_child_init(const uv_process_options_t* options, _exit(127); } +#ifndef CMAKE_BOOTSTRAP #if defined(__linux__) || defined(__FreeBSD__) if (options->cpumask != NULL) { cpumask_size = uv_cpumask_size(); @@ -409,6 +414,7 @@ static void uv__process_child_init(const uv_process_options_t* options, } } #endif +#endif if (options->env != NULL) { environ = options->env; @@ -465,6 +471,7 @@ int uv_spawn(uv_loop_t* loop, int status; if (options->cpumask != NULL) { +#ifndef CMAKE_BOOTSTRAP #if defined(__linux__) || defined(__FreeBSD__) if (options->cpumask_size < (size_t)uv_cpumask_size()) { return UV_EINVAL; @@ -472,6 +479,9 @@ int uv_spawn(uv_loop_t* loop, #else return UV_ENOTSUP; #endif +#else + return UV_ENOTSUP; +#endif } assert(options->file != NULL); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=24de561a1a7529b919215edb0322279449c5e6c0 commit 24de561a1a7529b919215edb0322279449c5e6c0 Author: Brad King AuthorDate: Wed Sep 6 15:01:50 2017 -0400 Commit: Brad King CommitDate: Mon Mar 5 09:21:31 2018 -0500 libuv: unix,win: add uv_spawn option to set child CPU affinity mask Implement it on Linux, FreeBSD, and Windows for now, and fail with UV_ENOTSUP on other platforms. Backported from upstream libuv PR 1527, scheduled for inclusion in libuv 2.0. diff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h index a2ba487..875e30a 100644 --- a/Utilities/cmlibuv/include/uv.h +++ b/Utilities/cmlibuv/include/uv.h @@ -925,6 +925,19 @@ typedef struct uv_process_options_s { */ uv_uid_t uid; uv_gid_t gid; + /* + Libuv can set the child process' CPU affinity mask. This happens when + `cpumask` is non-NULL. It must point to an array of char values + of length `cpumask_size`, whose value must be at least that returned by + uv_cpumask_size(). Each byte in the mask can be either zero (false) + or non-zero (true) to indicate whether the corresponding processor at + that index is included. + + If enabled on an unsupported platform, uv_spawn() will fail with + UV_ENOTSUP. + */ + char* cpumask; + size_t cpumask_size; } uv_process_options_t; /* diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c index 9842710..d7b6ad3 100644 --- a/Utilities/cmlibuv/src/unix/process.c +++ b/Utilities/cmlibuv/src/unix/process.c @@ -32,6 +32,7 @@ #include #include #include +#include #if defined(__APPLE__) && !TARGET_OS_IPHONE # include @@ -44,6 +45,14 @@ extern char **environ; # include #endif +#if defined(__linux__) +# define uv__cpu_set_t cpu_set_t +#elif defined(__FreeBSD__) +# include +# include +# include +# define uv__cpu_set_t cpuset_t +#endif static void uv__chld(uv_signal_t* handle, int signum) { uv_process_t* process; @@ -285,6 +294,12 @@ static void uv__process_child_init(const uv_process_options_t* options, int err; int fd; int n; +#if defined(__linux__) || defined(__FreeBSD__) + int r; + int i; + int cpumask_size; + uv__cpu_set_t cpuset; +#endif if (options->flags & UV_PROCESS_DETACHED) setsid(); @@ -375,6 +390,26 @@ static void uv__process_child_init(const uv_process_options_t* options, _exit(127); } +#if defined(__linux__) || defined(__FreeBSD__) + if (options->cpumask != NULL) { + cpumask_size = uv_cpumask_size(); + assert(options->cpumask_size >= (size_t)cpumask_size); + + CPU_ZERO(&cpuset); + for (i = 0; i < cpumask_size; ++i) { + if (options->cpumask[i]) { + CPU_SET(i, &cpuset); + } + } + + r = -pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset); + if (r != 0) { + uv__write_int(error_fd, r); + _exit(127); + } + } +#endif + if (options->env != NULL) { environ = options->env; } @@ -429,6 +464,16 @@ int uv_spawn(uv_loop_t* loop, int i; int status; + if (options->cpumask != NULL) { +#if defined(__linux__) || defined(__FreeBSD__) + if (options->cpumask_size < (size_t)uv_cpumask_size()) { + return UV_EINVAL; + } +#else + return UV_ENOTSUP; +#endif + } + assert(options->file != NULL); assert(!(options->flags & ~(UV_PROCESS_DETACHED | UV_PROCESS_SETGID | diff --git a/Utilities/cmlibuv/src/win/process.c b/Utilities/cmlibuv/src/win/process.c index cc06d9e..f5f05af 100644 --- a/Utilities/cmlibuv/src/win/process.c +++ b/Utilities/cmlibuv/src/win/process.c @@ -954,6 +954,12 @@ int uv_spawn(uv_loop_t* loop, return UV_EINVAL; } + if (options->cpumask != NULL) { + if (options->cpumask_size < (size_t)uv_cpumask_size()) { + return UV_EINVAL; + } + } + assert(options->file != NULL); assert(!(options->flags & ~(UV_PROCESS_DETACHED | UV_PROCESS_SETGID | @@ -1084,6 +1090,12 @@ int uv_spawn(uv_loop_t* loop, process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP; } + if (options->cpumask != NULL) { + /* Create the child in a suspended state so we have a chance to set + its process affinity before it runs. */ + process_flags |= CREATE_SUSPENDED; + } + if (!CreateProcessW(application_path, arguments, NULL, @@ -1099,6 +1111,50 @@ int uv_spawn(uv_loop_t* loop, goto done; } + if (options->cpumask != NULL) { + /* The child is currently suspended. Set its process affinity + or terminate it if we can't. */ + int i; + int cpumasksize; + DWORD_PTR sysmask; + DWORD_PTR oldmask; + DWORD_PTR newmask; + + cpumasksize = uv_cpumask_size(); + + if (!GetProcessAffinityMask(info.hProcess, &oldmask, &sysmask)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + + newmask = 0; + for (i = 0; i < cpumasksize; i++) { + if (options->cpumask[i]) { + if (oldmask & (((DWORD_PTR)1) << i)) { + newmask |= ((DWORD_PTR)1) << i; + } else { + err = UV_EINVAL; + TerminateProcess(info.hProcess, 1); + goto done; + } + } + } + + if (!SetProcessAffinityMask(info.hProcess, newmask)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + + /* The process affinity of the child is set. Let it run. */ + if (ResumeThread(info.hThread) == ((DWORD)-1)) { + err = GetLastError(); + TerminateProcess(info.hProcess, 1); + goto done; + } + } + /* Spawn succeeded */ /* Beyond this point, failure is reported asynchronously. */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43d6e5a71f7cb68578c72ece1cb5046b929ebdc0 commit 43d6e5a71f7cb68578c72ece1cb5046b929ebdc0 Author: Brad King AuthorDate: Wed Sep 6 15:01:17 2017 -0400 Commit: Brad King CommitDate: Mon Mar 5 09:21:31 2018 -0500 libuv: misc: add function to get CPU affinity mask size Implement it on Linux, FreeBSD, and Windows for now, and return UV_ENOTSUP on other platforms. Backported from upstream libuv PR 1527, scheduled for inclusion in libuv 2.0. diff --git a/Utilities/cmlibuv/include/uv.h b/Utilities/cmlibuv/include/uv.h index 328ce9e..a2ba487 100644 --- a/Utilities/cmlibuv/include/uv.h +++ b/Utilities/cmlibuv/include/uv.h @@ -1094,6 +1094,7 @@ UV_EXTERN uv_pid_t uv_os_getppid(void); UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count); UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count); +UV_EXTERN int uv_cpumask_size(void); UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses, int* count); diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c index c7e431e..faaf697 100644 --- a/Utilities/cmlibuv/src/unix/core.c +++ b/Utilities/cmlibuv/src/unix/core.c @@ -40,6 +40,7 @@ #include /* writev */ #include /* getrusage */ #include +#include #ifdef __sun # include /* MAXHOSTNAMELEN on Solaris */ @@ -63,6 +64,8 @@ # include # include # include +# include +# include # define UV__O_CLOEXEC O_CLOEXEC # if defined(__FreeBSD__) && __FreeBSD__ >= 10 # define uv__accept4 accept4 @@ -1340,6 +1343,15 @@ int uv_os_gethostname(char* buffer, size_t* size) { } +int uv_cpumask_size(void) { +#if defined(__linux__) || defined(__FreeBSD__) + return CPU_SETSIZE; +#else + return UV_ENOTSUP; +#endif +} + + uv_os_fd_t uv_get_osfhandle(int fd) { return fd; } diff --git a/Utilities/cmlibuv/src/win/core.c b/Utilities/cmlibuv/src/win/core.c index 9ed4e82..8d121b3 100644 --- a/Utilities/cmlibuv/src/win/core.c +++ b/Utilities/cmlibuv/src/win/core.c @@ -603,3 +603,7 @@ int uv__socket_sockopt(uv_handle_t* handle, int optname, int* value) { return 0; } + +int uv_cpumask_size(void) { + return (int)(sizeof(DWORD_PTR) * 8); +} ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-properties.7.rst | 1 + Help/prop_test/PROCESSORS.rst | 3 + Help/prop_test/PROCESSOR_AFFINITY.rst | 11 ++++ Help/release/dev/ctest-affinity.rst | 6 ++ .../IBMCPP-C-DetermineVersionInternal.cmake | 16 +++-- .../IBMCPP-CXX-DetermineVersionInternal.cmake | 16 +++-- Modules/Compiler/XL-C-DetermineCompiler.cmake | 2 +- Modules/Compiler/XL-CXX-DetermineCompiler.cmake | 2 +- Source/CMakeLists.txt | 2 + Source/CTest/cmCTestMultiProcessHandler.cxx | 28 +++++++++ Source/CTest/cmCTestMultiProcessHandler.h | 2 + Source/CTest/cmCTestRunTest.cxx | 9 ++- Source/CTest/cmCTestRunTest.h | 3 +- Source/CTest/cmCTestTestHandler.cxx | 4 ++ Source/CTest/cmCTestTestHandler.h | 2 + Source/CTest/cmProcess.cxx | 18 +++++- Source/CTest/cmProcess.h | 2 +- Source/cmAffinity.cxx | 62 ++++++++++++++++++++ Source/cmAffinity.h | 12 ++++ Source/cmQtAutoGenerator.cxx | 29 +++++---- Tests/CMakeLib/CMakeLists.txt | 3 + Tests/CMakeLib/testAffinity.cxx | 18 ++++++ Tests/RunCMake/CMakeLists.txt | 3 + Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake | 20 +++++++ .../CTestCommandLine/TestAffinity-stdout.txt | 1 + Utilities/cmlibuv/include/uv.h | 14 +++++ Utilities/cmlibuv/src/unix/core.c | 12 ++++ Utilities/cmlibuv/src/unix/process.c | 55 +++++++++++++++++ Utilities/cmlibuv/src/win/core.c | 4 ++ Utilities/cmlibuv/src/win/process.c | 56 ++++++++++++++++++ 30 files changed, 389 insertions(+), 27 deletions(-) create mode 100644 Help/prop_test/PROCESSOR_AFFINITY.rst create mode 100644 Help/release/dev/ctest-affinity.rst create mode 100644 Source/cmAffinity.cxx create mode 100644 Source/cmAffinity.h create mode 100644 Tests/CMakeLib/testAffinity.cxx create mode 100644 Tests/RunCMake/CTestCommandLine/TestAffinity-stdout.txt hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 7 07:15:12 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 7 Mar 2018 07:15:12 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc2-4-g8070abf Message-ID: <20180307121512.7EE431030F2@public.kitware.com> 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, release has been updated via 8070abf784e0b12fdc5dfbafecdbe604f96c44a9 (commit) via 50b7be6d1f2022483cb75a5347a1e1a70a2994e0 (commit) via 566f8fa2f3bee5bf24902bcc125535435e6a9599 (commit) via eb1a9be4b63a807759ba81e4057219e1d6960eac (commit) from ac925ec09e2dd4b373353d312e9e50b6165a66d0 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: .../IBMCPP-C-DetermineVersionInternal.cmake | 16 ++++++++--- .../IBMCPP-CXX-DetermineVersionInternal.cmake | 16 ++++++++--- Modules/Compiler/XL-C-DetermineCompiler.cmake | 2 +- Modules/Compiler/XL-CXX-DetermineCompiler.cmake | 2 +- Source/cmQtAutoGenerator.cxx | 29 ++++++++++++-------- 5 files changed, 44 insertions(+), 21 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 7 08:35:11 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 7 Mar 2018 08:35:11 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-154-g9ceafdf Message-ID: <20180307133511.6A30710ABBE@public.kitware.com> 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, master has been updated via 9ceafdfd4deec57c3a7f8650b2466da1d0aa0d3f (commit) via e3cd7c1e014aa48b72d414104b9c1bd6bc03fd64 (commit) via b4c539e6511110e893416467a77c36ec7ebef81d (commit) via 7dd8c7a680f409fdb1d78138e20fa9b80206431a (commit) from 29b41babdb78b5e305ed9fc6b84dd69c1795dc69 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ceafdfd4deec57c3a7f8650b2466da1d0aa0d3f commit 9ceafdfd4deec57c3a7f8650b2466da1d0aa0d3f Merge: 29b41ba e3cd7c1 Author: Brad King AuthorDate: Wed Mar 7 13:33:18 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 7 08:33:33 2018 -0500 Merge topic 'FindOpenMP-AppleClang' e3cd7c1e01 FindOpenMP: Add support for AppleClang compiler b4c539e651 FindOpenMP: Verify in test source that OMP library is linked 7dd8c7a680 FindOpenMP: Improve inclusion of helper modules Acked-by: Kitware Robot Merge-request: !1812 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e3cd7c1e014aa48b72d414104b9c1bd6bc03fd64 commit e3cd7c1e014aa48b72d414104b9c1bd6bc03fd64 Author: Henry Fredrick Schreiner AuthorDate: Thu Mar 1 12:35:38 2018 +0100 Commit: Brad King CommitDate: Wed Mar 7 08:27:35 2018 -0500 FindOpenMP: Add support for AppleClang compiler This is possible using an external `omp` library and by passing the flag past the compiler driver via `-Xclang -fopenmp`. Fixes: #17775 diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 95e5cdc..e252ba5 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -85,6 +85,7 @@ function(_OPENMP_FLAG_CANDIDATES LANG) set(OMP_FLAG_GNU "-fopenmp") set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp") + set(OMP_FLAG_AppleClang "-Xclang -fopenmp") set(OMP_FLAG_HP "+Oopenmp") if(WIN32) set(OMP_FLAG_Intel "-Qopenmp") @@ -256,6 +257,28 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) endif() endif() break() + elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "AppleClang" + AND CMAKE_${LANG}_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") + + # Check for separate OpenMP library on AppleClang 7+ + find_library(OpenMP_libomp_LIBRARY + NAMES omp gomp iomp5 + HINTS ${CMAKE_${LANG}_IMPLICIT_LINK_DIRECTORIES} + ) + mark_as_advanced(OpenMP_libomp_LIBRARY) + + if(OpenMP_libomp_LIBRARY) + try_compile( OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG} ${CMAKE_BINARY_DIR} ${_OPENMP_TEST_SRC} + CMAKE_FLAGS "-DCOMPILE_DEFINITIONS:STRING=${OPENMP_FLAGS_TEST}" + LINK_LIBRARIES ${CMAKE_${LANG}_VERBOSE_FLAG} ${OpenMP_libomp_LIBRARY} + OUTPUT_VARIABLE OpenMP_TRY_COMPILE_OUTPUT + ) + if(OpenMP_COMPILE_RESULT_${FLAG_MODE}_${OPENMP_PLAIN_FLAG}) + set("${OPENMP_FLAG_VAR}" "${OPENMP_FLAG}" PARENT_SCOPE) + set("${OPENMP_LIB_NAMES_VAR}" "libomp" PARENT_SCOPE) + break() + endif() + endif() endif() set("${OPENMP_LIB_NAMES_VAR}" "NOTFOUND" PARENT_SCOPE) set("${OPENMP_FLAG_VAR}" "NOTFOUND" PARENT_SCOPE) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b4c539e6511110e893416467a77c36ec7ebef81d commit b4c539e6511110e893416467a77c36ec7ebef81d Author: Henry Fredrick Schreiner AuthorDate: Thu Mar 1 12:35:38 2018 +0100 Commit: Brad King CommitDate: Wed Mar 7 08:25:45 2018 -0500 FindOpenMP: Verify in test source that OMP library is linked diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 3f8f61a..95e5cdc 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -125,6 +125,7 @@ set(OpenMP_C_CXX_TEST_SOURCE #include int main() { #ifdef _OPENMP + int n = omp_get_max_threads(); return 0; #else breaks_on_purpose https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7dd8c7a680f409fdb1d78138e20fa9b80206431a commit 7dd8c7a680f409fdb1d78138e20fa9b80206431a Author: Henry Fredrick Schreiner AuthorDate: Thu Mar 1 12:35:38 2018 +0100 Commit: Brad King CommitDate: Wed Mar 7 08:24:27 2018 -0500 FindOpenMP: Improve inclusion of helper modules Use `CMAKE_CURRENT_LIST_DIR` instead of `CMAKE_ROOT`. Do not include modules inside a loop. diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index ced092e..3f8f61a 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -163,7 +163,7 @@ function(_OPENMP_WRITE_SOURCE_FILE LANG SRC_FILE_CONTENT_VAR SRC_FILE_NAME SRC_F set(${SRC_FILE_FULLPATH} "${SRC_FILE}" PARENT_SCOPE) endfunction() -include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseImplicitLinkInfo.cmake) function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR) _OPENMP_FLAG_CANDIDATES("${LANG}") @@ -423,6 +423,8 @@ endif() unset(_OpenMP_MIN_VERSION) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + foreach(LANG IN LISTS OpenMP_FINDLIST) if(CMAKE_${LANG}_COMPILER_LOADED) if (NOT OpenMP_${LANG}_SPEC_DATE AND OpenMP_${LANG}_FLAGS) @@ -432,8 +434,6 @@ foreach(LANG IN LISTS OpenMP_FINDLIST) _OPENMP_SET_VERSION_BY_SPEC_DATE("${LANG}") endif() - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - set(OpenMP_${LANG}_FIND_QUIETLY ${OpenMP_FIND_QUIETLY}) set(OpenMP_${LANG}_FIND_REQUIRED ${OpenMP_FIND_REQUIRED}) set(OpenMP_${LANG}_FIND_VERSION ${OpenMP_FIND_VERSION}) ----------------------------------------------------------------------- Summary of changes: Modules/FindOpenMP.cmake | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 8 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 8 Mar 2018 00:05:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-155-g458fc1d Message-ID: <20180308050505.4C00410AD13@public.kitware.com> 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, master has been updated via 458fc1de49184a975019a18b5ae54eee373e4b13 (commit) from 9ceafdfd4deec57c3a7f8650b2466da1d0aa0d3f (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=458fc1de49184a975019a18b5ae54eee373e4b13 commit 458fc1de49184a975019a18b5ae54eee373e4b13 Author: Kitware Robot AuthorDate: Thu Mar 8 00:01:12 2018 -0500 Commit: Kitware Robot CommitDate: Thu Mar 8 00:01:12 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index df45cf6..9b2957f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180307) +set(CMake_VERSION_PATCH 20180308) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 8 09:55:17 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 8 Mar 2018 09:55:17 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-164-g4f99809 Message-ID: <20180308145517.4336B10A82E@public.kitware.com> 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, master has been updated via 4f99809b719f05461e6f9719d2874d5d96890ca2 (commit) via ca2ac4979d55d550fa707721b484a2bd611cd057 (commit) via 69b152967d58fbe0aae5d873fffcc7cc2156364b (commit) via 57f35bba84f53300641c6a597b4eca728f02874a (commit) via f64732f59b5e7a7b5046119e6997ea885d0e0d05 (commit) via 9288abf567451c98e97c00d5ccc928e97794b1e6 (commit) via 2c5b4359f80f7e0ef5442784ca55a42b6c2bdd17 (commit) via 64d4308d8347150d072c2f11f9dd557ccaa1dfb2 (commit) from 458fc1de49184a975019a18b5ae54eee373e4b13 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4f99809b719f05461e6f9719d2874d5d96890ca2 commit 4f99809b719f05461e6f9719d2874d5d96890ca2 Merge: ca2ac49 57f35bb Author: Brad King AuthorDate: Thu Mar 8 09:51:39 2018 -0500 Commit: Brad King CommitDate: Thu Mar 8 09:51:39 2018 -0500 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ca2ac4979d55d550fa707721b484a2bd611cd057 commit ca2ac4979d55d550fa707721b484a2bd611cd057 Merge: 69b1529 2c5b435 Author: Brad King AuthorDate: Thu Mar 8 14:48:16 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:50:19 2018 -0500 Merge topic 'update-kwsys' 2c5b4359f8 Merge branch 'upstream-KWSys' into update-kwsys 64d4308d83 KWSys 2018-03-07 (2ad561e7) Acked-by: Kitware Robot Merge-request: !1830 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69b152967d58fbe0aae5d873fffcc7cc2156364b commit 69b152967d58fbe0aae5d873fffcc7cc2156364b Merge: 458fc1d f64732f Author: Brad King AuthorDate: Thu Mar 8 14:48:01 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:48:28 2018 -0500 Merge topic 'cuda-no-device-link-rsp' f64732f59b CUDA: Do not pass unsupported @rspfile arguments to NVCC Acked-by: Kitware Robot Merge-request: !1831 ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/NVIDIA-CUDA.cmake | 6 ++++++ Source/kwsys/CMakeLists.txt | 4 ++-- Source/kwsys/SystemInformation.cxx | 6 +++++- Source/kwsys/SystemTools.cxx | 30 +++++++++++++++++------------- Source/kwsys/SystemTools.hxx.in | 1 + 5 files changed, 31 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 8 09:55:17 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 8 Mar 2018 09:55:17 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc2-10-g57f35bb Message-ID: <20180308145517.567BB10A837@public.kitware.com> 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, release has been updated via 57f35bba84f53300641c6a597b4eca728f02874a (commit) via f64732f59b5e7a7b5046119e6997ea885d0e0d05 (commit) via 9288abf567451c98e97c00d5ccc928e97794b1e6 (commit) via 2c5b4359f80f7e0ef5442784ca55a42b6c2bdd17 (commit) via 64d4308d8347150d072c2f11f9dd557ccaa1dfb2 (commit) from 8070abf784e0b12fdc5dfbafecdbe604f96c44a9 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/NVIDIA-CUDA.cmake | 6 ++++++ Source/kwsys/CMakeLists.txt | 4 ++-- Source/kwsys/SystemInformation.cxx | 6 +++++- Source/kwsys/SystemTools.cxx | 30 +++++++++++++++++------------- Source/kwsys/SystemTools.hxx.in | 1 + 5 files changed, 31 insertions(+), 16 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 8 10:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 8 Mar 2018 10:05:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-178-g156a959 Message-ID: <20180308150508.EEB4210ADE7@public.kitware.com> 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, master has been updated via 156a959410cfbd33c648e7b8993d32fd8f9af00a (commit) via 50b2d0c94434f4b250f0a5add855b28edb1df300 (commit) via 1076ac9d6864a31c5d57d0d1b2f4ab9a08888107 (commit) via 151763c9b2b5a1c76fc2acd31e284eca6940bded (commit) via f0b412dd82b8d45f1544961ecec618ebf877812d (commit) via 32f6b7a43b492af0b78cc20d4c16315e41a4895c (commit) via 694fce19b64cd5a399921d823ef2db9a07d4018a (commit) via ee06f3c339e0f90e9a61891d3ad8c71a4286d504 (commit) via 59d8cfb85ec964c98ca2c1d6b262d5b26f484c88 (commit) via 7723e9a058c579e3535df9bbe62ea218200e4250 (commit) via 83c0cb3f0328504baf425704803c2ae83942cb86 (commit) via 2124a1364a620084c24d5654c2106e5aea88c55c (commit) via 1c5bfab532e96bc728691a15b092d388a9e0a0d5 (commit) via 910a9d608e31a3446d0cbb86eb78917cc04b1a64 (commit) from 4f99809b719f05461e6f9719d2874d5d96890ca2 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=156a959410cfbd33c648e7b8993d32fd8f9af00a commit 156a959410cfbd33c648e7b8993d32fd8f9af00a Merge: 50b2d0c 694fce1 Author: Brad King AuthorDate: Thu Mar 8 14:58:25 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:58:56 2018 -0500 Merge topic 'FindGDAL-absolute-path' 694fce19b6 FindGDAL: Handle gdal-config printing absolute path to library Acked-by: Kitware Robot Merge-request: !1808 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50b2d0c94434f4b250f0a5add855b28edb1df300 commit 50b2d0c94434f4b250f0a5add855b28edb1df300 Merge: 1076ac9 32f6b7a Author: Brad King AuthorDate: Thu Mar 8 14:57:53 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:58:19 2018 -0500 Merge topic 'misc-typos' 32f6b7a43b Fix misc typos in documentation and comments Acked-by: Kitware Robot Merge-request: !1826 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1076ac9d6864a31c5d57d0d1b2f4ab9a08888107 commit 1076ac9d6864a31c5d57d0d1b2f4ab9a08888107 Merge: 151763c 59d8cfb Author: Brad King AuthorDate: Thu Mar 8 14:57:34 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:57:44 2018 -0500 Merge topic 'vs10-xmlmacros' 59d8cfb85e cmVisualStudio10TargetGenerator: Use helpers for XML tags Acked-by: Kitware Robot Merge-request: !1813 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=151763c9b2b5a1c76fc2acd31e284eca6940bded commit 151763c9b2b5a1c76fc2acd31e284eca6940bded Merge: f0b412d ee06f3c Author: Brad King AuthorDate: Thu Mar 8 14:56:14 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:56:40 2018 -0500 Merge topic 'curl-target' ee06f3c339 FindCURL: Revise documentation markup 83c0cb3f03 FindCURL: provide imported target CURL::CURL Acked-by: Kitware Robot Merge-request: !1822 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f0b412dd82b8d45f1544961ecec618ebf877812d commit f0b412dd82b8d45f1544961ecec618ebf877812d Merge: 4f99809 7723e9a Author: Brad King AuthorDate: Thu Mar 8 14:54:38 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 09:55:09 2018 -0500 Merge topic 'avoid-LIB_DEPENDS' 7723e9a058 Do not produce legacy _LIB_DEPENDS cache entries 2124a1364a cmTarget: Remove unnecessary RecordDependencies member 1c5bfab532 cmTarget: Simplify ClearDependencyInformation implementation 910a9d608e cmTarget: Simplify ClearDependencyInformation signature Acked-by: Kitware Robot Acked-by: Pavel Solodovnikov Merge-request: !1828 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=32f6b7a43b492af0b78cc20d4c16315e41a4895c commit 32f6b7a43b492af0b78cc20d4c16315e41a4895c Author: luz.paz AuthorDate: Tue Mar 6 11:08:38 2018 -0500 Commit: Brad King CommitDate: Wed Mar 7 10:54:46 2018 -0500 Fix misc typos in documentation and comments diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index 18d1871..5bc4395 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -126,7 +126,7 @@ # .. variable:: CPACK_NSIS_MENU_LINKS # # Specify links in [application] menu. This should contain a list of pair -# "link" "link name". The link may be an URL or a path relative to +# "link" "link name". The link may be a URL or a path relative to # installation prefix. Like:: # # set(CPACK_NSIS_MENU_LINKS diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index e0bffd4..5fff730 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -527,7 +527,7 @@ int cmCTestScriptHandler::RunConfigurationScript( return result; } - // only run the curent script if we should + // only run the current script if we should if (this->Makefile && this->Makefile->IsOn("CTEST_RUN_CURRENT_SCRIPT") && this->ShouldRunCurrentScript) { return this->RunCurrentScript(); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 673a40e..b2f4f25 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -347,7 +347,7 @@ public: const std::string& cmake_var, bool suppress = false); - /** Make string safe to be send as an URL */ + /** Make string safe to be sent as a URL */ static std::string MakeURLSafe(const std::string&); /** Decode a URL to the original string. */ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=694fce19b64cd5a399921d823ef2db9a07d4018a commit 694fce19b64cd5a399921d823ef2db9a07d4018a Author: Adam Thompson AuthorDate: Tue Feb 27 21:08:20 2018 -0500 Commit: Adam Thompson CommitDate: Wed Mar 7 09:29:57 2018 -0500 FindGDAL: Handle gdal-config printing absolute path to library FindGDAL uses GDAL's 'gdal-config' utility to obtain the path to GDAL's library (on systems identified by CMake's UNIX variable). Older versions formatted this information like that of dependent libraries: -L/path/to/gdal/lib -lgdal[suffix] Newer versions instead provide the full path to the library: /path/to/gdal/lib/[prefix]gdal[suffix] FindGDAL now supports both formats. Entries that don't start with '-L' or '-l' are only considered if they are absolute paths that exist on disk. Furthermore, libraries are only considered if the name contains 'gdal' (checked case-insensitively). diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 2b940b0..ff2976e 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -66,11 +66,49 @@ if(UNIX) if(GDAL_CONFIG) exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS) + if(GDAL_CONFIG_LIBS) - string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS}) - string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}") - string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS}) - string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}") + # treat the output as a command line and split it up + separate_arguments(args NATIVE_COMMAND "${GDAL_CONFIG_LIBS}") + + # only consider libraries whose name matches this pattern + set(name_pattern "[gG][dD][aA][lL]") + + # consider each entry as a possible library path, name, or parent directory + foreach(arg IN LISTS args) + # library name + if("${arg}" MATCHES "^-l(.*)$") + set(lib "${CMAKE_MATCH_1}") + + # only consider libraries whose name matches the expected pattern + if("${lib}" MATCHES "${name_pattern}") + list(APPEND _gdal_lib "${lib}") + endif() + # library search path + elseif("${arg}" MATCHES "^-L(.*)$") + list(APPEND _gdal_libpath "${CMAKE_MATCH_1}") + # assume this is a full path to a library + elseif(IS_ABSOLUTE "${arg}" AND EXISTS "${arg}") + # extract the file name + get_filename_component(lib "${arg}" NAME) + + # only consider libraries whose name matches the expected pattern + if(NOT "${lib}" MATCHES "${name_pattern}") + continue() + endif() + + # extract the file directory + get_filename_component(dir "${arg}" DIRECTORY) + + # remove library prefixes/suffixes + string(REGEX REPLACE "^(${CMAKE_SHARED_LIBRARY_PREFIX}|${CMAKE_STATIC_LIBRARY_PREFIX})" "" lib "${lib}") + string(REGEX REPLACE "(${CMAKE_SHARED_LIBRARY_SUFFIX}|${CMAKE_STATIC_LIBRARY_SUFFIX})$" "" lib "${lib}") + + # use the file name and directory as hints + list(APPEND _gdal_libpath "${dir}") + list(APPEND _gdal_lib "${lib}") + endif() + endforeach() endif() endif() endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee06f3c339e0f90e9a61891d3ad8c71a4286d504 commit ee06f3c339e0f90e9a61891d3ad8c71a4286d504 Author: Brad King AuthorDate: Wed Mar 7 09:06:01 2018 -0500 Commit: Brad King CommitDate: Wed Mar 7 09:06:01 2018 -0500 FindCURL: Revise documentation markup diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 1d969a8..e66ae92 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -5,7 +5,7 @@ # FindCURL # -------- # -# Find curl +# Find the native CURL headers and libraries. # # IMPORTED Targets # ^^^^^^^^^^^^^^^^ @@ -13,14 +13,22 @@ # This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if # curl has been found. # -# Find the native CURL headers and libraries. +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# ``CURL_FOUND`` +# True if curl found. +# +# ``CURL_INCLUDE_DIRS`` +# where to find curl/curl.h, etc. # -# :: +# ``CURL_LIBRARIES`` +# List of libraries when using curl. # -# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc. -# CURL_LIBRARIES - List of libraries when using curl. -# CURL_FOUND - True if curl found. -# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8) +# ``CURL_VERSION_STRING`` +# The version of curl found. # Look for the header file. find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=59d8cfb85ec964c98ca2c1d6b262d5b26f484c88 commit 59d8cfb85ec964c98ca2c1d6b262d5b26f484c88 Author: Vitaly Stakhovsky AuthorDate: Mon Mar 5 19:21:57 2018 -0500 Commit: Brad King CommitDate: Wed Mar 7 08:51:30 2018 -0500 cmVisualStudio10TargetGenerator: Use helpers for XML tags Make the XML generating code smaller, more structured, and less error-prone. This is a step towards future XML refactoring. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ed4a201..0fd8043 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -18,6 +18,22 @@ #include #include // IWYU pragma: keep +inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag, + const char* val, + int indentLevel) +{ + this->WriteString("<", indentLevel); + (*this->BuildFileStream) << tag << ">" << val << "\n"; +} + +inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag, + std::string const& val, + int indentLevel) +{ + this->WriteString("<", indentLevel); + (*this->BuildFileStream) << tag << ">" << val << "\n"; +} + static void ConvertToWindowsSlash(std::string& s); static std::string cmVS10EscapeXML(std::string arg) @@ -28,6 +44,12 @@ static std::string cmVS10EscapeXML(std::string arg) return arg; } +inline void cmVisualStudio10TargetGenerator::WriteElemEscapeXML( + const char* tag, std::string const& val, int indentLevel) +{ + this->WriteElem(tag, cmVS10EscapeXML(val), indentLevel); +} + static std::string cmVS10EscapeQuotes(std::string arg) { cmSystemTools::ReplaceString(arg, "\"", """); @@ -265,16 +287,10 @@ void cmVisualStudio10TargetGenerator::Generate() } (*this->BuildFileStream) << "\n"; // Tell newer versions to upgrade silently when loading. - this->WriteString("" - "true" - "\n", - 2); + this->WriteElem("NsightTegraUpgradeOnceWithoutPrompt", "true", 2); } else { // Require Nsight Tegra 1.6 for JCompile support. - this->WriteString("" - "7" - "\n", - 2); + this->WriteElem("NsightTegraProjectRevisionNumber", "7", 2); } this->WriteString("\n", 1); } @@ -282,9 +298,7 @@ void cmVisualStudio10TargetGenerator::Generate() if (const char* hostArch = this->GlobalGenerator->GetPlatformToolsetHostArchitecture()) { this->WriteString("\n", 1); - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(hostArch) - << "\n"; + this->WriteElemEscapeXML("PreferredToolArchitecture", hostArch, 2); this->WriteString("\n", 1); } @@ -292,8 +306,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteProjectConfigurations(); } this->WriteString("\n", 1); - this->WriteString("", 2); - (*this->BuildFileStream) << "{" << this->GUID << "}\n"; + this->WriteElem("ProjectGuid", "{" + this->GUID + "}", 2); if (this->MSTools && this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { @@ -322,61 +335,45 @@ void cmVisualStudio10TargetGenerator::Generate() this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER"); if (vsProjectName && vsLocalPath && vsProvider) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) - << "\n"; - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsLocalPath) - << "\n"; - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) - << "\n"; + this->WriteElemEscapeXML("SccProjectName", vsProjectName, 2); + this->WriteElemEscapeXML("SccLocalPath", vsLocalPath, 2); + this->WriteElemEscapeXML("SccProvider", vsProvider, 2); const char* vsAuxPath = this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH"); if (vsAuxPath) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath) - << "\n"; + this->WriteElemEscapeXML("SccAuxPath", vsAuxPath, 2); } } if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { - this->WriteString("true\n", 2); + this->WriteElem("WinMDAssembly", "true", 2); } const char* vsGlobalKeyword = this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD"); if (!vsGlobalKeyword) { - this->WriteString("Win32Proj\n", 2); + this->WriteElem("Keyword", "Win32Proj", 2); } else { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) - << "\n"; + this->WriteElemEscapeXML("Keyword", vsGlobalKeyword, 2); } const char* vsGlobalRootNamespace = this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE"); if (vsGlobalRootNamespace) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalRootNamespace) - << "\n"; + this->WriteElemEscapeXML("RootNamespace", vsGlobalRootNamespace, 2); } - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform) - << "\n"; + this->WriteElemEscapeXML("Platform", this->Platform, 2); const char* projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL"); if (!projLabel) { projLabel = this->Name.c_str(); } - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "\n"; + this->WriteElemEscapeXML("ProjectName", projLabel, 2); if (const char* targetFrameworkVersion = this->GeneratorTarget->GetProperty( "VS_DOTNET_TARGET_FRAMEWORK_VERSION")) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion) - << "\n"; + this->WriteElemEscapeXML("TargetFrameworkVersion", targetFrameworkVersion, + 2); } // Disable the project upgrade prompt that is displayed the first time a @@ -384,9 +381,7 @@ void cmVisualStudio10TargetGenerator::Generate() // the IDE (respected by VS 2013 and above). if (this->GlobalGenerator->GetVersion() >= cmGlobalVisualStudioGenerator::VS12) { - this->WriteString("NoUpgrade" - "\n", - 2); + this->WriteElem("VCProjectUpgraderObjectName", "NoUpgrade", 2); } std::vector keys = this->GeneratorTarget->GetPropertyKeys(); @@ -437,8 +432,7 @@ void cmVisualStudio10TargetGenerator::Generate() } outputType += "\n"; this->WriteString(outputType.c_str(), 2); - this->WriteString("Properties\n", - 2); + this->WriteElem("AppDesignerFolder", "Properties", 2); } this->WriteString("\n", 1); @@ -635,12 +629,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( { this->WriteString("BuildFileStream) << cmVS10EscapeXML(ref) << "\">\n"; - this->WriteString("true" - "\n", - 3); - this->WriteString("true" - "\n", - 3); + this->WriteElem("CopyLocalSatelliteAssemblies", "true", 3); + this->WriteElem("ReferenceOutputAssembly", "true", 3); if (!hint.empty()) { const char* privateReference = "True"; if (const char* value = this->GeneratorTarget->GetProperty( @@ -649,10 +639,8 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( privateReference = "False"; } } - this->WriteString("", 3); - (*this->BuildFileStream) << privateReference << "\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << hint << "\n"; + this->WriteElem("Private", privateReference, 3); + this->WriteElem("HintPath", hint, 3); } this->WriteDotNetReferenceCustomTags(ref); this->WriteString("\n", 2); @@ -711,9 +699,8 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() (*this->BuildFileStream) << obj << "\">\n"; if (this->ProjectType != csproj) { - this->WriteString("", 3); std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h"; - (*this->BuildFileStream) << hFileName << "\n"; + this->WriteElem("DependentUpon", hFileName, 3); for (std::string const& i : this->Configurations) { this->WritePlatformConfigTag("LogicalName", i, 3); @@ -741,8 +728,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() link = cmsys::SystemTools::GetFilenameName(obj); } if (!link.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << link << "\n"; + this->WriteElem("Link", link, 3); } } // Determine if this is a generated resource from a .Designer.cs file @@ -756,9 +742,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() generator = g; } if (!generator.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(generator) - << "\n"; + this->WriteElemEscapeXML("Generator", generator, 3); if (designerResource.find(srcDir) == 0) { designerResource = designerResource.substr(srcDir.length() + 1); } else if (designerResource.find(binDir) == 0) { @@ -768,9 +752,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() cmsys::SystemTools::GetFilenameName(designerResource); } ConvertToWindowsSlash(designerResource); - this->WriteString("", 3); - (*this->BuildFileStream) << designerResource - << "\n"; + this->WriteElem("LastGenOutput", designerResource, 3); } } const cmPropertyMap& props = oi->GetProperties(); @@ -828,11 +810,10 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() } if (!link.empty()) { ConvertToWindowsSlash(link); - this->WriteString("", 3); - (*this->BuildFileStream) << link << "\n"; + this->WriteElem("Link", link, 3); } } - this->WriteString("Designer\n", 3); + this->WriteElem("SubType", "Designer", 3); this->WriteString("BuildFileStream) << xamlType << ">\n"; } @@ -894,7 +875,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences() for (std::string const& ri : references) { this->WriteString("BuildFileStream) << cmVS10EscapeXML(ri) << "\">\n"; - this->WriteString("true\n", 3); + this->WriteElem("IsWinMDFile", "true", 3); this->WriteString("\n", 2); } this->WriteString("\n", 1); @@ -909,11 +890,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() for (std::string const& c : this->Configurations) { this->WriteString("BuildFileStream) << c << "|" << this->Platform << "\">\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << c << "\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(this->Platform) - << "\n"; + this->WriteElem("Configuration", c, 3); + this->WriteElemEscapeXML("Platform", this->Platform, 3); this->WriteString("\n", 2); } this->WriteString("\n", 1); @@ -997,9 +975,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( useOfMfcValue = "Dynamic"; } } - std::string mfcLine = ""; - mfcLine += useOfMfcValue + "\n"; - this->WriteString(mfcLine.c_str(), 2); + this->WriteElem("UseOfMfc", useOfMfcValue, 2); } if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY && @@ -1008,25 +984,20 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore() || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("Unicode\n", 2); + this->WriteElem("CharacterSet", "Unicode", 2); } else if (this->GeneratorTarget->GetType() <= cmStateEnums::MODULE_LIBRARY && this->ClOptions[config]->UsingSBCS()) { - this->WriteString("NotSet\n", 2); + this->WriteElem("CharacterSet", "NotSet", 2); } else { - this->WriteString("MultiByte\n", 2); + this->WriteElem("CharacterSet", "MultiByte", 2); } if (const char* toolset = gg->GetPlatformToolset()) { - std::string pts = ""; - pts += toolset; - pts += "\n"; - this->WriteString(pts.c_str(), 2); + this->WriteElem("PlatformToolset", toolset, 2); } if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("true" - "\n", - 2); + this->WriteElem("WindowsAppContainer", "true", 2); } } @@ -1038,26 +1009,21 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( Options& o = *(this->ClOptions[config]); if (o.IsDebug()) { - this->WriteString("true\n", 2); - this->WriteString("true\n", 2); + this->WriteElem("DebugSymbols", "true", 2); + this->WriteElem("DefineDebug", "true", 2); } std::string outDir = this->GeneratorTarget->GetDirectory(config) + "/"; ConvertToWindowsSlash(outDir); - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(outDir) << "\n"; + this->WriteElemEscapeXML("OutputPath", outDir, 2); if (o.HasFlag("Platform")) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(o.GetFlag("Platform")) - << "\n"; + this->WriteElemEscapeXML("PlatformTarget", o.GetFlag("Platform"), 2); o.RemoveFlag("Platform"); } if (const char* toolset = gg->GetPlatformToolset()) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(toolset) - << "\n"; + this->WriteElemEscapeXML("PlatformToolset", toolset, 2); } std::string postfixName = cmSystemTools::UpperCase(config); @@ -1067,12 +1033,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( if (const char* postfix = this->GeneratorTarget->GetProperty(postfixName)) { assemblyName += postfix; } - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(assemblyName) - << "\n"; + this->WriteElemEscapeXML("AssemblyName", assemblyName, 2); if (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType()) { - this->WriteString("Program\n", 2); + this->WriteElem("StartAction", "Program", 2); this->WriteString("", 2); (*this->BuildFileStream) << cmVS10EscapeXML(outDir) << cmVS10EscapeXML(assemblyName) @@ -1094,27 +1058,20 @@ void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues( this->WriteString(ntv.c_str(), 2); if (const char* minApi = this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) { - this->WriteString("", 2); - (*this->BuildFileStream) << "android-" << cmVS10EscapeXML(minApi) - << "\n"; + this->WriteElem("AndroidMinAPI", "android-" + cmVS10EscapeXML(minApi), 2); } if (const char* api = this->GeneratorTarget->GetProperty("ANDROID_API")) { - this->WriteString("", 2); - (*this->BuildFileStream) << "android-" << cmVS10EscapeXML(api) - << "\n"; + this->WriteElem("AndroidTargetAPI", "android-" + cmVS10EscapeXML(api), 2); } if (const char* cpuArch = this->GeneratorTarget->GetProperty("ANDROID_ARCH")) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << "\n"; + this->WriteElemEscapeXML("AndroidArch", cpuArch, 2); } if (const char* stlType = this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(stlType) - << "\n"; + this->WriteElemEscapeXML("AndroidStlType", stlType, 2); } } @@ -1199,8 +1156,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( this->GetCSharpSourceLink(source, link); this->WriteSource("None", source, ">\n"); if (!link.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << link << "\n"; + this->WriteElem("Link", link, 3); } this->WriteString("\n", 2); this->WriteString("\n", 1); @@ -1372,23 +1328,23 @@ void cmVisualStudio10TargetGenerator::WriteGroups() if (fileName == "wmappmanifest.xml") { this->WriteString("BuildFileStream) << oi << "\">\n"; - this->WriteString("Resource Files\n", 3); + this->WriteElem("Filter", "Resource Files", 3); this->WriteString("\n", 2); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".appxmanifest") { this->WriteString("BuildFileStream) << oi << "\">\n"; - this->WriteString("Resource Files\n", 3); + this->WriteElem("Filter", "Resource Files", 3); this->WriteString("\n", 2); } else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") { this->WriteString("BuildFileStream) << oi << "\">\n"; - this->WriteString("Resource Files\n", 3); + this->WriteElem("Filter", "Resource Files", 3); this->WriteString("\n", 2); } else { this->WriteString("BuildFileStream) << oi << "\">\n"; - this->WriteString("Resource Files\n", 3); + this->WriteElem("Filter", "Resource Files", 3); this->WriteString("\n", 2); } } @@ -1404,7 +1360,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->WriteString("BuildFileStream) << cmVS10EscapeXML(obj) << "\">\n"; - this->WriteString("Resource Files\n", 3); + this->WriteElem("Filter", "Resource Files", 3); this->WriteString("\n", 2); } this->WriteString("\n", 1); @@ -1423,10 +1379,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() (*this->BuildFileStream) << name << "\">\n"; std::string guidName = "SG_Filter_"; guidName += name; - this->WriteString("", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName); - (*this->BuildFileStream) << "{" << guid << "}" - << "\n"; + this->WriteElem("UniqueIdentifier", "{" + guid + "}", 3); this->WriteString("\n", 2); } } @@ -1434,10 +1388,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups() if (!resxObjs.empty() || !this->AddedFiles.empty()) { this->WriteString("\n", 2); std::string guidName = "SG_Filter_Resource Files"; - this->WriteString("", 3); std::string guid = this->GlobalGenerator->GetGUID(guidName); - (*this->BuildFileStream) << "{" << guid << "}" - << "\n"; + this->WriteElem("UniqueIdentifier", "{" + guid + "}", 3); this->WriteString("rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;", 3); (*this->BuildFileStream) << "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;"; (*this->BuildFileStream) << "mfcribbon-ms\n"; @@ -1508,8 +1460,7 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources( (*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path); if (!filter.empty()) { (*this->BuildFileStream) << "\">\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << filter << "\n"; + this->WriteElem("Filter", filter, 3); this->WriteString("BuildFileStream) << name << ">\n"; } else { @@ -1524,13 +1475,12 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) std::string const& fileName = sf->GetFullPath(); if (this->IsResxHeader(fileName)) { this->WriteSource("ClInclude", sf, ">\n"); - this->WriteString("CppForm\n", 3); + this->WriteElem("FileType", "CppForm", 3); this->WriteString("\n", 2); } else if (this->IsXamlHeader(fileName)) { this->WriteSource("ClInclude", sf, ">\n"); - this->WriteString("", 3); std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); - (*this->BuildFileStream) << xamlFileName << "\n"; + this->WriteElem("DependentUpon", xamlFileName, 3); this->WriteString("\n", 2); } else { this->WriteSource("ClInclude", sf); @@ -1725,19 +1675,13 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } } if (!shaderType.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderType) - << "\n"; + this->WriteElemEscapeXML("ShaderType", shaderType, 3); } if (!shaderEntryPoint.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderEntryPoint) - << "\n"; + this->WriteElemEscapeXML("EntryPointName", shaderEntryPoint, 3); } if (!shaderModel.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel) - << "\n"; + this->WriteElemEscapeXML("ShaderModel", shaderModel, 3); } if (!outputHeaderFile.empty()) { for (size_t i = 0; i != this->Configurations.size(); ++i) { @@ -1762,47 +1706,33 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } } if (!shaderEnableDebug.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderEnableDebug) - << "\n"; + this->WriteElemEscapeXML("EnableDebuggingInformation", shaderEnableDebug, + 3); } if (!shaderDisableOptimizations.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderDisableOptimizations) - << "\n"; + this->WriteElemEscapeXML("DisableOptimizations", + shaderDisableOptimizations, 3); } if (!shaderAdditionalFlags.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags) - << "\n"; + this->WriteElemEscapeXML("AdditionalOptions", shaderAdditionalFlags, 3); } if (!settingsGenerator.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(settingsGenerator) - << "\n"; + this->WriteElemEscapeXML("Generator", settingsGenerator, 3); } if (!settingsLastGenOutput.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(settingsLastGenOutput) - << "\n"; + this->WriteElemEscapeXML("LastGenOutput", settingsLastGenOutput, 3); } if (!sourceLink.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(sourceLink) << "\n"; + this->WriteElemEscapeXML("Link", sourceLink, 3); } if (!subType.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(subType) << "\n"; + this->WriteElemEscapeXML("SubType", subType, 3); } if (!copyToOutDir.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(copyToOutDir) - << "\n"; + this->WriteElemEscapeXML("CopyToOutputDirectory", copyToOutDir, 3); } if (!includeInVsix.empty()) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(includeInVsix) - << "\n"; + this->WriteElemEscapeXML("IncludeInVSIX", includeInVsix, 3); } // write source file specific tags this->WriteCSharpSourceProperties(sourceFileTags); @@ -2057,13 +1987,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( firstString = ""; hasFlags = true; if (lang == "CUDA") { - this->WriteString("", 3); - (*this->BuildFileStream) << "$(IntDir)/" << objectName - << "\n"; + this->WriteElem("CompileOut", "$(IntDir)/" + objectName, 3); } else { - this->WriteString("", 3); - (*this->BuildFileStream) << "$(IntDir)/" << objectName - << "\n"; + this->WriteElem("ObjectFileName", "$(IntDir)/" + objectName, 3); } } for (std::string const& config : this->Configurations) { @@ -2163,10 +2089,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( (*this->BuildFileStream) << firstString; firstString = ""; // only do firstString once hasFlags = true; - this->WriteString("", 3); const std::string& fileName = source->GetFullPath(); std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); - (*this->BuildFileStream) << xamlFileName << "\n"; + this->WriteElem("DependentUpon", xamlFileName, 3); } if (this->ProjectType == csproj) { std::string f = source->GetFullPath(); @@ -2214,9 +2139,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() } this->WriteString("\n", 1); - this->WriteString("<_ProjectFileVersion>10.0.20506.1" - "\n", - 2); + this->WriteElem("_ProjectFileVersion", "10.0.20506.1", 2); for (std::string const& config : this->Configurations) { if (ttype >= cmStateEnums::UTILITY) { this->WritePlatformConfigTag("IntDir", config, 2); @@ -2521,9 +2444,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( if (this->NsightTegra) { if (const char* processMax = this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX")) { - this->WriteString("", 3); - *this->BuildFileStream << cmVS10EscapeXML(processMax) - << "\n"; + this->WriteElemEscapeXML("ProcessMax", processMax, 3); } } @@ -2531,12 +2452,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( cmsys::RegularExpression clangToolset("v[0-9]+_clang_.*"); const char* toolset = this->GlobalGenerator->GetPlatformToolset(); if (toolset && clangToolset.find(toolset)) { - this->WriteString("" - "$(IntDir)%(filename).obj" - "\n", - 3); + this->WriteElem("ObjectFileName", "$(IntDir)%(filename).obj", 3); } else { - this->WriteString("$(IntDir)\n", 3); + this->WriteElem("ObjectFileName", "$(IntDir)", 3); } // If not in debug mode, write the DebugInformationFormat field @@ -2552,9 +2470,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( std::string pdb = this->GeneratorTarget->GetCompilePDBPath(configName); if (!pdb.empty()) { ConvertToWindowsSlash(pdb); - this->WriteString("", 3); - *this->BuildFileStream << cmVS10EscapeXML(pdb) - << "\n"; + this->WriteElemEscapeXML("ProgramDataBaseFileName", pdb, 3); } } @@ -2973,9 +2889,7 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( if (this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore()) { this->WriteString("\n", 2); - this->WriteString("false" - "\n", - 3); + this->WriteElem("GenerateWindowsMetadata", "false", 3); this->WriteString("\n", 2); } } @@ -3026,32 +2940,28 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( { std::string antBuildPath = rootDir; this->WriteString("\n", 2); - this->WriteString("", 3); ConvertToWindowsSlash(antBuildPath); - (*this->BuildFileStream) << cmVS10EscapeXML(antBuildPath) - << "\n"; + this->WriteElemEscapeXML("AntBuildPath", antBuildPath, 3); } if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) { - this->WriteString("true\n", 3); + this->WriteElem("SkipAntStep", "true", 3); } if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_PROGUARD")) { - this->WriteString("true\n", 3); + this->WriteElem("EnableProGuard", "true", 3); } if (const char* proGuardConfigLocation = this->GeneratorTarget->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation) - << "\n"; + this->WriteElemEscapeXML("ProGuardConfigLocation", proGuardConfigLocation, + 3); } if (const char* securePropertiesLocation = this->GeneratorTarget->GetProperty("ANDROID_SECURE_PROPS_PATH")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation) - << "\n"; + this->WriteElemEscapeXML("SecurePropertiesLocation", + securePropertiesLocation, 3); } if (const char* nativeLibDirectoriesExpression = @@ -3061,9 +2971,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(nativeLibDirectoriesExpression); std::string nativeLibDirs = cge->Evaluate(this->LocalGenerator, configName); - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs) - << "\n"; + this->WriteElemEscapeXML("NativeLibDirectories", nativeLibDirs, 3); } if (const char* nativeLibDependenciesExpression = @@ -3074,16 +2982,12 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(nativeLibDependenciesExpression); std::string nativeLibDeps = cge->Evaluate(this->LocalGenerator, configName); - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDeps) - << "\n"; + this->WriteElemEscapeXML("NativeLibDependencies", nativeLibDeps, 3); } if (const char* javaSourceDir = this->GeneratorTarget->GetProperty("ANDROID_JAVA_SOURCE_DIR")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir) - << "\n"; + this->WriteElemEscapeXML("JavaSourceDir", javaSourceDir, 3); } if (const char* jarDirectoriesExpression = @@ -3093,31 +2997,23 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( ge.Parse(jarDirectoriesExpression); std::string jarDirectories = cge->Evaluate(this->LocalGenerator, configName); - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(jarDirectories) - << "\n"; + this->WriteElemEscapeXML("JarDirectories", jarDirectories, 3); } if (const char* jarDeps = this->GeneratorTarget->GetProperty("ANDROID_JAR_DEPENDENCIES")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(jarDeps) - << "\n"; + this->WriteElemEscapeXML("JarDependencies", jarDeps, 3); } if (const char* assetsDirectories = this->GeneratorTarget->GetProperty("ANDROID_ASSETS_DIRECTORIES")) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories) - << "\n"; + this->WriteElemEscapeXML("AssetsDirectories", assetsDirectories, 3); } { std::string manifest_xml = rootDir + "/AndroidManifest.xml"; ConvertToWindowsSlash(manifest_xml); - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(manifest_xml) - << "\n"; + this->WriteElemEscapeXML("AndroidManifestLocation", manifest_xml, 3); } if (const char* antAdditionalOptions = @@ -3335,7 +3231,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( cmGeneratorTarget::ModuleDefinitionInfo const* mdi = this->GeneratorTarget->GetModuleDefinitionInfo(config); if (mdi && !mdi->DefFile.empty()) { - linkOptions.AddFlag("ModuleDefinitionFile", mdi->DefFile.c_str()); + linkOptions.AddFlag("ModuleDefinitionFile", mdi->DefFile); } linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "%(IgnoreSpecificDefaultLibraries)"); @@ -3418,8 +3314,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions( if (!this->GlobalGenerator->NeedLinkLibraryDependencies( this->GeneratorTarget)) { this->WriteString("\n", 2); - this->WriteString( - "false\n", 3); + this->WriteElem("LinkLibraryDependencies", "false", 3); this->WriteString("\n", 2); } } @@ -3513,15 +3408,11 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions( this->WriteString("%(AdditionalIncludeDirectories)" "\n", 0); - this->WriteString("$(ProjectDir)/$(IntDir)" - "\n", - 3); - this->WriteString("%(Filename).h\n", 3); - this->WriteString("%(Filename).tlb\n", 3); - this->WriteString("" - "%(Filename)_i.c\n", - 3); - this->WriteString("%(Filename)_p.c\n", 3); + this->WriteElem("OutputDirectory", "$(ProjectDir)/$(IntDir)", 3); + this->WriteElem("HeaderFileName", "%(Filename).h", 3); + this->WriteElem("TypeLibraryName", "%(Filename).tlb", 3); + this->WriteElem("InterfaceIdentifierFileName", "%(Filename)_i.c", 3); + this->WriteElem("ProxyFileName", "%(Filename)_p.c", 3); this->WriteString("\n", 2); } @@ -3613,8 +3504,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent( } comment = cmVS10EscapeComment(comment); if (this->ProjectType != csproj) { - this->WriteString("", 3); - (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "\n"; + this->WriteElemEscapeXML("Message", comment, 3); this->WriteString("", 3); } else { std::string strippedComment = comment; @@ -3667,17 +3557,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() } ConvertToWindowsSlash(path); (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << "{" << this->GlobalGenerator->GetGUID(name) - << "}"; - (*this->BuildFileStream) << "\n"; - this->WriteString("", 3); - (*this->BuildFileStream) << name << "\n"; + this->WriteElem("Project", + "{" + this->GlobalGenerator->GetGUID(name) + "}", 3); + this->WriteElem("Name", name, 3); this->WriteDotNetReferenceCustomTags(name); if (csproj == this->ProjectType) { if (!this->GlobalGenerator->TargetCanBeReferenced(dt)) { - this->WriteString( - "false\n", 3); + this->WriteElem("ReferenceOutputAssembly", "false", 3); } } this->WriteString("\n", 2); @@ -3807,14 +3693,12 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); ConvertToWindowsSlash(artifactDir); this->WriteString("\n", 1); - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(artifactDir) - << "\\\n"; - this->WriteString("", 2); + this->WriteElemEscapeXML("AppxPackageArtifactsDir", artifactDir + "\\", + 2); std::string resourcePriFile = this->DefaultArtifactDir + "/resources.pri"; ConvertToWindowsSlash(resourcePriFile); - (*this->BuildFileStream) << resourcePriFile << "\n"; + this->WriteElem("ProjectPriFullPath", resourcePriFile, 2); // If we are missing files and we don't have a certificate and // aren't targeting WP8.0, add a default certificate @@ -3828,26 +3712,18 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() this->AddedFiles.push_back(pfxFile); } - this->WriteString("<", 2); - (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile - << "\n"; + this->WriteElem("PackageCertificateKeyFile", pfxFile, 2); std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile); if (!thumb.empty()) { - this->WriteString("", 2); - (*this->BuildFileStream) << thumb - << "\n"; + this->WriteElem("PackageCertificateThumbprint", thumb, 2); } this->WriteString("\n", 1); } else if (!pfxFile.empty()) { this->WriteString("\n", 1); - this->WriteString("<", 2); - (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile - << "\n"; + this->WriteElem("PackageCertificateKeyFile", pfxFile, 2); std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile); if (!thumb.empty()) { - this->WriteString("", 2); - (*this->BuildFileStream) << thumb - << "\n"; + this->WriteElem("PackageCertificateThumbprint", thumb, 2); } this->WriteString("\n", 1); } @@ -3895,45 +3771,29 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); std::string const& v = this->GlobalGenerator->GetSystemVersion(); if (isWindowsPhone || isWindowsStore) { - this->WriteString("", 2); - (*this->BuildFileStream) - << (isWindowsPhone ? "Windows Phone" : "Windows Store") - << "\n"; - this->WriteString("en-US" - "\n", - 2); + this->WriteElem("ApplicationType", + (isWindowsPhone ? "Windows Phone" : "Windows Store"), 2); + this->WriteElem("DefaultLanguage", "en-US", 2); if (cmHasLiteralPrefix(v, "10.0")) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML("10.0") - << "\n"; + this->WriteElemEscapeXML("ApplicationTypeRevision", "10.0", 2); // Visual Studio 14.0 is necessary for building 10.0 apps - this->WriteString("14.0" - "\n", - 2); + this->WriteElem("MinimumVisualStudioVersion", "14.0", 2); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.1") { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(v) - << "\n"; + this->WriteElemEscapeXML("ApplicationTypeRevision", v, 2); // Visual Studio 12.0 is necessary for building 8.1 apps - this->WriteString("12.0" - "\n", - 2); + this->WriteElem("MinimumVisualStudioVersion", "12.0", 2); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.0") { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(v) - << "\n"; + this->WriteElemEscapeXML("ApplicationTypeRevision", v, 2); // Visual Studio 11.0 is necessary for building 8.0 apps - this->WriteString("11.0" - "\n", - 2); + this->WriteElem("MinimumVisualStudioVersion", "11.0", 2); if (isWindowsStore && this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { @@ -3941,52 +3801,42 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() } else if (isWindowsPhone && this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { - this->WriteString("true\n", 2); - this->WriteString("", 2); - (*this->BuildFileStream) - << cmVS10EscapeXML(this->Name) - << "_$(Configuration)_$(Platform).xap\n"; + this->WriteElem("XapOutputs", "true", 2); + this->WriteElem("XapFilename", cmVS10EscapeXML(this->Name) + + "_$(Configuration)_$(Platform).xap", + 2); } } } if (isAppContainer) { - this->WriteString("true" - "\n", - 2); + this->WriteElem("AppContainerApplication", "true", 2); } else if (this->Platform == "ARM64") { - this->WriteString("true" - "\n", - 2); + this->WriteElem("WindowsSDKDesktopARM64Support", "true", 2); } else if (this->Platform == "ARM") { - this->WriteString("true" - "\n", - 2); + this->WriteElem("WindowsSDKDesktopARMSupport", "true", 2); } std::string const& targetPlatformVersion = gg->GetWindowsTargetPlatformVersion(); if (!targetPlatformVersion.empty()) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion) - << "\n"; + this->WriteElemEscapeXML("WindowsTargetPlatformVersion", + targetPlatformVersion, 2); } const char* targetPlatformMinVersion = this->GeneratorTarget->GetProperty( "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); if (targetPlatformMinVersion) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformMinVersion) - << "\n"; + this->WriteElemEscapeXML("WindowsTargetPlatformMinVersion", + targetPlatformMinVersion, 2); } else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) { // If the min version is not set, then use the TargetPlatformVersion if (!targetPlatformVersion.empty()) { - this->WriteString("", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion) - << "\n"; + this->WriteElemEscapeXML("WindowsTargetPlatformMinVersion", + targetPlatformVersion, 2); } } // Added IoT Startup Task support if (this->GeneratorTarget->GetPropertyAsBool("VS_IOT_STARTUP_TASK")) { - this->WriteString("true\n", 2); + this->WriteElem("ContainsStartupTask", "true", 2); } } @@ -4117,7 +3967,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() ConvertToWindowsSlash(sourceFile); this->WriteString("BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n"; - this->WriteString("Designer\n", 3); + this->WriteElem("SubType", "Designer", 3); this->WriteString("\n", 2); this->AddedFiles.push_back(sourceFile); @@ -4395,7 +4245,7 @@ void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles( ConvertToWindowsSlash(sourceFile); this->WriteString("BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n"; - this->WriteString("Designer\n", 3); + this->WriteElem("SubType", "Designer", 3); this->WriteString("\n", 2); this->AddedFiles.push_back(sourceFile); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 124db4e..64121ed 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -55,6 +55,10 @@ private: std::string ConvertPath(std::string const& path, bool forceRelative); void WriteString(const char* line, int indentLevel); + void WriteElem(const char* tag, const char* val, int indentLevel); + void WriteElem(const char* tag, std::string const& val, int indentLevel); + void WriteElemEscapeXML(const char* tag, std::string const& val, + int indentLevel); void WriteProjectConfigurations(); void WriteProjectConfigurationValues(); void WriteMSToolConfigurationValues(std::string const& config); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7723e9a058c579e3535df9bbe62ea218200e4250 commit 7723e9a058c579e3535df9bbe62ea218200e4250 Author: Brad King AuthorDate: Tue Mar 6 14:21:38 2018 -0500 Commit: Brad King CommitDate: Wed Mar 7 07:48:40 2018 -0500 Do not produce legacy _LIB_DEPENDS cache entries Introduce policy `CMP0073` to avoid producing these cache entries. Fixes: #16364 diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 96d5c7d..254656a 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -51,6 +51,14 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used to determine whether to report an error on use of deprecated macros or functions. +Policies Introduced by CMake 3.12 +================================= + +.. toctree:: + :maxdepth: 1 + + CMP0073: Do not produce legacy _LIB_DEPENDS cache entries. + Policies Introduced by CMake 3.11 ================================= diff --git a/Help/policy/CMP0073.rst b/Help/policy/CMP0073.rst new file mode 100644 index 0000000..9bfa0e9 --- /dev/null +++ b/Help/policy/CMP0073.rst @@ -0,0 +1,25 @@ +CMP0073 +------- + +Do not produce legacy ``_LIB_DEPENDS`` cache entries. + +Ancient CMake versions once used ``_LIB_DEPENDS`` cache entries to +propagate library link dependencies. This has long been done by other +means, leaving the :command:`export_library_dependencies` command as the +only user of these values. That command has long been disallowed by +policy :policy:`CMP0033`, but the ``_LIB_DEPENDS`` cache entries +were left for compatibility with possible non-standard uses by projects. + +CMake 3.12 and above now prefer to not produce these cache entries +at all. This policy provides compatibility with projects that have +not been updated to avoid using them. + +The ``OLD`` behavior for this policy is to set ``_LIB_DEPENDS`` cache +entries. The ``NEW`` behavior for this policy is to not set them. + +This policy was introduced in CMake version 3.12. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike most policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/avoid-LIB_DEPENDS.rst b/Help/release/dev/avoid-LIB_DEPENDS.rst new file mode 100644 index 0000000..b89d8f9 --- /dev/null +++ b/Help/release/dev/avoid-LIB_DEPENDS.rst @@ -0,0 +1,5 @@ +avoid-LIB_DEPENDS +----------------- + +* CMake no longer produces ``_LIB_DEPENDS`` cache entries + for library targets. See policy :policy:`CMP0073`. diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index c39f927..a784f98 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -214,6 +214,9 @@ class cmMakefile; 3, 10, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0072, \ "FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \ + cmPolicies::WARN) \ + SELECT(POLICY, CMP0073, \ + "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \ cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) @@ -238,7 +241,8 @@ class cmMakefile; F(CMP0063) \ F(CMP0065) \ F(CMP0068) \ - F(CMP0069) + F(CMP0069) \ + F(CMP0073) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 97f7847..70387ae 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -737,7 +737,9 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, // and we removing one instance will break the link line. Duplicates // will be appropriately eliminated at emit time. if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY && - this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) { + this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY && + (this->GetPolicyStatusCMP0073() == cmPolicies::OLD || + this->GetPolicyStatusCMP0073() == cmPolicies::WARN)) { std::string targetEntry = this->Name; targetEntry += "_LIB_DEPENDS"; std::string dependencies; diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 8d5139d..5af6fcd 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -23,6 +23,7 @@ \* CMP0065 \* CMP0068 \* CMP0069 + \* CMP0073 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/add_library/CMP0073-stdout.txt b/Tests/RunCMake/add_library/CMP0073-stdout.txt new file mode 100644 index 0000000..84645b8 --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073-stdout.txt @@ -0,0 +1,3 @@ +-- warn_LIB_DEPENDS='general;bar;' +-- old_LIB_DEPENDS='general;bar;' +-- new_LIB_DEPENDS='' diff --git a/Tests/RunCMake/add_library/CMP0073.cmake b/Tests/RunCMake/add_library/CMP0073.cmake new file mode 100644 index 0000000..b34f5dc --- /dev/null +++ b/Tests/RunCMake/add_library/CMP0073.cmake @@ -0,0 +1,18 @@ +enable_language(C) + +add_library(warn empty.c) +target_link_libraries(warn bar) +message(STATUS "warn_LIB_DEPENDS='${warn_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 OLD) +add_library(old empty.c) +target_link_libraries(old bar) +message(STATUS "old_LIB_DEPENDS='${old_LIB_DEPENDS}'") + +cmake_policy(SET CMP0073 NEW) +add_library(new empty.c) +target_link_libraries(new bar) +message(STATUS "new_LIB_DEPENDS='${new_LIB_DEPENDS}'") +if(DEFINED new_LIB_DEPENDS) + message(FATAL_ERROR "new_LIB_DEPENDS set but should not be") +endif() diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake index 0ba6216..dfadb8f 100644 --- a/Tests/RunCMake/add_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0073) + run_cmake(INTERFACEwithNoSources) run_cmake(OBJECTwithNoSources) run_cmake(STATICwithNoSources) diff --git a/Tests/RunCMake/add_library/empty.c b/Tests/RunCMake/add_library/empty.c new file mode 100644 index 0000000..e69de29 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83c0cb3f0328504baf425704803c2ae83942cb86 commit 83c0cb3f0328504baf425704803c2ae83942cb86 Author: Rolf Eike Beer AuthorDate: Mon Mar 5 22:17:28 2018 +0100 Commit: Rolf Eike Beer CommitDate: Tue Mar 6 22:53:35 2018 +0100 FindCURL: provide imported target CURL::CURL diff --git a/Help/release/dev/curl-target.rst b/Help/release/dev/curl-target.rst new file mode 100644 index 0000000..dc65f64 --- /dev/null +++ b/Help/release/dev/curl-target.rst @@ -0,0 +1,4 @@ +curl-target +----------- + +* The :module:`FindCURL` module now provides imported targets. diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index f4bcc36..1d969a8 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -7,6 +7,12 @@ # # Find curl # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if +# curl has been found. +# # Find the native CURL headers and libraries. # # :: @@ -52,4 +58,10 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL if(CURL_FOUND) set(CURL_LIBRARIES ${CURL_LIBRARY}) set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) + + if(NOT TARGET CURL::CURL) + add_library(CURL::CURL UNKNOWN IMPORTED) + set_target_properties(CURL::CURL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + set_property(TARGET CURL::CURL APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 0ce6d72..f34bc04 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1326,6 +1326,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindBZip2) endif() + if(CMake_TEST_FindCURL) + add_subdirectory(FindCURL) + endif() + if(CMake_TEST_FindDoxygen) add_subdirectory(FindDoxygen) endif() diff --git a/Tests/FindCURL/CMakeLists.txt b/Tests/FindCURL/CMakeLists.txt new file mode 100644 index 0000000..0cfd629 --- /dev/null +++ b/Tests/FindCURL/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindCURL.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindCURL/Test" + "${CMake_BINARY_DIR}/Tests/FindCURL/Test" + ${build_generator_args} + --build-project TestFindCURL + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindCURL/Test/CMakeLists.txt b/Tests/FindCURL/Test/CMakeLists.txt new file mode 100644 index 0000000..f0e5568 --- /dev/null +++ b/Tests/FindCURL/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +project(TestFindCURL C) +include(CTest) + +find_package(CURL REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_CURL_VERSION="${CURL_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt CURL::CURL) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${CURL_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${CURL_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindCURL/Test/main.c b/Tests/FindCURL/Test/main.c new file mode 100644 index 0000000..263775f --- /dev/null +++ b/Tests/FindCURL/Test/main.c @@ -0,0 +1,17 @@ +#include +#include +#include + +int main() +{ + struct curl_slist* slist; + + curl_global_init(0); + + slist = curl_slist_append(NULL, "CMake"); + curl_slist_free_all(slist); + + curl_global_cleanup(); + + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2124a1364a620084c24d5654c2106e5aea88c55c commit 2124a1364a620084c24d5654c2106e5aea88c55c Author: Brad King AuthorDate: Tue Mar 6 14:03:55 2018 -0500 Commit: Brad King CommitDate: Tue Mar 6 14:38:23 2018 -0500 cmTarget: Remove unnecessary RecordDependencies member Inline the condition in the one remaining place it is checked. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b868e84..97f7847 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -186,14 +186,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->ImportedGloballyVisible = vis == VisibilityImportedGlobally; this->BuildInterfaceIncludesAppended = false; - // only add dependency information for library targets - if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY && - this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) { - this->RecordDependencies = true; - } else { - this->RecordDependencies = false; - } - // Check whether this is a DLL platform. this->DLLPlatform = (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || @@ -736,7 +728,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, this->OriginalLinkLibraries.emplace_back(lib, llt); } - // Add the explicit dependency information for this target. This is + // Add the explicit dependency information for libraries. This is // simply a set of libraries separated by ";". There should always // be a trailing ";". These library names are not canonical, in that // they may be "-framework x", "-ly", "/path/libz.a", etc. @@ -744,7 +736,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, // may be purposefully duplicated to handle recursive dependencies, // and we removing one instance will break the link line. Duplicates // will be appropriately eliminated at emit time. - if (this->RecordDependencies) { + if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY && + this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) { std::string targetEntry = this->Name; targetEntry += "_LIB_DEPENDS"; std::string dependencies; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56f8975..62c4e22 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -310,7 +310,6 @@ private: cmTargetInternalPointer Internal; cmStateEnums::TargetType TargetTypeValue; bool HaveInstallRule; - bool RecordDependencies; bool DLLPlatform; bool IsAndroid; bool IsImportedTarget; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c5bfab532e96bc728691a15b092d388a9e0a0d5 commit 1c5bfab532e96bc728691a15b092d388a9e0a0d5 Author: Brad King AuthorDate: Tue Mar 6 14:00:54 2018 -0500 Commit: Brad King CommitDate: Tue Mar 6 14:38:16 2018 -0500 cmTarget: Simplify ClearDependencyInformation implementation Remove the `_LIB_DEPENDS` cache entry unconditionally. It will be populated again later if needed. There is no need to ask the user to remove the cache entry if the target type changes. Issue: #16364 diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f7ead9f..b868e84 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -637,24 +637,9 @@ const std::vector& cmTarget::GetLinkDirectories() const void cmTarget::ClearDependencyInformation(cmMakefile& mf) { - // Clear the dependencies. The cache variable must exist iff we are - // recording dependency information for this target. std::string depname = this->GetName(); depname += "_LIB_DEPENDS"; - if (this->RecordDependencies) { - mf.AddCacheDefinition(depname, "", "Dependencies for target", - cmStateEnums::STATIC); - } else { - if (mf.GetDefinition(depname)) { - std::string message = "Target "; - message += this->GetName(); - message += " has dependency information when it shouldn't.\n"; - message += "Your cache is probably stale. Please remove the entry\n "; - message += depname; - message += "\nfrom the cache."; - cmSystemTools::Error(message.c_str()); - } - } + mf.RemoveCacheDefinition(depname); } std::string cmTarget::GetDebugGeneratorExpressions( https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=910a9d608e31a3446d0cbb86eb78917cc04b1a64 commit 910a9d608e31a3446d0cbb86eb78917cc04b1a64 Author: Brad King AuthorDate: Tue Mar 6 13:54:45 2018 -0500 Commit: Brad King CommitDate: Tue Mar 6 13:54:45 2018 -0500 cmTarget: Simplify ClearDependencyInformation signature We don't need to pass an argument with the target's own name. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 47d75af..a69f75f 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1867,7 +1867,7 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname, // Clear its dependencies. Otherwise, dependencies might persist // over changes in CMakeLists.txt, making the information stale and // hence useless. - target->ClearDependencyInformation(*this, lname); + target->ClearDependencyInformation(*this); if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bb21022..f7ead9f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -635,12 +635,11 @@ const std::vector& cmTarget::GetLinkDirectories() const return this->LinkDirectories; } -void cmTarget::ClearDependencyInformation(cmMakefile& mf, - const std::string& target) +void cmTarget::ClearDependencyInformation(cmMakefile& mf) { // Clear the dependencies. The cache variable must exist iff we are // recording dependency information for this target. - std::string depname = target; + std::string depname = this->GetName(); depname += "_LIB_DEPENDS"; if (this->RecordDependencies) { mf.AddCacheDefinition(depname, "", "Dependencies for target", @@ -648,7 +647,7 @@ void cmTarget::ClearDependencyInformation(cmMakefile& mf, } else { if (mf.GetDefinition(depname)) { std::string message = "Target "; - message += target; + message += this->GetName(); message += " has dependency information when it shouldn't.\n"; message += "Your cache is probably stale. Please remove the entry\n "; message += depname; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 56f3e3a..56f8975 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -137,7 +137,7 @@ public: /** * Clear the dependency information recorded for this target, if any. */ - void ClearDependencyInformation(cmMakefile& mf, const std::string& target); + void ClearDependencyInformation(cmMakefile& mf); void AddLinkLibrary(cmMakefile& mf, const std::string& lib, cmTargetLinkLibraryType llt); ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-policies.7.rst | 8 + Help/policy/CMP0073.rst | 25 ++ Help/release/dev/avoid-LIB_DEPENDS.rst | 5 + Help/release/dev/curl-target.rst | 4 + Modules/CPackNSIS.cmake | 2 +- Modules/FindCURL.cmake | 34 +- Modules/FindGDAL.cmake | 46 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/cmCTest.h | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmPolicies.h | 6 +- Source/cmTarget.cxx | 37 +- Source/cmTarget.h | 3 +- Source/cmVisualStudio10TargetGenerator.cxx | 474 +++++++------------- Source/cmVisualStudio10TargetGenerator.h | 4 + Tests/CMakeLists.txt | 4 + Tests/{FindICU => FindCURL}/CMakeLists.txt | 8 +- Tests/FindCURL/Test/CMakeLists.txt | 16 + Tests/FindCURL/Test/main.c | 17 + .../RunCMake/TargetPolicies/PolicyList-stderr.txt | 1 + Tests/RunCMake/add_library/CMP0073-stdout.txt | 3 + Tests/RunCMake/add_library/CMP0073.cmake | 18 + Tests/RunCMake/add_library/RunCMakeTest.cmake | 2 + .../{GeneratorExpression => add_library}/empty.c | 0 24 files changed, 360 insertions(+), 363 deletions(-) create mode 100644 Help/policy/CMP0073.rst create mode 100644 Help/release/dev/avoid-LIB_DEPENDS.rst create mode 100644 Help/release/dev/curl-target.rst copy Tests/{FindICU => FindCURL}/CMakeLists.txt (55%) create mode 100644 Tests/FindCURL/Test/CMakeLists.txt create mode 100644 Tests/FindCURL/Test/main.c create mode 100644 Tests/RunCMake/add_library/CMP0073-stdout.txt create mode 100644 Tests/RunCMake/add_library/CMP0073.cmake copy Tests/RunCMake/{GeneratorExpression => add_library}/empty.c (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 8 16:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 8 Mar 2018 16:15:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-180-g81b17f4 Message-ID: <20180308211505.C07F5FBC44@public.kitware.com> 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, master has been updated via 81b17f4649efce1c1666c7f60e3201869e11ddd4 (commit) via 587bad7ba2c8a74e53bc173575dc52c6a6ae0a8b (commit) from 156a959410cfbd33c648e7b8993d32fd8f9af00a (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81b17f4649efce1c1666c7f60e3201869e11ddd4 commit 81b17f4649efce1c1666c7f60e3201869e11ddd4 Merge: 156a959 587bad7 Author: Craig Scott AuthorDate: Thu Mar 8 21:11:37 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 8 16:11:52 2018 -0500 Merge topic 'project-warn-missing-metadata-values' 587bad7ba2 project: warn on metadata arguments missing values Acked-by: Kitware Robot Merge-request: !1815 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=587bad7ba2c8a74e53bc173575dc52c6a6ae0a8b commit 587bad7ba2c8a74e53bc173575dc52c6a6ae0a8b Author: Alex Turbov AuthorDate: Sat Mar 3 12:45:56 2018 +0800 Commit: Brad King CommitDate: Wed Mar 7 09:35:59 2018 -0500 project: warn on metadata arguments missing values Warn if `DESCRIPTION` or `VERSION` is given without a following value. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index dfa1858..67c971f 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -3,9 +3,11 @@ #include "cmProjectCommand.h" #include "cmsys/RegularExpression.hxx" +#include #include #include +#include "cmAlgorithms.h" #include "cmMakefile.h" #include "cmPolicies.h" #include "cmStateTypes.h" @@ -69,6 +71,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, std::string version; std::string description; std::vector languages; + std::function missedValueReporter; + auto resetReporter = [&missedValueReporter]() { + missedValueReporter = std::function(); + }; enum Doing { DoingDescription, @@ -85,7 +91,18 @@ bool cmProjectCommand::InitialPass(std::vector const& args, return true; } haveLanguages = true; + if (missedValueReporter) { + missedValueReporter(); + } doing = DoingLanguages; + if (!languages.empty()) { + std::string msg = + "the following parameters must be specified after LANGUAGES " + "keyword: "; + msg += cmJoin(languages, ", "); + msg += '.'; + this->Makefile->IssueMessage(cmake::WARNING, msg); + } } else if (args[i] == "VERSION") { if (haveVersion) { this->Makefile->IssueMessage(cmake::FATAL_ERROR, @@ -94,7 +111,17 @@ bool cmProjectCommand::InitialPass(std::vector const& args, return true; } haveVersion = true; + if (missedValueReporter) { + missedValueReporter(); + } doing = DoingVersion; + missedValueReporter = [this, &resetReporter]() { + this->Makefile->IssueMessage( + cmake::WARNING, + "VERSION keyword not followed by a value or was followed by a " + "value that expanded to nothing."); + resetReporter(); + }; } else if (args[i] == "DESCRIPTION") { if (haveDescription) { this->Makefile->IssueMessage( @@ -103,23 +130,41 @@ bool cmProjectCommand::InitialPass(std::vector const& args, return true; } haveDescription = true; + if (missedValueReporter) { + missedValueReporter(); + } doing = DoingDescription; + missedValueReporter = [this, &resetReporter]() { + this->Makefile->IssueMessage( + cmake::WARNING, + "DESCRIPTION keyword not followed by a value or was followed " + "by a value that expanded to nothing."); + resetReporter(); + }; } else if (doing == DoingVersion) { doing = DoingLanguages; version = args[i]; + resetReporter(); } else if (doing == DoingDescription) { doing = DoingLanguages; description = args[i]; + resetReporter(); } else // doing == DoingLanguages { languages.push_back(args[i]); } } - if (haveVersion && !haveLanguages && !languages.empty()) { + if (missedValueReporter) { + missedValueReporter(); + } + + if ((haveVersion || haveDescription) && !haveLanguages && + !languages.empty()) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, - "project with VERSION must use LANGUAGES before language names."); + "project with VERSION or DESCRIPTION must use LANGUAGES before " + "language names."); cmSystemTools::SetFatalErrorOccured(); return true; } diff --git a/Tests/RunCMake/project/LanguagesUnordered-stderr.txt b/Tests/RunCMake/project/LanguagesUnordered-stderr.txt new file mode 100644 index 0000000..5108670 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUnordered-stderr.txt @@ -0,0 +1 @@ + the following parameters must be specified after LANGUAGES keyword: C. diff --git a/Tests/RunCMake/project/LanguagesUnordered.cmake b/Tests/RunCMake/project/LanguagesUnordered.cmake new file mode 100644 index 0000000..cd3ba28 --- /dev/null +++ b/Tests/RunCMake/project/LanguagesUnordered.cmake @@ -0,0 +1 @@ +project(ProjectA C LANGUAGES CXX) diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt b/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt new file mode 100644 index 0000000..910106f --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt @@ -0,0 +1,2 @@ + DESCRIPTION keyword not followed by a value or was followed by a value that + expanded to nothing. diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake new file mode 100644 index 0000000..64bac54 --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 DESCRIPTION) diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt b/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt new file mode 100644 index 0000000..910106f --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt @@ -0,0 +1,2 @@ + DESCRIPTION keyword not followed by a value or was followed by a value that + expanded to nothing. diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake b/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake new file mode 100644 index 0000000..f50a2f6 --- /dev/null +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 DESCRIPTION LANGUAGES NONE) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index 3d13e2e..f77c15d 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -7,8 +7,11 @@ run_cmake(LanguagesImplicit) run_cmake(LanguagesEmpty) run_cmake(LanguagesNONE) run_cmake(LanguagesTwice) +run_cmake(LanguagesUnordered) run_cmake(ProjectDescription) run_cmake(ProjectDescription2) +run_cmake(ProjectDescriptionNoArg) +run_cmake(ProjectDescriptionNoArg2) run_cmake(VersionAndLanguagesEmpty) run_cmake(VersionEmpty) run_cmake(VersionInvalid) diff --git a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt index 52433bc..1139df7 100644 --- a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt +++ b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt @@ -1,4 +1,5 @@ CMake Error at VersionMissingLanguages.cmake:2 \(project\): - project with VERSION must use LANGUAGES before language names. + project with VERSION or DESCRIPTION must use LANGUAGES before language + names. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt b/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt new file mode 100644 index 0000000..3228df7 --- /dev/null +++ b/Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt @@ -0,0 +1,2 @@ + VERSION keyword not followed by a value or was followed by a value that + expanded to nothing. ----------------------------------------------------------------------- Summary of changes: Source/cmProjectCommand.cxx | 49 +++++++++++++++++++- .../RunCMake/project/LanguagesUnordered-stderr.txt | 1 + Tests/RunCMake/project/LanguagesUnordered.cmake | 1 + .../project/ProjectDescriptionNoArg-stderr.txt | 2 + .../RunCMake/project/ProjectDescriptionNoArg.cmake | 2 + .../project/ProjectDescriptionNoArg2-stderr.txt | 2 + .../project/ProjectDescriptionNoArg2.cmake | 2 + Tests/RunCMake/project/RunCMakeTest.cmake | 3 ++ .../project/VersionMissingLanguages-stderr.txt | 3 +- .../project/VersionMissingValueOkay-stderr.txt | 2 + 10 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Tests/RunCMake/project/LanguagesUnordered-stderr.txt create mode 100644 Tests/RunCMake/project/LanguagesUnordered.cmake create mode 100644 Tests/RunCMake/project/ProjectDescriptionNoArg-stderr.txt create mode 100644 Tests/RunCMake/project/ProjectDescriptionNoArg.cmake create mode 100644 Tests/RunCMake/project/ProjectDescriptionNoArg2-stderr.txt create mode 100644 Tests/RunCMake/project/ProjectDescriptionNoArg2.cmake create mode 100644 Tests/RunCMake/project/VersionMissingValueOkay-stderr.txt hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 00:05:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 00:05:09 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-181-g72abc75 Message-ID: <20180309050509.8137A10B098@public.kitware.com> 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, master has been updated via 72abc75519e498e75f29a96577474277d4dd5da5 (commit) from 81b17f4649efce1c1666c7f60e3201869e11ddd4 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=72abc75519e498e75f29a96577474277d4dd5da5 commit 72abc75519e498e75f29a96577474277d4dd5da5 Author: Kitware Robot AuthorDate: Fri Mar 9 00:01:10 2018 -0500 Commit: Kitware Robot CommitDate: Fri Mar 9 00:01:10 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9b2957f..6823116 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180308) +set(CMake_VERSION_PATCH 20180309) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 07:45:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 07:45:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-197-g6e56f28 Message-ID: <20180309124508.9F15B10A97E@public.kitware.com> 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, master has been updated via 6e56f288083e7cd21d67756b1034604d9184b9b4 (commit) via e11410bb0c66152c6fafb56d40c9328abaa7a1ab (commit) via 44fc5729637330e463666f97ba952dcb6f2e9506 (commit) via 897bd57025d4bb18bbeaec454f0ea1c26e4a901e (commit) via 98622e5e72a4bb705bf88b2d442c492dad45c072 (commit) via f8adde152f768660211e3e7e5990bc79a5de0458 (commit) via 9ef3abd3f39542ecbdfda0014a7f1b4c3bea50a9 (commit) via de348a9638bd51af4523f36c68884b901d4aff18 (commit) via 81bc7610abe68d158683877f04fc46c2a32c3b44 (commit) via 5901699672cce82d9622a02c4c7d22889029ee0c (commit) via e60e4dfc88252aaec53f0d832508d41dff6165fd (commit) via 87a6816bafdf545e81a468b393173353164039a5 (commit) via b688d4fd22850c287f191f142660781ded72e919 (commit) via ff5823f5125309fcf6f5a1e016ca267091d81e16 (commit) via e654622aee22655c418a9c663fad79243ca0c819 (commit) via a865f0beb2e9f8d92e021855c773ab90eaf24581 (commit) from 72abc75519e498e75f29a96577474277d4dd5da5 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6e56f288083e7cd21d67756b1034604d9184b9b4 commit 6e56f288083e7cd21d67756b1034604d9184b9b4 Merge: e11410b 9ef3abd Author: Brad King AuthorDate: Fri Mar 9 12:44:18 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:44:30 2018 -0500 Merge topic 'libxml2-target' 9ef3abd3f3 FindLibXml2: provide imported target LibXml2::LibXml2 Acked-by: Kitware Robot Merge-request: !1823 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e11410bb0c66152c6fafb56d40c9328abaa7a1ab commit e11410bb0c66152c6fafb56d40c9328abaa7a1ab Merge: 44fc572 5901699 Author: Brad King AuthorDate: Fri Mar 9 12:43:39 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:43:54 2018 -0500 Merge topic 'cmWorkingDirectory_success_checking' 5901699672 cmDepends: Remove attempt to change directory that always fails e60e4dfc88 cmWorkingDirectory: Check success of current dir changes e654622aee Tests: Add --build-and-test test case a865f0beb2 Tests: Confirm test working dir set successfully Acked-by: Kitware Robot Merge-request: !1817 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=44fc5729637330e463666f97ba952dcb6f2e9506 commit 44fc5729637330e463666f97ba952dcb6f2e9506 Merge: 897bd57 ff5823f Author: Brad King AuthorDate: Fri Mar 9 12:39:13 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:40:28 2018 -0500 Merge topic 'cmoutpconv-static' ff5823f512 cmOutputConverter: mark helper functions static Acked-by: Kitware Robot Merge-request: !1827 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=897bd57025d4bb18bbeaec454f0ea1c26e4a901e commit 897bd57025d4bb18bbeaec454f0ea1c26e4a901e Merge: 98622e5 de348a9 Author: Brad King AuthorDate: Fri Mar 9 12:38:51 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:39:43 2018 -0500 Merge topic 'GenerateExportHeader-C' de348a9638 GenerateExportHeader: Add support for C projects Acked-by: Kitware Robot Merge-request: !1799 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98622e5e72a4bb705bf88b2d442c492dad45c072 commit 98622e5e72a4bb705bf88b2d442c492dad45c072 Merge: f8adde1 81bc761 Author: Brad King AuthorDate: Fri Mar 9 12:38:15 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:38:49 2018 -0500 Merge topic 'make-clean-no-targets' 81bc7610ab Makefile: Fix "make clean" when there are no targets Acked-by: Kitware Robot Merge-request: !1833 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f8adde152f768660211e3e7e5990bc79a5de0458 commit f8adde152f768660211e3e7e5990bc79a5de0458 Merge: 72abc75 87a6816 Author: Brad King AuthorDate: Fri Mar 9 12:37:57 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 9 07:38:07 2018 -0500 Merge topic 'sort_glob_output' 87a6816baf Add test for sorting and deduping of file(GLOB) result b688d4fd22 file(GLOB): Ensure entire file list is sorted Acked-by: Kitware Robot Merge-request: !1821 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9ef3abd3f39542ecbdfda0014a7f1b4c3bea50a9 commit 9ef3abd3f39542ecbdfda0014a7f1b4c3bea50a9 Author: Rolf Eike Beer AuthorDate: Mon Mar 5 23:42:35 2018 +0100 Commit: Rolf Eike Beer CommitDate: Thu Mar 8 18:31:12 2018 +0100 FindLibXml2: provide imported target LibXml2::LibXml2 diff --git a/Help/release/dev/libxml2-target.rst b/Help/release/dev/libxml2-target.rst new file mode 100644 index 0000000..f9933d7 --- /dev/null +++ b/Help/release/dev/libxml2-target.rst @@ -0,0 +1,4 @@ +libxml2-target +-------------- + +* The :module:`FindLibXml2` module now provides imported targets. diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 8ac2980..615de49 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -7,6 +7,12 @@ # # Find the XML processing library (libxml2). # +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``LibXml2::LibXml2``, if +# libxml2 has been found. +# # Result variables # ^^^^^^^^^^^^^^^^ # @@ -87,3 +93,9 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 VERSION_VAR LIBXML2_VERSION_STRING) mark_as_advanced(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARY LIBXML2_XMLLINT_EXECUTABLE) + +if(LibXml2_FOUND AND NOT TARGET LibXml2::LibXml2) + add_library(LibXml2::LibXml2 UNKNOWN IMPORTED) + set_target_properties(LibXml2::LibXml2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBXML2_INCLUDE_DIRS}") + set_property(TARGET LibXml2::LibXml2 APPEND PROPERTY IMPORTED_LOCATION "${LIBXML2_LIBRARY}") +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index f34bc04..101502f 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1371,6 +1371,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindLibUV) endif() + if(CMake_TEST_FindLibXml2) + add_subdirectory(FindLibXml2) + endif() + if(CMake_TEST_FindLTTngUST) add_subdirectory(FindLTTngUST) endif() diff --git a/Tests/FindLibXml2/CMakeLists.txt b/Tests/FindLibXml2/CMakeLists.txt new file mode 100644 index 0000000..6c2464f --- /dev/null +++ b/Tests/FindLibXml2/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindLibXml2.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLibXml2/Test" + "${CMake_BINARY_DIR}/Tests/FindLibXml2/Test" + ${build_generator_args} + --build-project TestFindLibXml2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindLibXml2/Test/CMakeLists.txt b/Tests/FindLibXml2/Test/CMakeLists.txt new file mode 100644 index 0000000..df5d8c3 --- /dev/null +++ b/Tests/FindLibXml2/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindLibXml2 C) +include(CTest) + +find_package(LibXml2 REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_LibXml2_VERSION="${LIBXML2_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt LibXml2::LibXml2) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${LIBXML2_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${LIBXML2_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindLibXml2/Test/main.c b/Tests/FindLibXml2/Test/main.c new file mode 100644 index 0000000..264f07d --- /dev/null +++ b/Tests/FindLibXml2/Test/main.c @@ -0,0 +1,19 @@ +#include +#include +#include + +int main() +{ + xmlDoc* doc; + + xmlInitParser(); + + doc = xmlNewDoc(BAD_CAST "1.0"); + xmlFreeDoc(doc); + + assert(strstr(CMAKE_EXPECTED_LibXml2_VERSION, LIBXML_DOTTED_VERSION)); + + xmlCleanupParser(); + + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=de348a9638bd51af4523f36c68884b901d4aff18 commit de348a9638bd51af4523f36c68884b901d4aff18 Author: Arnaud Gelas AuthorDate: Mon Feb 26 13:09:08 2018 +0100 Commit: Brad King CommitDate: Thu Mar 8 10:05:14 2018 -0500 GenerateExportHeader: Add support for C projects Previously only C++ projects were supported. Fixes: #16967 diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 17a3357..e6dcd00 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -185,6 +185,7 @@ # :prop_tgt:`CXX_VISIBILITY_PRESET <_VISIBILITY_PRESET>` and # :prop_tgt:`VISIBILITY_INLINES_HIDDEN` instead. +include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) # TODO: Install this macro separately? @@ -194,6 +195,13 @@ macro(_check_cxx_compiler_attribute _ATTRIBUTE _RESULT) ) endmacro() +# TODO: Install this macro separately? +macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT) + check_c_source_compiles("${_ATTRIBUTE} int somefunc() { return 0; } + int main() { return somefunc();}" ${_RESULT} + ) +endmacro() + macro(_test_compiler_hidden_visibility) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2") @@ -213,9 +221,15 @@ macro(_test_compiler_hidden_visibility) AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom) - check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) - check_cxx_compiler_flag(-fvisibility-inlines-hidden - COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + if (CMAKE_CXX_COMPILER_LOADED) + check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_cxx_compiler_flag(-fvisibility-inlines-hidden + COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + else() + check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY) + check_c_compiler_flag(-fvisibility-inlines-hidden + COMPILER_HAS_HIDDEN_INLINE_VISIBILITY) + endif() endif() endmacro() @@ -232,14 +246,27 @@ macro(_test_compiler_has_deprecated) set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL "Compiler support for a deprecated attribute") else() - _check_cxx_compiler_attribute("__attribute__((__deprecated__))" - COMPILER_HAS_DEPRECATED_ATTR) - if(COMPILER_HAS_DEPRECATED_ATTR) - set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" - CACHE INTERNAL "Compiler support for a deprecated attribute") + if (CMAKE_CXX_COMPILER_LOADED) + _check_cxx_compiler_attribute("__attribute__((__deprecated__))" + COMPILER_HAS_DEPRECATED_ATTR) + if(COMPILER_HAS_DEPRECATED_ATTR) + set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" + CACHE INTERNAL "Compiler support for a deprecated attribute") + else() + _check_cxx_compiler_attribute("__declspec(deprecated)" + COMPILER_HAS_DEPRECATED) + endif() else() - _check_cxx_compiler_attribute("__declspec(deprecated)" - COMPILER_HAS_DEPRECATED) + _check_c_compiler_attribute("__attribute__((__deprecated__))" + COMPILER_HAS_DEPRECATED_ATTR) + if(COMPILER_HAS_DEPRECATED_ATTR) + set(COMPILER_HAS_DEPRECATED "${COMPILER_HAS_DEPRECATED_ATTR}" + CACHE INTERNAL "Compiler support for a deprecated attribute") + else() + _check_c_compiler_attribute("__declspec(deprecated)" + COMPILER_HAS_DEPRECATED) + endif() + endif() endif() endmacro() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81bc7610abe68d158683877f04fc46c2a32c3b44 commit 81bc7610abe68d158683877f04fc46c2a32c3b44 Author: Brad King AuthorDate: Thu Mar 8 09:01:53 2018 -0500 Commit: Brad King CommitDate: Thu Mar 8 09:01:53 2018 -0500 Makefile: Fix "make clean" when there are no targets The empty `clean` target was missing from `Makefile2`. Add one like we already have for `all` and `preinstall`. diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 43032fb..c92df55 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -241,6 +241,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() lg->WriteMakeRule(makefileStream, "The main recursive preinstall target", "preinstall", depends, no_commands, true); + // Write an empty clean: + lg->WriteMakeRule(makefileStream, "The main recursive clean target", "clean", + depends, no_commands, true); + // Write out the "special" stuff lg->WriteSpecialTargetsTop(makefileStream); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5901699672cce82d9622a02c4c7d22889029ee0c commit 5901699672cce82d9622a02c4c7d22889029ee0c Author: Craig Scott AuthorDate: Thu Mar 8 20:09:45 2018 +1100 Commit: Craig Scott CommitDate: Thu Mar 8 20:14:42 2018 +1100 cmDepends: Remove attempt to change directory that always fails Nothing ever set `CompileDirectory` except `SetDirectory()`, but nothing ever called that function. Therefore, `CompileDirectory` was always empty for the attempt to change directory in `Check()`, which therefore would always fail. Nothing was checking the result and the code was always going to have no effect. diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index cdab671..4716e14 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -7,7 +7,6 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSystemTools.h" -#include "cmWorkingDirectory.h" #include "cmsys/FStream.hxx" #include @@ -15,8 +14,7 @@ #include cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir) - : CompileDirectory() - , LocalGenerator(lg) + : LocalGenerator(lg) , Verbose(false) , FileComparison(nullptr) , TargetDirectory(targetDir) @@ -73,9 +71,6 @@ bool cmDepends::Finalize(std::ostream& /*unused*/, std::ostream& /*unused*/) bool cmDepends::Check(const char* makeFile, const char* internalFile, std::map& validDeps) { - // Dependency checks must be done in proper working directory. - cmWorkingDirectory workdir(this->CompileDirectory); - // Check whether dependencies must be regenerated. bool okay = true; cmsys::ifstream fin(internalFile); diff --git a/Source/cmDepends.h b/Source/cmDepends.h index a4fee3c..4b9e05a 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -31,9 +31,6 @@ public: path from the build directory to the target file. */ cmDepends(cmLocalGenerator* lg = nullptr, const char* targetDir = ""); - /** at what level will the compile be done from */ - void SetCompileDirectory(const char* dir) { this->CompileDirectory = dir; } - /** Set the local generator for the directory in which we are scanning dependencies. This is not a full local generator; it has been setup to do relative path conversions for the current @@ -95,9 +92,6 @@ protected: virtual bool Finalize(std::ostream& makeDepends, std::ostream& internalDepends); - // The directory in which the build rule for the target file is executed. - std::string CompileDirectory; - // The local generator. cmLocalGenerator* LocalGenerator; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e60e4dfc88252aaec53f0d832508d41dff6165fd commit e60e4dfc88252aaec53f0d832508d41dff6165fd Author: Craig Scott AuthorDate: Sun Mar 4 17:27:09 2018 +1100 Commit: Craig Scott CommitDate: Thu Mar 8 20:07:14 2018 +1100 cmWorkingDirectory: Check success of current dir changes diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index 9ff547a..00fbdab 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -9,6 +9,7 @@ #include "cmSystemTools.h" #include "cmWorkingDirectory.h" +#include #include #include #include @@ -51,6 +52,7 @@ int cmCPackArchiveGenerator::InitializeInternal() this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1"); return this->Superclass::InitializeInternal(); } + int cmCPackArchiveGenerator::addOneComponentToArchive( cmArchiveWrite& archive, cmCPackComponent* component) { @@ -61,6 +63,13 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( localToplevel += "/" + component->Name; // Change to local toplevel cmWorkingDirectory workdir(localToplevel); + if (workdir.Failed()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed to change working directory to " + << localToplevel << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + return 0; + } std::string filePrefix; if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME"); @@ -237,6 +246,13 @@ int cmCPackArchiveGenerator::PackageFiles() // CASE 3 : NON COMPONENT package. DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0], archive); cmWorkingDirectory workdir(toplevel); + if (workdir.Failed()) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Failed to change working directory to " + << toplevel << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + return 0; + } for (std::string const& file : files) { // Get the relative path to the file std::string rp = cmSystemTools::RelativePath(toplevel, file); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index d838b30..d41a9e5 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -6,6 +6,7 @@ #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" #include +#include #include // IWYU pragma: keep #include @@ -404,6 +405,13 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( cmCPackLogger(cmCPackLog::LOG_DEBUG, "Change dir to: " << goToDir << std::endl); cmWorkingDirectory workdir(goToDir); + if (workdir.Failed()) { + cmCPackLogger( + cmCPackLog::LOG_ERROR, "Failed to change working directory to " + << goToDir << " : " << std::strerror(workdir.GetLastResult()) + << std::endl); + return 0; + } for (auto const& symlinked : symlinkedFiles) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " << symlinked.second << "--> " << symlinked.first diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 2e1ea4c..b2c68e7 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -11,6 +11,7 @@ #include "cmsys/Process.h" #include +#include #include #include @@ -196,6 +197,16 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) cmSystemTools::MakeDirectory(this->BinaryDir); } cmWorkingDirectory workdir(this->BinaryDir); + if (workdir.Failed()) { + auto msg = "Failed to change working directory to " + this->BinaryDir + + " : " + std::strerror(workdir.GetLastResult()) + "\n"; + if (outstring) { + *outstring = msg; + } else { + cmCTestLog(this->CTest, ERROR_MESSAGE, msg); + } + return 1; + } if (this->BuildNoCMake) { // Make the generator available for the Build call below. @@ -307,7 +318,16 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // run the test from the this->BuildRunDir if set if (!this->BuildRunDir.empty()) { out << "Run test in directory: " << this->BuildRunDir << "\n"; - cmSystemTools::ChangeDirectory(this->BuildRunDir); + if (!workdir.SetDirectory(this->BuildRunDir)) { + out << "Failed to change working directory : " + << std::strerror(workdir.GetLastResult()) << "\n"; + if (outstring) { + *outstring = out.str(); + } else { + cmCTestLog(this->CTest, ERROR_MESSAGE, out.str()); + } + return 1; + } } out << "Running test command: \"" << fullPath << "\""; for (std::string const& testCommandArg : this->TestCommandArgs) { diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 9c66e73..6cf0ac2 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -23,6 +23,7 @@ #include "cmsys/RegularExpression.hxx" #include #include +#include #include #include #include @@ -975,7 +976,12 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string testingDir = this->CTest->GetBinaryDir() + "/Testing"; std::string tempDir = testingDir + "/CoverageInfo"; - cmSystemTools::MakeDirectory(tempDir); + if (!cmSystemTools::MakeDirectory(tempDir)) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to make directory: " << tempDir << std::endl); + cont->Error++; + return 0; + } cmWorkingDirectory workdir(tempDir); int gcovStyle = 0; @@ -1376,6 +1382,14 @@ int cmCTestCoverageHandler::HandleLCovCoverage( this->Quiet); std::string fileDir = cmSystemTools::GetFilenamePath(f); cmWorkingDirectory workdir(fileDir); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to change working directory to " + << fileDir << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + cont->Error++; + continue; + } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Current coverage dir: " << fileDir << std::endl, @@ -1600,6 +1614,12 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector& files) gl.RecurseThroughSymlinksOff(); std::string buildDir = this->CTest->GetCTestConfiguration("BuildDirectory"); cmWorkingDirectory workdir(buildDir); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Unable to change working directory to " << buildDir + << std::endl); + return false; + } // Run profmerge to merge all *.dyn files into dpi files if (!cmSystemTools::RunSingleCommand("profmerge")) { diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 5a7baf5..1fff2fa 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -9,6 +9,7 @@ #include "cmWorkingDirectory.h" #include "cmake.h" +#include #include #include @@ -218,6 +219,21 @@ bool cmCTestHandlerCommand::InitialPass(std::vector const& args, } cmWorkingDirectory workdir( this->CTest->GetCTestConfiguration("BuildDirectory")); + if (workdir.Failed()) { + this->SetError("failed to change directory to " + + this->CTest->GetCTestConfiguration("BuildDirectory") + + " : " + std::strerror(workdir.GetLastResult())); + if (capureCMakeError) { + this->Makefile->AddDefinition(this->Values[ct_CAPTURE_CMAKE_ERROR], + "-1"); + cmCTestLog(this->CTest, ERROR_MESSAGE, this->GetName() + << " " << this->GetError() << "\n"); + // return success because failure is recorded in CAPTURE_CMAKE_ERROR + return true; + } + return false; + } + int res = handler->ProcessHandler(); if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) { std::ostringstream str; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 50c2d86..a8bf1e5 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -151,13 +152,19 @@ bool cmCTestMultiProcessHandler::StartTestProcess(int test) } } - cmWorkingDirectory workdir(this->Properties[test]->Directory); - - // Lock the resources we'll be using + // Always lock the resources we'll be using, even if we fail to set the + // working directory because FinishTestProcess() will try to unlock them this->LockResources(test); - if (testRun->StartTest(this->Total)) { - return true; + cmWorkingDirectory workdir(this->Properties[test]->Directory); + if (workdir.Failed()) { + testRun->StartFailure("Failed to change working directory to " + + this->Properties[test]->Directory + " : " + + std::strerror(workdir.GetLastResult())); + } else { + if (testRun->StartTest(this->Total)) { + return true; + } } this->FinishTestProcess(testRun, false); @@ -666,6 +673,8 @@ void cmCTestMultiProcessHandler::PrintTestList() count++; cmCTestTestHandler::cmCTestTestProperties& p = *it.second; + // Don't worry if this fails, we are only showing the test list, not + // running the tests cmWorkingDirectory workdir(p.Directory); cmCTestRunTest testRun(*this); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 30ad38c..32ecdc0 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -14,6 +14,7 @@ #include "cmsys/RegularExpression.hxx" #include #include +#include #include #include #include @@ -248,11 +249,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) *this->TestHandler->LogFile << "Test time = " << buf << std::endl; } - // Set the working directory to the tests directory to process Dart files. - { - cmWorkingDirectory workdir(this->TestProperties->Directory); - this->DartProcessing(); - } + this->DartProcessing(); // if this is doing MemCheck then all the output needs to be put into // Output since that is what is parsed by cmCTestMemCheckHandler @@ -338,6 +335,13 @@ bool cmCTestRunTest::StartAgain() this->RunAgain = false; // reset // change to tests directory cmWorkingDirectory workdir(this->TestProperties->Directory); + if (workdir.Failed()) { + this->StartFailure("Failed to change working directory to " + + this->TestProperties->Directory + " : " + + std::strerror(workdir.GetLastResult())); + return true; + } + this->StartTest(this->TotalNumberOfTests); return true; } @@ -386,6 +390,37 @@ void cmCTestRunTest::MemCheckPostProcess() handler->PostProcessTest(this->TestResult, this->Index); } +void cmCTestRunTest::StartFailure(std::string const& output) +{ + // Still need to log the Start message so the test summary records our + // attempt to start this test + cmCTestLog(this->CTest, HANDLER_OUTPUT, + std::setw(2 * getNumWidth(this->TotalNumberOfTests) + 8) + << "Start " + << std::setw(getNumWidth(this->TestHandler->GetMaxIndex())) + << this->TestProperties->Index << ": " + << this->TestProperties->Name << std::endl); + + this->ProcessOutput.clear(); + if (!output.empty()) { + *this->TestHandler->LogFile << output << std::endl; + cmCTestLog(this->CTest, ERROR_MESSAGE, output << std::endl); + } + + this->TestResult.Properties = this->TestProperties; + this->TestResult.ExecutionTime = cmDuration::zero(); + this->TestResult.CompressOutput = false; + this->TestResult.ReturnValue = -1; + this->TestResult.CompletionStatus = "Failed to start"; + this->TestResult.Status = cmCTestTestHandler::NOT_RUN; + this->TestResult.TestCount = this->TestProperties->Index; + this->TestResult.Name = this->TestProperties->Name; + this->TestResult.Path = this->TestProperties->Directory; + this->TestResult.Output = output; + this->TestResult.FullCommandLine.clear(); + this->TestProcess = cm::make_unique(*this); +} + // Starts the execution of a test. Returns once it has started bool cmCTestRunTest::StartTest(size_t total) { diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 4d57357..256fe92 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -74,6 +74,8 @@ public: bool StartAgain(); + void StartFailure(std::string const& output); + cmCTest* GetCTest() const { return this->CTest; } void FinalizeTest(); diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 08d05c8..3bab81e 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,6 +7,7 @@ #include "cm_jsoncpp_value.h" #include "cmsys/Process.h" #include +#include #include #include #include @@ -1532,6 +1533,15 @@ int cmCTestSubmitHandler::ProcessHandler() // change to the build directory so that we can uses a relative path // on windows since scp doesn't support "c:" a drive in the path cmWorkingDirectory workdir(buildDirectory); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Failed to change directory to " + << buildDirectory << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + ofs << " Failed to change directory to " << buildDirectory << " : " + << std::strerror(workdir.GetLastResult()) << std::endl; + return -1; + } if (!this->SubmitUsingSCP(this->CTest->GetCTestConfiguration("ScpCommand"), "Testing/" + this->CTest->GetCurrentTag(), files, @@ -1551,6 +1561,15 @@ int cmCTestSubmitHandler::ProcessHandler() // change to the build directory so that we can uses a relative path // on windows since scp doesn't support "c:" a drive in the path cmWorkingDirectory workdir(buildDirectory); + if (workdir.Failed()) { + cmCTestLog(this->CTest, ERROR_MESSAGE, + " Failed to change directory to " + << buildDirectory << " : " + << std::strerror(workdir.GetLastResult()) << std::endl); + ofs << " Failed to change directory to " << buildDirectory << " : " + << std::strerror(workdir.GetLastResult()) << std::endl; + return -1; + } cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " Change directory: " << buildDirectory << std::endl, this->Quiet); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 84d8926..7ea8fc3 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -14,7 +15,6 @@ #include #include #include -#include #include #include "cmAlgorithms.h" @@ -85,6 +85,11 @@ bool cmCTestSubdirCommand::InitialPass(std::vector const& args, bool readit = false; { cmWorkingDirectory workdir(fname); + if (workdir.Failed()) { + this->SetError("Failed to change directory to " + fname + " : " + + std::strerror(workdir.GetLastResult())); + return false; + } const char* testFilename; if (cmSystemTools::FileExists("CTestTestfile.cmake")) { // does the CTestTestfile.cmake exist ? diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index c805b98..f9eb90f 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -6,11 +6,11 @@ #include "cmsys/FStream.hxx" #include #include +#include #include #include #include #include -#include #if defined(_WIN32) && !defined(__CYGWIN__) #include @@ -1806,6 +1806,8 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, cmSystemTools::OutputOption outputflag, std::vector const& nativeOptions) { + bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); + /** * Run an executable command and put the stdout in output. */ @@ -1813,9 +1815,17 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/, output += "Change Dir: "; output += bindir; output += "\n"; + if (workdir.Failed()) { + cmSystemTools::SetRunCommandHideConsole(hideconsole); + cmSystemTools::Error("Failed to change directory: ", + std::strerror(workdir.GetLastResult())); + output += "Failed to change directory: "; + output += std::strerror(workdir.GetLastResult()); + output += "\n"; + return 1; + } int retVal; - bool hideconsole = cmSystemTools::GetRunCommandHideConsole(); cmSystemTools::SetRunCommandHideConsole(true); std::string outputBuffer; std::string* outputPtr = &outputBuffer; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 47d75af..a21600d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -6,12 +6,12 @@ #include "cmsys/RegularExpression.hxx" #include #include +#include #include #include #include // IWYU pragma: keep #include #include -#include #include #include "cmAlgorithms.h" @@ -3250,6 +3250,14 @@ int cmMakefile::TryCompile(const std::string& srcdir, // change to the tests directory and run cmake // use the cmake object instead of calling cmake cmWorkingDirectory workdir(bindir); + if (workdir.Failed()) { + this->IssueMessage(cmake::FATAL_ERROR, + "Failed to set working directory to " + bindir + " : " + + std::strerror(workdir.GetLastResult())); + cmSystemTools::SetFatalErrorOccured(); + this->IsSourceFileTryCompile = false; + return 1; + } // make sure the same generator is used // use this program as the cmake to be run, it should not diff --git a/Source/cmWorkingDirectory.cxx b/Source/cmWorkingDirectory.cxx index 99c9ba8..816f104 100644 --- a/Source/cmWorkingDirectory.cxx +++ b/Source/cmWorkingDirectory.cxx @@ -4,10 +4,12 @@ #include "cmSystemTools.h" +#include + cmWorkingDirectory::cmWorkingDirectory(std::string const& newdir) { this->OldDir = cmSystemTools::GetCurrentWorkingDirectory(); - cmSystemTools::ChangeDirectory(newdir); + this->SetDirectory(newdir); } cmWorkingDirectory::~cmWorkingDirectory() @@ -15,10 +17,20 @@ cmWorkingDirectory::~cmWorkingDirectory() this->Pop(); } +bool cmWorkingDirectory::SetDirectory(std::string const& newdir) +{ + if (cmSystemTools::ChangeDirectory(newdir) == 0) { + this->ResultCode = 0; + return true; + } + this->ResultCode = errno; + return false; +} + void cmWorkingDirectory::Pop() { if (!this->OldDir.empty()) { - cmSystemTools::ChangeDirectory(this->OldDir); + this->SetDirectory(this->OldDir); this->OldDir.clear(); } } diff --git a/Source/cmWorkingDirectory.h b/Source/cmWorkingDirectory.h index aff9267..1f18ce7 100644 --- a/Source/cmWorkingDirectory.h +++ b/Source/cmWorkingDirectory.h @@ -9,6 +9,12 @@ /** \class cmWorkingDirectory * \brief An RAII class to manipulate the working directory. + * + * The current working directory is set to the location given to the + * constructor. The working directory can be changed again as needed + * by calling SetDirectory(). When the object is destroyed, the destructor + * will restore the working directory to what it was when the object was + * created, regardless of any calls to SetDirectory() in the meantime. */ class cmWorkingDirectory { @@ -16,10 +22,21 @@ public: cmWorkingDirectory(std::string const& newdir); ~cmWorkingDirectory(); + bool SetDirectory(std::string const& newdir); void Pop(); + bool Failed() const { return ResultCode != 0; } + + /** \return 0 if the last attempt to set the working directory was + * successful. If it failed, the value returned will be the + * \c errno value associated with the failure. A description + * of the error code can be obtained by passing the result + * to \c std::strerror(). + */ + int GetLastResult() const { return ResultCode; } private: std::string OldDir; + int ResultCode; }; #endif diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f4f4a15..323bcf6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -98,13 +98,13 @@ #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" #include +#include #include #include #include // IWYU pragma: keep #include #include #include -#include #include namespace { @@ -2209,6 +2209,15 @@ int cmake::GetSystemInformation(std::vector& args) { // now run cmake on the CMakeLists file cmWorkingDirectory workdir(destPath); + if (workdir.Failed()) { + // We created the directory and we were able to copy the CMakeLists.txt + // file to it, so we wouldn't expect to get here unless the default + // permissions are questionable or some other process has deleted the + // directory + std::cerr << "Failed to change to directory " << destPath << " : " + << std::strerror(workdir.GetLastResult()) << std::endl; + return 1; + } std::vector args2; args2.push_back(args[0]); args2.push_back(destPath); diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt new file mode 100644 index 0000000..da89317 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt @@ -0,0 +1 @@ +Failed to change working directory to .*[/\\]buildAndTestNoBuildDir[/\\]CMakeLists.txt : diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt new file mode 100644 index 0000000..3cea890 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt @@ -0,0 +1 @@ +Failed to change working directory to .*[/\\]dirNotExist-build[/\\]thisDirWillNotExist : https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87a6816bafdf545e81a468b393173353164039a5 commit 87a6816bafdf545e81a468b393173353164039a5 Author: Shane Parris AuthorDate: Mon Mar 5 21:57:14 2018 -0500 Commit: Shane Parris CommitDate: Wed Mar 7 12:12:19 2018 -0500 Add test for sorting and deduping of file(GLOB) result diff --git a/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt b/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt new file mode 100644 index 0000000..d2565e4 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt @@ -0,0 +1,2 @@ +content: 7[ ] +1aAb/\.hide;1aAb/1\.log;1aAb/1\.txt;1aAb/xkcd\.txt;a/1\.log;a/1\.txt;a/boot\.ini diff --git a/Tests/RunCMake/file/GLOB-sort-dedup.cmake b/Tests/RunCMake/file/GLOB-sort-dedup.cmake new file mode 100644 index 0000000..1e1c579 --- /dev/null +++ b/Tests/RunCMake/file/GLOB-sort-dedup.cmake @@ -0,0 +1,21 @@ +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/a") +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/1.log" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/1.txt" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/a/boot.ini" "") + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/.hide" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/1.txt" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/1.log" "") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/test/1aAb/xkcd.txt" "") + +file(GLOB CONTENT_LIST + LIST_DIRECTORIES false + RELATIVE "${CMAKE_CURRENT_BINARY_DIR}/test" + "${CMAKE_CURRENT_BINARY_DIR}/test/a/*" + "${CMAKE_CURRENT_BINARY_DIR}/test/*/*" + ) +list(LENGTH CONTENT_LIST CONTENT_COUNT) +message("content: ${CONTENT_COUNT} ") +message("${CONTENT_LIST}") diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 27305d0..4aab32d 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -38,6 +38,7 @@ run_cmake(GLOB_RECURSE) run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) # tests are valid both for GLOB and GLOB_RECURSE +run_cmake(GLOB-sort-dedup) run_cmake(GLOB-error-FOLLOW_SYMLINKS) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b688d4fd22850c287f191f142660781ded72e919 commit b688d4fd22850c287f191f142660781ded72e919 Author: Shane Parris AuthorDate: Mon Mar 5 14:31:16 2018 -0500 Commit: Shane Parris CommitDate: Wed Mar 7 12:12:19 2018 -0500 file(GLOB): Ensure entire file list is sorted diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index b5215a5..90b943b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -757,8 +757,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } } - std::ostringstream outputStream; - bool first = true; + std::vector files; bool warnFollowedSymlinks = false; while (i != args.end()) { if (*i == "LIST_DIRECTORIES") { @@ -848,15 +847,8 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, warnFollowedSymlinks = true; } - std::vector& files = g.GetFiles(); - std::sort(files.begin(), files.end()); - for (std::string const& file : files) { - if (!first) { - outputStream << ";"; - } - outputStream << file; - first = false; - } + std::vector& foundFiles = g.GetFiles(); + files.insert(files.end(), foundFiles.begin(), foundFiles.end()); ++i; } } @@ -880,7 +872,10 @@ bool cmFileCommand::HandleGlobCommand(std::vector const& args, } break; } - this->Makefile->AddDefinition(variable, outputStream.str().c_str()); + + std::sort(files.begin(), files.end()); + files.erase(std::unique(files.begin(), files.end()), files.end()); + this->Makefile->AddDefinition(variable, cmJoin(files, ";").c_str()); return true; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff5823f5125309fcf6f5a1e016ca267091d81e16 commit ff5823f5125309fcf6f5a1e016ca267091d81e16 Author: Rolf Eike Beer AuthorDate: Tue Mar 6 18:13:33 2018 +0100 Commit: Rolf Eike Beer CommitDate: Tue Mar 6 18:13:33 2018 +0100 cmOutputConverter: mark helper functions static This allows the linker to entirely drop any symbols of the functions. diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 6519dd9..fd42c53 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -342,13 +342,12 @@ use the caret character itself (^), use two in a row (^^). */ /* Some helpers to identify character classes */ -namespace { -inline int Shell__CharIsWhitespace(char c) +static int Shell__CharIsWhitespace(char c) { return ((c == ' ') || (c == '\t')); } -inline int Shell__CharNeedsQuotesOnUnix(char c) +static int Shell__CharNeedsQuotesOnUnix(char c) { return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || (c == '&') || (c == '$') || (c == '(') || (c == ')') || (c == '~') || @@ -356,17 +355,16 @@ inline int Shell__CharNeedsQuotesOnUnix(char c) (c == '\\')); } -inline int Shell__CharNeedsQuotesOnWindows(char c) +static int Shell__CharNeedsQuotesOnWindows(char c) { return ((c == '\'') || (c == '#') || (c == '&') || (c == '<') || (c == '>') || (c == '|') || (c == '^')); } -inline int Shell__CharIsMakeVariableName(char c) +static int Shell__CharIsMakeVariableName(char c) { return c && (c == '_' || isalpha((static_cast(c)))); } -} int cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags) { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e654622aee22655c418a9c663fad79243ca0c819 commit e654622aee22655c418a9c663fad79243ca0c819 Author: Craig Scott AuthorDate: Sun Mar 4 21:30:35 2018 +1100 Commit: Craig Scott CommitDate: Sun Mar 4 22:27:59 2018 +1100 Tests: Add --build-and-test test case Checks that giving an invalid build directory to ctest --build-and-test will fail. diff --git a/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake index a57cacb..a7685ae 100644 --- a/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake +++ b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake @@ -1,3 +1,9 @@ include(RunCTest) run_ctest(dirNotExist) +run_ctest(buildAndTestNoBuildDir + --build-and-test + ${RunCMake_BINARY_DIR}/buildAndTestNoBuildDir + ${RunCMake_BINARY_DIR}/buildAndTestNoBuildDir/CMakeLists.txt # Deliberately a file + --build-generator "${RunCMake_GENERATOR}" +) diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake new file mode 100644 index 0000000..fcfe461 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake @@ -0,0 +1,3 @@ +if(EXISTS ${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt) + set(RunCMake_TEST_FAILED "Default build dir ${RunCMake_TEST_BINARY_DIR} was used, should not have been") +endif() diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt new file mode 100644 index 0000000..0617a38 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt @@ -0,0 +1 @@ +^[^0][0-9]*$ diff --git a/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake new file mode 100644 index 0000000..ad795c4 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake @@ -0,0 +1,7 @@ +# We want a single test that always passes. We should never actually get to +# configure with this file, so we use a successful configure-build-test +# sequence to denote failure of the test case. +include(CTest) +add_test(NAME willPass + COMMAND ${CMAKE_COMMAND} -E touch someFile.txt +) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a865f0beb2e9f8d92e021855c773ab90eaf24581 commit a865f0beb2e9f8d92e021855c773ab90eaf24581 Author: Craig Scott AuthorDate: Sun Mar 4 18:59:04 2018 +1100 Commit: Craig Scott CommitDate: Sun Mar 4 22:27:59 2018 +1100 Tests: Confirm test working dir set successfully Specifically, this tests that setting WORKING_DIRECTORY to an invalid directory results in the test failing. diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 31069fa..09a0093 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -188,6 +188,7 @@ if (QT4_FOUND) endif() add_RunCMake_test(CompatibleInterface) add_RunCMake_test(Syntax) +add_RunCMake_test(WorkingDirectory) add_RunCMake_test(add_custom_command) add_RunCMake_test(add_custom_target) diff --git a/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in b/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in new file mode 100644 index 0000000..46047b8 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.11) +project(@CASE_NAME@ NONE) +include("@RunCMake_SOURCE_DIR@/@CASE_NAME at .cmake") diff --git a/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in b/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in new file mode 100644 index 0000000..0226230 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in @@ -0,0 +1 @@ +set(CTEST_PROJECT_NAME "CTestTestWorkingDir. at CASE_NAME@") diff --git a/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake new file mode 100644 index 0000000..a57cacb --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCTest) + +run_ctest(dirNotExist) diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt new file mode 100644 index 0000000..b57e2de --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-result.txt @@ -0,0 +1 @@ +(-1|255) diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt b/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt new file mode 100644 index 0000000..58aa6e4 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt @@ -0,0 +1,10 @@ +Test project .*/Tests/RunCMake/WorkingDirectory/dirNotExist-build +.* +Start 1: dirNotExist +1/1 Test #1: dirNotExist +\.+\*\*\*Not Run +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +.* +1 - dirNotExist \(Not Run\)$ diff --git a/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake b/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake new file mode 100644 index 0000000..642386e --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/dirNotExist.cmake @@ -0,0 +1,6 @@ +include(CTest) + +add_test(NAME dirNotExist + COMMAND ${CMAKE_COMMAND} -E touch someFile.txt + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thisDirWillNotExist +) diff --git a/Tests/RunCMake/WorkingDirectory/test.cmake.in b/Tests/RunCMake/WorkingDirectory/test.cmake.in new file mode 100644 index 0000000..8eccd79 --- /dev/null +++ b/Tests/RunCMake/WorkingDirectory/test.cmake.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.11) + +set(CTEST_SITE "test-site") +set(CTEST_BUILD_NAME "test-build-name") +set(CTEST_SOURCE_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME@") +set(CTEST_BINARY_DIRECTORY "@RunCMake_BINARY_DIR@/@CASE_NAME at -build") +set(CTEST_CMAKE_GENERATOR "@RunCMake_GENERATOR@") +set(CTEST_CMAKE_GENERATOR_PLATFORM "@RunCMake_GENERATOR_PLATFORM@") +set(CTEST_CMAKE_GENERATOR_TOOLSET "@RunCMake_GENERATOR_TOOLSET@") +set(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") + +ctest_start(Experimental) +ctest_configure() +ctest_build() +ctest_test() ----------------------------------------------------------------------- Summary of changes: Help/release/dev/libxml2-target.rst | 4 ++ Modules/FindLibXml2.cmake | 12 +++++ Modules/GenerateExportHeader.cmake | 47 +++++++++++++++----- Source/CPack/cmCPackArchiveGenerator.cxx | 16 +++++++ Source/CPack/cmCPackGenerator.cxx | 8 ++++ Source/CTest/cmCTestBuildAndTestHandler.cxx | 22 ++++++++- Source/CTest/cmCTestCoverageHandler.cxx | 22 ++++++++- Source/CTest/cmCTestHandlerCommand.cxx | 16 +++++++ Source/CTest/cmCTestMultiProcessHandler.cxx | 19 +++++--- Source/CTest/cmCTestRunTest.cxx | 45 ++++++++++++++++--- Source/CTest/cmCTestRunTest.h | 2 + Source/CTest/cmCTestSubmitHandler.cxx | 19 ++++++++ Source/CTest/cmCTestTestHandler.cxx | 7 ++- Source/cmDepends.cxx | 7 +-- Source/cmDepends.h | 6 --- Source/cmFileCommand.cxx | 19 +++----- Source/cmGlobalGenerator.cxx | 14 +++++- Source/cmGlobalUnixMakefileGenerator3.cxx | 4 ++ Source/cmMakefile.cxx | 10 ++++- Source/cmOutputConverter.cxx | 10 ++--- Source/cmWorkingDirectory.cxx | 16 ++++++- Source/cmWorkingDirectory.h | 17 +++++++ Source/cmake.cxx | 11 ++++- Tests/CMakeLists.txt | 4 ++ Tests/FindLibXml2/CMakeLists.txt | 10 +++++ Tests/FindLibXml2/Test/CMakeLists.txt | 16 +++++++ Tests/FindLibXml2/Test/main.c | 19 ++++++++ Tests/RunCMake/CMakeLists.txt | 1 + Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in | 3 ++ .../RunCMake/WorkingDirectory/CTestConfig.cmake.in | 1 + Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake | 9 ++++ .../buildAndTestNoBuildDir-check.cmake | 3 ++ .../buildAndTestNoBuildDir-result.txt | 1 + .../buildAndTestNoBuildDir-stdout.txt | 1 + .../WorkingDirectory/buildAndTestNoBuildDir.cmake | 7 +++ .../dirNotExist-result.txt} | 0 .../WorkingDirectory/dirNotExist-stderr.txt | 1 + .../WorkingDirectory/dirNotExist-stdout.txt | 10 +++++ Tests/RunCMake/WorkingDirectory/dirNotExist.cmake | 6 +++ Tests/RunCMake/WorkingDirectory/test.cmake.in | 15 +++++++ Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt | 2 + Tests/RunCMake/file/GLOB-sort-dedup.cmake | 21 +++++++++ Tests/RunCMake/file/RunCMakeTest.cmake | 1 + 43 files changed, 425 insertions(+), 59 deletions(-) create mode 100644 Help/release/dev/libxml2-target.rst create mode 100644 Tests/FindLibXml2/CMakeLists.txt create mode 100644 Tests/FindLibXml2/Test/CMakeLists.txt create mode 100644 Tests/FindLibXml2/Test/main.c create mode 100644 Tests/RunCMake/WorkingDirectory/CMakeLists.txt.in create mode 100644 Tests/RunCMake/WorkingDirectory/CTestConfig.cmake.in create mode 100644 Tests/RunCMake/WorkingDirectory/RunCMakeTest.cmake create mode 100644 Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-check.cmake create mode 100644 Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-result.txt create mode 100644 Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir-stdout.txt create mode 100644 Tests/RunCMake/WorkingDirectory/buildAndTestNoBuildDir.cmake copy Tests/RunCMake/{ctest_build/BuildFailure-result.txt => WorkingDirectory/dirNotExist-result.txt} (100%) create mode 100644 Tests/RunCMake/WorkingDirectory/dirNotExist-stderr.txt create mode 100644 Tests/RunCMake/WorkingDirectory/dirNotExist-stdout.txt create mode 100644 Tests/RunCMake/WorkingDirectory/dirNotExist.cmake create mode 100644 Tests/RunCMake/WorkingDirectory/test.cmake.in create mode 100644 Tests/RunCMake/file/GLOB-sort-dedup-stderr.txt create mode 100644 Tests/RunCMake/file/GLOB-sort-dedup.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 07:55:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 07:55:03 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-200-g6422a02 Message-ID: <20180309125503.C2CA81078E6@public.kitware.com> 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, master has been updated via 6422a0209c349e8e39cb5a2dd5114422bd1dd829 (commit) via 760c6c08a5f5ba6390f40a7dddb499bd7f16c702 (commit) via 6f2f9ce331179091c6d5c75d78cdf3f67255ded1 (commit) from 6e56f288083e7cd21d67756b1034604d9184b9b4 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6422a0209c349e8e39cb5a2dd5114422bd1dd829 commit 6422a0209c349e8e39cb5a2dd5114422bd1dd829 Merge: 6e56f28 760c6c0 Author: Brad King AuthorDate: Fri Mar 9 07:45:30 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 07:45:30 2018 -0500 Merge branch 'release-3.10' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=760c6c08a5f5ba6390f40a7dddb499bd7f16c702 commit 760c6c08a5f5ba6390f40a7dddb499bd7f16c702 Merge: c1e087a 6f2f9ce Author: Brad King AuthorDate: Fri Mar 9 06:51:38 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 06:59:19 2018 -0500 Merge branch 'autogen-empty-source-file-fix' into release-3.10 There is no corresponding merge request because this fix was cherry-picked specifically for CMake 3.10. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6f2f9ce331179091c6d5c75d78cdf3f67255ded1 commit 6f2f9ce331179091c6d5c75d78cdf3f67255ded1 Author: Sebastian Holtermann AuthorDate: Fri Mar 9 09:40:59 2018 +0100 Commit: Brad King CommitDate: Fri Mar 9 06:51:14 2018 -0500 Autogen: Fix for the empty source file crash in 3.10.2 Issue: #17793 diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a9c9b9d..f91ebb2 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -80,15 +80,21 @@ static bool ReadFile(std::string& content, std::string const& filename, std::size_t const length = cmSystemTools::FileLength(filename); cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); if (ifs) { - content.resize(length); - ifs.read(&content.front(), content.size()); - if (ifs) { - success = true; + if (length > 0) { + content.resize(length); + ifs.read(&content.front(), content.size()); + if (ifs) { + success = true; + } else { + content.clear(); + if (error != nullptr) { + error->append("Reading from the file failed."); + } + } } else { + // Readable but empty file content.clear(); - if (error != nullptr) { - error->append("Reading from the file failed."); - } + success = true; } } else if (error != nullptr) { error->append("Opening the file for reading failed."); ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 10:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 10:35:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc2-202-g8c96f6e Message-ID: <20180309153505.6ED9310AB62@public.kitware.com> 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, master has been updated via 8c96f6ebbd4adda14023d257adc7d0541de7eca1 (commit) via c5541cf0da1093635fea7da5a40e64e481b5477e (commit) from 6422a0209c349e8e39cb5a2dd5114422bd1dd829 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c96f6ebbd4adda14023d257adc7d0541de7eca1 commit 8c96f6ebbd4adda14023d257adc7d0541de7eca1 Merge: 6422a02 c5541cf Author: Brad King AuthorDate: Fri Mar 9 10:26:40 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 10:26:40 2018 -0500 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 10:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 10:35:05 -0500 (EST) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc2-11-gc5541cf Message-ID: <20180309153505.7F6C910AB76@public.kitware.com> 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, release has been updated via c5541cf0da1093635fea7da5a40e64e481b5477e (commit) from 57f35bba84f53300641c6a597b4eca728f02874a (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 9 10:45:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 9 Mar 2018 10:45:02 -0500 (EST) Subject: [Cmake-commits] CMake annotated tag, v3.11.0-rc3, created. v3.11.0-rc3 Message-ID: <20180309154502.D192FFBC0E@public.kitware.com> 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 annotated tag, v3.11.0-rc3 has been created at 9485501bc22077d28fc76a61c77fc78bec8d3da6 (tag) tagging c5541cf0da1093635fea7da5a40e64e481b5477e (commit) replaces v3.11.0-rc2 tagged by Brad King on Fri Mar 9 10:29:26 2018 -0500 - Log ----------------------------------------------------------------- CMake 3.11.0-rc3 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlqiqFYWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhJeID/4u7g/3kMcVE6fBLUDURwolDJ1e Zb6FNNbejuYM3aMLyxUQYOXLvZdw8FCX8yK3saMclEXw/dZ2fWdnTk7HaX69a+FF qkUy7sUHrBPMqQ2S9GN6s4Phxs3A2xiaNdO3Rf6SnXdsRr0xFpEE4VyNXs+EnFYw Y7tfzJNcEXhEcsEkgXY309cTMhFTFDvKySeJmyav/jAp+KVs+cTdJe1fKqO2Za0w u++ltYAt/hY0Qp7YEAyVUIoWN6fHHYEdk4E1iGjUBr+0dO60xexDa7/V519/hAOE DYLPpVF9zUhqgofMH5vmPZg4URTFPNnJILdRcb4Y/WzWCD/lZnJwTX9EUMApEJwv m8j4xeC5n8eBwxWowRS/WeRdDxDb+E/8Bu6fb4YdmiqxDl0hKQV11fdWz8umWv9i Ee8ZInt4CE5JPMMKzuTNY558OXZ7jDBq5eTmL5qlfuB9A1bbaJqGRqGs089tuf+G 6tjj/+h41AVvQWxp0igQn+lFRMsZiLBMwogIqjFdostLvwnoEA4GqXOS2gf2nuZZ nzQNE4rU1eBHw7cZ7KZoaIvYa5Xzj9atZSyPTld5i4x7naGswGS/ivybTc4oNsnk ER4VaXIM00u3OJZ5jy+p2RfXc9WfkfPLe5yoJtYDlyl1wd2rK1Hl+IZFLu/5oWm+ fGaL08LsqXHaFko6lQ== =X7tb -----END PGP SIGNATURE----- Brad King (8): XL: Recognize compilers identified by __ibmxl__ Merge branch 'xl-new-compiler-macros' into release-3.11 Merge branch 'autogen-empty-source-file-fix' into release-3.11 Merge branch 'upstream-KWSys' into update-kwsys Merge branch 'update-kwsys' into release-3.11 CUDA: Do not pass unsupported @rspfile arguments to NVCC Merge branch 'cuda-no-device-link-rsp' into release-3.11 CMake 3.11.0-rc3 KWSys Upstream (1): KWSys 2018-03-07 (2ad561e7) Sebastian Holtermann (1): Autogen: Check if a file is empty before reading it ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 10 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 10 Mar 2018 00:05:08 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-192-g6dbdfab Message-ID: <20180310050508.82C4A10A9FD@public.kitware.com> 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, master has been updated via 6dbdfab1a95bbb8d06e88a262325bf4d2eaa7051 (commit) from 8c96f6ebbd4adda14023d257adc7d0541de7eca1 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6dbdfab1a95bbb8d06e88a262325bf4d2eaa7051 commit 6dbdfab1a95bbb8d06e88a262325bf4d2eaa7051 Author: Kitware Robot AuthorDate: Sat Mar 10 00:01:12 2018 -0500 Commit: Kitware Robot CommitDate: Sat Mar 10 00:01:12 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6823116..a843618 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180309) +set(CMake_VERSION_PATCH 20180310) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 11 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 11 Mar 2018 00:05:06 -0500 (EST) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-193-gc703972 Message-ID: <20180311050506.81F1F10AAEA@public.kitware.com> 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, master has been updated via c703972694874acc0c9921dcb1190700d98eb3c2 (commit) from 6dbdfab1a95bbb8d06e88a262325bf4d2eaa7051 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c703972694874acc0c9921dcb1190700d98eb3c2 commit c703972694874acc0c9921dcb1190700d98eb3c2 Author: Kitware Robot AuthorDate: Sun Mar 11 00:01:06 2018 -0500 Commit: Kitware Robot CommitDate: Sun Mar 11 00:01:06 2018 -0500 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a843618..2984ced 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180310) +set(CMake_VERSION_PATCH 20180311) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 12 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 12 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-194-gb340cac Message-ID: <20180312040505.6181910B093@public.kitware.com> 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, master has been updated via b340cacde869102b2b548b2e7ebc7341334f1d58 (commit) from c703972694874acc0c9921dcb1190700d98eb3c2 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b340cacde869102b2b548b2e7ebc7341334f1d58 commit b340cacde869102b2b548b2e7ebc7341334f1d58 Author: Kitware Robot AuthorDate: Mon Mar 12 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Mon Mar 12 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2984ced..a9bf8e6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180311) +set(CMake_VERSION_PATCH 20180312) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 12 13:45:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 12 Mar 2018 13:45:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-203-g378a11c Message-ID: <20180312174505.E0184FBC68@public.kitware.com> 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, master has been updated via 378a11cdbad6732971e91d5999f5788e26e35438 (commit) via 746ebaf563baa76613d6629a8d53cdeffb6d8a85 (commit) via fac050ec8d10f7ad8488ff214f8a556a307c46af (commit) via 725b0cab863aae5b78bc252f8174b8362954dcab (commit) via 588a1afe76ad0e5bed5d03403fa7b392cbbcd438 (commit) via 90086767ddad60205302ad88257d60d68fc7fd0a (commit) via 7fec336bf72684d5b2610e7d6d6041f40c61e833 (commit) via 2dc2a3eb15c331aa2b953d995d304a6befc0aca4 (commit) via 8401b6ac4ebe8bc383f288119af77ef09eb3d62b (commit) from b340cacde869102b2b548b2e7ebc7341334f1d58 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=378a11cdbad6732971e91d5999f5788e26e35438 commit 378a11cdbad6732971e91d5999f5788e26e35438 Merge: 746ebaf 7fec336 Author: Brad King AuthorDate: Mon Mar 12 17:42:12 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:42:18 2018 -0400 Merge topic 'genex-TARGET_EXISTS' 7fec336bf7 genex: Add TARGET_EXISTS to check for target existence Acked-by: Kitware Robot Merge-request: !1829 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=746ebaf563baa76613d6629a8d53cdeffb6d8a85 commit 746ebaf563baa76613d6629a8d53cdeffb6d8a85 Merge: fac050e 9008676 Author: Brad King AuthorDate: Mon Mar 12 17:41:11 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:41:28 2018 -0400 Merge topic 'xml-raii' 90086767dd cmGlobalVisualStudio10Generator: Use cmXMLWriter RAII helpers 8401b6ac4e cmXMLWriter: Add RAII helpers to allow DOM-like syntax Acked-by: Kitware Robot Merge-request: !1818 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fac050ec8d10f7ad8488ff214f8a556a307c46af commit fac050ec8d10f7ad8488ff214f8a556a307c46af Merge: 725b0ca 2dc2a3e Author: Brad King AuthorDate: Mon Mar 12 17:40:12 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:40:44 2018 -0400 Merge topic 'update-dllplatform' 2dc2a3eb15 Identify DLL platforms via CMAKE_IMPORT_LIBRARY_SUFFIX Acked-by: Kitware Robot Merge-request: !1832 diff --cc Source/cmTarget.cxx index 70387ae,0a85c6b..6137223 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@@ -186,10 -186,18 +186,10 @@@ cmTarget::cmTarget(std::string const& n this->ImportedGloballyVisible = vis == VisibilityImportedGlobally; this->BuildInterfaceIncludesAppended = false; - // only add dependency information for library targets - if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY && - this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) { - this->RecordDependencies = true; - } else { - this->RecordDependencies = false; - } - // Check whether this is a DLL platform. this->DLLPlatform = - (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || - this->Makefile->IsOn("MINGW")); + strcmp(this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"), + "") != 0; // Check whether we are targeting an Android platform. this->IsAndroid = https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=725b0cab863aae5b78bc252f8174b8362954dcab commit 725b0cab863aae5b78bc252f8174b8362954dcab Merge: b340cac 588a1af Author: Brad King AuthorDate: Mon Mar 12 17:39:35 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:39:45 2018 -0400 Merge topic 'cmake-rc-version-decimal' 588a1afe76 CMakeVersion.rc: Avoid leading zeros in integer version components Acked-by: Kitware Robot Merge-request: !1835 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=588a1afe76ad0e5bed5d03403fa7b392cbbcd438 commit 588a1afe76ad0e5bed5d03403fa7b392cbbcd438 Author: Brad King AuthorDate: Fri Mar 9 10:50:25 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 10:52:49 2018 -0500 CMakeVersion.rc: Avoid leading zeros in integer version components The split in commit v3.11.0-rc1~232^2 (CMakeVersion RC file: Split patch into 2 components, 2017-12-01) can leave components "2018,0309", but the latter is an octal constant with digit "9" out of range. Strip the leading zero to express the components as "2018,309" so the resource compiler treats them as decimal. diff --git a/Source/CMakeVersionCompute.cmake b/Source/CMakeVersionCompute.cmake index 79264ed..72a5800 100644 --- a/Source/CMakeVersionCompute.cmake +++ b/Source/CMakeVersionCompute.cmake @@ -32,7 +32,12 @@ endif() # components in the RC file are 16-bit integers so we may have to # split the patch component. if(CMake_VERSION_PATCH MATCHES "^([0-9]+)([0-9][0-9][0-9][0-9])$") - set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMAKE_MATCH_1},${CMAKE_MATCH_2}) + set(CMake_RCVERSION_YEAR "${CMAKE_MATCH_1}") + set(CMake_RCVERSION_MONTH_DAY "${CMAKE_MATCH_2}") + string(REGEX REPLACE "^0+" "" CMake_RCVERSION_MONTH_DAY "${CMake_RCVERSION_MONTH_DAY}") + set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_RCVERSION_YEAR},${CMake_RCVERSION_MONTH_DAY}) + unset(CMake_RCVERSION_MONTH_DAY) + unset(CMake_RCVERSION_YEAR) else() set(CMake_RCVERSION ${CMake_VERSION_MAJOR},${CMake_VERSION_MINOR},${CMake_VERSION_PATCH}) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90086767ddad60205302ad88257d60d68fc7fd0a commit 90086767ddad60205302ad88257d60d68fc7fd0a Author: Vitaly Stakhovsky AuthorDate: Tue Mar 6 19:13:56 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 10:11:11 2018 -0500 cmGlobalVisualStudio10Generator: Use cmXMLWriter RAII helpers This simplifies our XML generation code and avoids the need to disable clang-format. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 73a5dae..205e0d0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -636,126 +636,89 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) cmsys::ofstream fout(vcxprojAbs.c_str()); cmXMLWriter xw(fout); - /* clang-format off */ - xw.StartDocument(); - xw.StartElement("Project"); - xw.Attribute("DefaultTargets", "Build"); - xw.Attribute("ToolsVersion", "4.0"); - xw.Attribute("xmlns", - "http://schemas.microsoft.com/developer/msbuild/2003"); - if (this->IsNsightTegra()) { - xw.StartElement("PropertyGroup"); - xw.Attribute("Label", "NsightTegraProject"); - xw.StartElement("NsightTegraProjectRevisionNumber"); - xw.Content("6"); - xw.EndElement(); // NsightTegraProjectRevisionNumber - xw.EndElement(); // PropertyGroup - } - xw.StartElement("ItemGroup"); - xw.Attribute("Label", "ProjectConfigurations"); - xw.StartElement("ProjectConfiguration"); - xw.Attribute("Include", "Debug|" + this->GetPlatformName()); - xw.StartElement("Configuration"); - xw.Content("Debug"); - xw.EndElement(); // Configuration - xw.StartElement("Platform"); - xw.Content(this->GetPlatformName()); - xw.EndElement(); // Platform - xw.EndElement(); // ProjectConfiguration - xw.EndElement(); // ItemGroup - xw.StartElement("PropertyGroup"); - xw.Attribute("Label", "Globals"); - xw.StartElement("ProjectGuid"); - xw.Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); - xw.EndElement(); // ProjectGuid - xw.StartElement("Keyword"); - xw.Content("Win32Proj"); - xw.EndElement(); // Keyword - xw.StartElement("Platform"); - xw.Content(this->GetPlatformName()); - xw.EndElement(); // Platform - if (this->GetSystemName() == "WindowsPhone") { - xw.StartElement("ApplicationType"); - xw.Content("Windows Phone"); - xw.EndElement(); // ApplicationType - xw.StartElement("ApplicationTypeRevision"); - xw.Content(this->GetSystemVersion()); - xw.EndElement(); // ApplicationTypeRevision - } else if (this->GetSystemName() == "WindowsStore") { - xw.StartElement("ApplicationType"); - xw.Content("Windows Store"); - xw.EndElement(); // ApplicationType - xw.StartElement("ApplicationTypeRevision"); - xw.Content(this->GetSystemVersion()); - xw.EndElement(); // ApplicationTypeRevision - } - if (!this->WindowsTargetPlatformVersion.empty()) { - xw.StartElement("WindowsTargetPlatformVersion"); - xw.Content(this->WindowsTargetPlatformVersion); - xw.EndElement(); // WindowsTargetPlatformVersion - } - if (this->GetPlatformName() == "ARM64") { - xw.StartElement("WindowsSDKDesktopARM64Support"); - xw.Content("true"); - xw.EndElement(); // WindowsSDK64DesktopARMSupport - } - else if (this->GetPlatformName() == "ARM") { - xw.StartElement("WindowsSDKDesktopARMSupport"); - xw.Content("true"); - xw.EndElement(); // WindowsSDKDesktopARMSupport - } - xw.EndElement(); // PropertyGroup - xw.StartElement("Import"); - xw.Attribute("Project", - "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); - xw.EndElement(); // Import + cmXMLDocument doc(xw); + cmXMLElement eprj(doc, "Project"); + eprj.Attribute("DefaultTargets", "Build"); + eprj.Attribute("ToolsVersion", "4.0"); + eprj.Attribute("xmlns", + "http://schemas.microsoft.com/developer/msbuild/2003"); + if (this->IsNsightTegra()) { + cmXMLElement epg(eprj, "PropertyGroup"); + epg.Attribute("Label", "NsightTegraProject"); + cmXMLElement(epg, "NsightTegraProjectRevisionNumber").Content("6"); + } + { + cmXMLElement eig(eprj, "ItemGroup"); + eig.Attribute("Label", "ProjectConfigurations"); + cmXMLElement epc(eig, "ProjectConfiguration"); + epc.Attribute("Include", "Debug|" + this->GetPlatformName()); + cmXMLElement(epc, "Configuration").Content("Debug"); + cmXMLElement(epc, "Platform").Content(this->GetPlatformName()); + } + { + cmXMLElement epg(eprj, "PropertyGroup"); + epg.Attribute("Label", "Globals"); + cmXMLElement(epg, "ProjectGuid") + .Content("{F3FC6D86-508D-3FB1-96D2-995F08B142EC}"); + cmXMLElement(epg, "Keyword").Content("Win32Proj"); + cmXMLElement(epg, "Platform").Content(this->GetPlatformName()); + if (this->GetSystemName() == "WindowsPhone") { + cmXMLElement(epg, "ApplicationType").Content("Windows Phone"); + cmXMLElement(epg, "ApplicationTypeRevision") + .Content(this->GetSystemVersion()); + } else if (this->GetSystemName() == "WindowsStore") { + cmXMLElement(epg, "ApplicationType").Content("Windows Store"); + cmXMLElement(epg, "ApplicationTypeRevision") + .Content(this->GetSystemVersion()); + } + if (!this->WindowsTargetPlatformVersion.empty()) { + cmXMLElement(epg, "WindowsTargetPlatformVersion") + .Content(this->WindowsTargetPlatformVersion); + } + if (this->GetPlatformName() == "ARM64") { + cmXMLElement(epg, "WindowsSDKDesktopARM64Support").Content("true"); + } else if (this->GetPlatformName() == "ARM") { + cmXMLElement(epg, "WindowsSDKDesktopARMSupport").Content("true"); + } + } + cmXMLElement(eprj, "Import") + .Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.Default.props"); if (!this->GeneratorToolsetHostArchitecture.empty()) { - xw.StartElement("PropertyGroup"); - xw.StartElement("PreferredToolArchitecture"); - xw.Content(this->GeneratorToolsetHostArchitecture); - xw.EndElement(); // PreferredToolArchitecture - xw.EndElement(); // PropertyGroup + cmXMLElement epg(eprj, "PropertyGroup"); + cmXMLElement(epg, "PreferredToolArchitecture") + .Content(this->GeneratorToolsetHostArchitecture); } - xw.StartElement("PropertyGroup"); - xw.Attribute("Label", "Configuration"); - xw.StartElement("ConfigurationType"); + { + cmXMLElement epg(eprj, "PropertyGroup"); + epg.Attribute("Label", "Configuration"); + { + cmXMLElement ect(epg, "ConfigurationType"); + if (this->IsNsightTegra()) { + // Tegra-Android platform does not understand "Utility". + ect.Content("StaticLibrary"); + } else { + ect.Content("Utility"); + } + } + cmXMLElement(epg, "CharacterSet").Content("MultiByte"); if (this->IsNsightTegra()) { - // Tegra-Android platform does not understand "Utility". - xw.Content("StaticLibrary"); + cmXMLElement(epg, "NdkToolchainVersion") + .Content(this->GetPlatformToolsetString()); } else { - xw.Content("Utility"); + cmXMLElement(epg, "PlatformToolset") + .Content(this->GetPlatformToolsetString()); } - xw.EndElement(); // ConfigurationType - xw.StartElement("CharacterSet"); - xw.Content("MultiByte"); - xw.EndElement(); // CharacterSet - if (this->IsNsightTegra()) { - xw.StartElement("NdkToolchainVersion"); - xw.Content(this->GetPlatformToolsetString()); - xw.EndElement(); // NdkToolchainVersion - } else { - xw.StartElement("PlatformToolset"); - xw.Content(this->GetPlatformToolsetString()); - xw.EndElement(); // PlatformToolset - } - xw.EndElement(); // PropertyGroup - xw.StartElement("Import"); - xw.Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); - xw.EndElement(); // Import - xw.StartElement("ItemDefinitionGroup"); - xw.StartElement("PostBuildEvent"); - xw.StartElement("Command"); - xw.Content("echo VCTargetsPath=$(VCTargetsPath)"); - xw.EndElement(); // Command - xw.EndElement(); // PostBuildEvent - xw.EndElement(); // ItemDefinitionGroup - xw.StartElement("Import"); - xw.Attribute("Project", - "$(VCTargetsPath)\\Microsoft.Cpp.targets"); - xw.EndElement(); // Import - xw.EndElement(); // Project - xw.EndDocument(); - /* clang-format on */ + } + cmXMLElement(eprj, "Import") + .Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.props"); + { + cmXMLElement eidg(eprj, "ItemDefinitionGroup"); + cmXMLElement epbe(eidg, "PostBuildEvent"); + cmXMLElement(epbe, "Command") + .Content("echo VCTargetsPath=$(VCTargetsPath)"); + } + cmXMLElement(eprj, "Import") + .Attribute("Project", "$(VCTargetsPath)\\Microsoft.Cpp.targets"); } std::vector cmd; diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 4324873..80940ee 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -157,12 +157,12 @@ public: { xmlwr.StartElement(tag); } - cmXMLElement(cmXMLElement const& par, const char* tag) + cmXMLElement(cmXMLElement& par, const char* tag) : xmlwr(par.xmlwr) { xmlwr.StartElement(tag); } - cmXMLElement(cmXMLDocument const& doc, const char* tag) + cmXMLElement(cmXMLDocument& doc, const char* tag) : xmlwr(doc.xmlwr) { xmlwr.StartElement(tag); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7fec336bf72684d5b2610e7d6d6041f40c61e833 commit 7fec336bf72684d5b2610e7d6d6041f40c61e833 Author: Alex Turbov AuthorDate: Wed Mar 7 12:01:28 2018 +0800 Commit: Brad King CommitDate: Fri Mar 9 08:24:05 2018 -0500 genex: Add TARGET_EXISTS to check for target existence Define `$` to `1` if `a` is an existed target name, else `0`. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index 04cb1dc..d3514ab 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -59,6 +59,8 @@ Available logical expressions are: ``1`` if ``a`` is EQUAL ``b`` in a numeric comparison, else ``0`` ``$`` ``1`` if ``a`` is IN_LIST ``b``, else ``0`` +``$`` + ``1`` if ``tgt`` is an existed target name, else ``0``. ``$`` ``1`` if config is ``cfg``, else ``0``. This is a case-insensitive comparison. The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_` is also considered by diff --git a/Help/release/dev/genex-TARGET_EXISTS.rst b/Help/release/dev/genex-TARGET_EXISTS.rst new file mode 100644 index 0000000..f305522 --- /dev/null +++ b/Help/release/dev/genex-TARGET_EXISTS.rst @@ -0,0 +1,6 @@ +genex-TARGET_EXISTS +------------------- + +* A new ``$`` + :manual:`generator expression ` + has been added. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 0d22028..f444113 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -300,6 +300,37 @@ static const struct InListNode : public cmGeneratorExpressionNode } } inListNode; +static const struct TargetExistsNode : public cmGeneratorExpressionNode +{ + TargetExistsNode() {} + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + if (parameters.size() != 1) { + reportError(context, content->GetOriginalExpression(), + "$ expression requires one parameter"); + return std::string(); + } + + std::string targetName = parameters.front(); + if (targetName.empty() || + !cmGeneratorExpression::IsValidTargetName(targetName)) { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a non-empty " + "valid target name."); + return std::string(); + } + + return context->LG->GetMakefile()->FindTargetToUse(targetName) ? "1" : "0"; + } +} targetExistsNode; + static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} @@ -1865,6 +1896,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["TARGET_NAME"] = &targetNameNode; nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; nodeMap["TARGET_POLICY"] = &targetPolicyNode; + nodeMap["TARGET_EXISTS"] = &targetExistsNode; nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; nodeMap["INSTALL_PREFIX"] = &installPrefixNode; diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index 2486259..f9a5cae 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -34,6 +34,10 @@ run_cmake(OUTPUT_NAME-recursion) run_cmake(TARGET_PROPERTY-LOCATION) run_cmake(TARGET_PROPERTY-SOURCES) run_cmake(LINK_ONLY-not-linking) +run_cmake(TARGET_EXISTS-no-arg) +run_cmake(TARGET_EXISTS-empty-arg) +run_cmake(TARGET_EXISTS) +run_cmake(TARGET_EXISTS-not-a-target) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake new file mode 100644 index 0000000..c4c3a51 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-generated.txt" content) + +set(expected "1") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..1df6e28 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty valid target name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..e387abc --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..69e6130 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake new file mode 100644 index 0000000..0a5ce32 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..35ba267 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_EXISTS-not-a-target-generated.txt" content) + +set(expected "0") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..d8a8d3e --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_EXISTS-not-a-target-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake new file mode 100644 index 0000000..9a83b34 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_EXISTS-generated.txt CONTENT "$") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2dc2a3eb15c331aa2b953d995d304a6befc0aca4 commit 2dc2a3eb15c331aa2b953d995d304a6befc0aca4 Author: Stephan Szabo AuthorDate: Thu Mar 8 10:26:56 2018 -0800 Commit: Brad King CommitDate: Fri Mar 9 08:09:21 2018 -0500 Identify DLL platforms via CMAKE_IMPORT_LIBRARY_SUFFIX Use `CMAKE_IMPORT_LIBRARY_SUFFIX` to identify platforms that have DLL import libraries rather than memorizing a list of platform names. Fixes: #16801 diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8cdba93..b9e2978 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -132,8 +132,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) this->SourceEntries, true); this->DLLPlatform = - (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || - this->Makefile->IsOn("MINGW")); + strcmp(this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"), + "") != 0; this->PolicyMap = t->PolicyMap; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 008a5e0..b5291a1 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -5,6 +5,7 @@ #include "cmsys/Glob.hxx" #include #include +#include #include #include "cmAlgorithms.h" @@ -334,8 +335,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) // Check whether this is a DLL platform. bool dll_platform = - (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || - this->Makefile->IsOn("MINGW")); + strcmp(this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"), + "") != 0; for (std::string const& tgt : targetList.GetVector()) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index bb21022..0a85c6b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -196,8 +196,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, // Check whether this is a DLL platform. this->DLLPlatform = - (this->Makefile->IsOn("WIN32") || this->Makefile->IsOn("CYGWIN") || - this->Makefile->IsOn("MINGW")); + strcmp(this->Makefile->GetSafeDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"), + "") != 0; // Check whether we are targeting an Android platform. this->IsAndroid = https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8401b6ac4ebe8bc383f288119af77ef09eb3d62b commit 8401b6ac4ebe8bc383f288119af77ef09eb3d62b Author: Vitaly Stakhovsky AuthorDate: Sun Mar 4 15:03:57 2018 -0500 Commit: Brad King CommitDate: Fri Mar 9 07:28:49 2018 -0500 cmXMLWriter: Add RAII helpers to allow DOM-like syntax Use RAII for cmXMLWriter::StartElement/EndElement to make nesting automatic. diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 7bae21e..4324873 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -133,4 +133,56 @@ private: bool IsContent; }; +class cmXMLElement; // IWYU pragma: keep + +class cmXMLDocument +{ +public: + cmXMLDocument(cmXMLWriter& xml) + : xmlwr(xml) + { + xmlwr.StartDocument(); + } + ~cmXMLDocument() { xmlwr.EndDocument(); } +private: + friend class cmXMLElement; + cmXMLWriter& xmlwr; +}; + +class cmXMLElement +{ +public: + cmXMLElement(cmXMLWriter& xml, const char* tag) + : xmlwr(xml) + { + xmlwr.StartElement(tag); + } + cmXMLElement(cmXMLElement const& par, const char* tag) + : xmlwr(par.xmlwr) + { + xmlwr.StartElement(tag); + } + cmXMLElement(cmXMLDocument const& doc, const char* tag) + : xmlwr(doc.xmlwr) + { + xmlwr.StartElement(tag); + } + ~cmXMLElement() { xmlwr.EndElement(); } + + template + cmXMLElement& Attribute(const char* name, T const& value) + { + xmlwr.Attribute(name, value); + return *this; + } + template + void Content(T const& content) + { + xmlwr.Content(content); + } + +private: + cmXMLWriter& xmlwr; +}; + #endif ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 2 + Help/release/dev/genex-TARGET_EXISTS.rst | 6 + Source/CMakeVersionCompute.cmake | 7 +- Source/cmGeneratorExpressionNode.cxx | 32 ++++ Source/cmGeneratorTarget.cxx | 4 +- Source/cmGlobalVisualStudio10Generator.cxx | 193 ++++++++------------ Source/cmInstallCommand.cxx | 5 +- Source/cmTarget.cxx | 4 +- Source/cmXMLWriter.h | 52 ++++++ .../GeneratorExpression/RunCMakeTest.cmake | 4 + .../GeneratorExpression/TARGET_EXISTS-check.cmake | 6 + .../TARGET_EXISTS-empty-arg-result.txt} | 0 .../TARGET_EXISTS-empty-arg-stderr.txt | 8 + .../TARGET_EXISTS-empty-arg.cmake | 2 + .../TARGET_EXISTS-no-arg-result.txt} | 0 .../TARGET_EXISTS-no-arg-stderr.txt | 8 + .../GeneratorExpression/TARGET_EXISTS-no-arg.cmake | 2 + .../TARGET_EXISTS-not-a-target-check.cmake | 6 + .../TARGET_EXISTS-not-a-target.cmake | 2 + .../GeneratorExpression/TARGET_EXISTS.cmake | 3 + 20 files changed, 224 insertions(+), 122 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_EXISTS.rst create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-check.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_EXISTS-empty-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-empty-arg.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_EXISTS-no-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-no-arg.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS-not-a-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_EXISTS.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 12 13:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 12 Mar 2018 13:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-210-g89d00bf Message-ID: <20180312175502.746B7107BB1@public.kitware.com> 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, master has been updated via 89d00bfcee33a724a9a51e5a7cf40ab0785d9a9b (commit) via bab82b0935e543ceceddf8e339dd026d201692fe (commit) via 2dad62045239053b119d0ae7b795ac6a59b4f7a7 (commit) via 83071fff759f27f18922df8336826f19518e730c (commit) via 7ad981c8f705ef563b8ca0bf3da98f6902fa56fe (commit) via c6e8442e4c433ed943cda33b9d446f4383af0a88 (commit) via 78756429abe1d0c41596d48315fec96e72cc65f7 (commit) from 378a11cdbad6732971e91d5999f5788e26e35438 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89d00bfcee33a724a9a51e5a7cf40ab0785d9a9b commit 89d00bfcee33a724a9a51e5a7cf40ab0785d9a9b Merge: 2dad620 bab82b0 Author: Brad King AuthorDate: Mon Mar 12 13:51:30 2018 -0400 Commit: Brad King CommitDate: Mon Mar 12 13:51:30 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2dad62045239053b119d0ae7b795ac6a59b4f7a7 commit 2dad62045239053b119d0ae7b795ac6a59b4f7a7 Merge: 83071ff 7875642 Author: Brad King AuthorDate: Mon Mar 12 17:50:28 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:50:37 2018 -0400 Merge topic 'update-buildsystem-docs' 78756429ab Help: Adapt cmake-buildsystem(7) to new IMPORTED targets features Acked-by: Kitware Robot Merge-request: !1839 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83071fff759f27f18922df8336826f19518e730c commit 83071fff759f27f18922df8336826f19518e730c Merge: 378a11c 7ad981c Author: Brad King AuthorDate: Mon Mar 12 17:49:39 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 12 13:49:44 2018 -0400 Merge topic 'ep-support-passing-var-ending-with-notfound' 7ad981c8f7 ExternalProject: Fix cache generation when last args ends with "-NOTFOUND" Acked-by: Kitware Robot Merge-request: !1838 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-buildsystem.7.rst | 11 +++++------ Modules/ExternalProject.cmake | 18 ++++++++++++++---- .../ExternalProject/CMAKE_CACHE_ARGS-check.cmake | 9 +++++++++ .../RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake | 3 ++- .../CMAKE_CACHE_DEFAULT_ARGS-check.cmake | 9 +++++++++ .../ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake | 3 ++- 6 files changed, 41 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 12 13:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 12 Mar 2018 13:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-4-gbab82b0 Message-ID: <20180312175502.86E90107D8F@public.kitware.com> 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, release has been updated via bab82b0935e543ceceddf8e339dd026d201692fe (commit) via 7ad981c8f705ef563b8ca0bf3da98f6902fa56fe (commit) via c6e8442e4c433ed943cda33b9d446f4383af0a88 (commit) via 78756429abe1d0c41596d48315fec96e72cc65f7 (commit) from c5541cf0da1093635fea7da5a40e64e481b5477e (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-buildsystem.7.rst | 11 +++++------ Modules/ExternalProject.cmake | 18 ++++++++++++++---- .../ExternalProject/CMAKE_CACHE_ARGS-check.cmake | 9 +++++++++ .../RunCMake/ExternalProject/CMAKE_CACHE_ARGS.cmake | 3 ++- .../CMAKE_CACHE_DEFAULT_ARGS-check.cmake | 9 +++++++++ .../ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake | 3 ++- 6 files changed, 41 insertions(+), 12 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 13 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 13 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-211-gb2584ce Message-ID: <20180313040505.A1949106679@public.kitware.com> 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, master has been updated via b2584ce069eae0d4b5a1cccf19295e5fde4c1082 (commit) from 89d00bfcee33a724a9a51e5a7cf40ab0785d9a9b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2584ce069eae0d4b5a1cccf19295e5fde4c1082 commit b2584ce069eae0d4b5a1cccf19295e5fde4c1082 Author: Kitware Robot AuthorDate: Tue Mar 13 00:01:15 2018 -0400 Commit: Kitware Robot CommitDate: Tue Mar 13 00:01:15 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a9bf8e6..8526676 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180312) +set(CMake_VERSION_PATCH 20180313) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 13 13:45:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 13 Mar 2018 13:45:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-221-g3d5717e Message-ID: <20180313174506.BB408FB9D0@public.kitware.com> 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, master has been updated via 3d5717ebfd281abc45dfddff7eab2d0a6b4fe2ac (commit) via fc573c230097d08e6b94e5f643509f219fe0be50 (commit) via bdbee54a8317806b4a93aec9f8eee1b876da9a32 (commit) via 7c557e2227f446d1c265ac7b5aa8055e3f4ea713 (commit) via a039029e7c4e00f3a64578f94e593f00719bb01c (commit) via a54b56a10bc1d03bd6e56b76f0098fb1835094c9 (commit) via 354a33fdf3b6618cbb81772ea8647761b9c3c1ce (commit) via 7899e5369126599aa05689b9ddfd233d2f317910 (commit) via 1b5e52fd651ab17b3f9efb8f3e2e069550bf7a66 (commit) via 2deb9b7f3495a9083b8d5341f867fed615da1470 (commit) from b2584ce069eae0d4b5a1cccf19295e5fde4c1082 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d5717ebfd281abc45dfddff7eab2d0a6b4fe2ac commit 3d5717ebfd281abc45dfddff7eab2d0a6b4fe2ac Merge: fc573c2 a039029 Author: Brad King AuthorDate: Tue Mar 13 13:43:52 2018 -0400 Commit: Brad King CommitDate: Tue Mar 13 13:43:52 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fc573c230097d08e6b94e5f643509f219fe0be50 commit fc573c230097d08e6b94e5f643509f219fe0be50 Merge: bdbee54 354a33f Author: Brad King AuthorDate: Tue Mar 13 13:43:03 2018 -0400 Commit: Brad King CommitDate: Tue Mar 13 13:43:03 2018 -0400 Merge branch 'release-3.10' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bdbee54a8317806b4a93aec9f8eee1b876da9a32 commit bdbee54a8317806b4a93aec9f8eee1b876da9a32 Merge: 7c557e2 1b5e52f Author: Brad King AuthorDate: Tue Mar 13 17:42:38 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 13 13:42:45 2018 -0400 Merge topic 'genex-COMPILE_LANGUAGE-system-include' 1b5e52fd65 Genex: Fix COMPILE_LANGUAGE propagation through try_compile 2deb9b7f34 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories Acked-by: Kitware Robot Merge-request: !1844 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7c557e2227f446d1c265ac7b5aa8055e3f4ea713 commit 7c557e2227f446d1c265ac7b5aa8055e3f4ea713 Merge: b2584ce 7899e53 Author: Brad King AuthorDate: Tue Mar 13 17:41:52 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 13 13:42:00 2018 -0400 Merge topic 'ccmake-stack-smashing' 7899e53691 ccmake: fix status line buffer overflow on very wide terminals Acked-by: Kitware Robot Merge-request: !1836 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=354a33fdf3b6618cbb81772ea8647761b9c3c1ce commit 354a33fdf3b6618cbb81772ea8647761b9c3c1ce Merge: 760c6c0 7899e53 Author: Brad King AuthorDate: Tue Mar 13 13:39:32 2018 -0400 Commit: Brad King CommitDate: Tue Mar 13 13:39:32 2018 -0400 Merge branch 'ccmake-stack-smashing' into release-3.10 Merge-request: !1836 ----------------------------------------------------------------------- Summary of changes: Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/cmCoreTryCompile.cxx | 3 ++- Source/cmExportTryCompileFileGenerator.cxx | 19 ++++++++++++------- Source/cmExportTryCompileFileGenerator.h | 5 ++++- Source/cmGeneratorTarget.cxx | 14 ++++++++------ Source/cmGeneratorTarget.h | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 9 ++++++--- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmServerProtocol.cxx | 7 ++++--- .../SystemIncludeDirectories/CMakeLists.txt | 4 +++- 10 files changed, 44 insertions(+), 26 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 13 13:45:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 13 Mar 2018 13:45:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-9-ga039029 Message-ID: <20180313174506.D2B82FBACC@public.kitware.com> 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, release has been updated via a039029e7c4e00f3a64578f94e593f00719bb01c (commit) via a54b56a10bc1d03bd6e56b76f0098fb1835094c9 (commit) via 7899e5369126599aa05689b9ddfd233d2f317910 (commit) via 1b5e52fd651ab17b3f9efb8f3e2e069550bf7a66 (commit) via 2deb9b7f3495a9083b8d5341f867fed615da1470 (commit) from bab82b0935e543ceceddf8e339dd026d201692fe (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/cmCoreTryCompile.cxx | 3 ++- Source/cmExportTryCompileFileGenerator.cxx | 19 ++++++++++++------- Source/cmExportTryCompileFileGenerator.h | 5 ++++- Source/cmGeneratorTarget.cxx | 14 ++++++++------ Source/cmGeneratorTarget.h | 3 ++- Source/cmGlobalXCodeGenerator.cxx | 9 ++++++--- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmServerProtocol.cxx | 7 ++++--- .../SystemIncludeDirectories/CMakeLists.txt | 4 +++- 10 files changed, 44 insertions(+), 26 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 14 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 14 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-222-g65b7648 Message-ID: <20180314040505.325D0105EA3@public.kitware.com> 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, master has been updated via 65b7648609fdd37f5926efebfe9c3d7f4434a65d (commit) from 3d5717ebfd281abc45dfddff7eab2d0a6b4fe2ac (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65b7648609fdd37f5926efebfe9c3d7f4434a65d commit 65b7648609fdd37f5926efebfe9c3d7f4434a65d Author: Kitware Robot AuthorDate: Wed Mar 14 00:01:10 2018 -0400 Commit: Kitware Robot CommitDate: Wed Mar 14 00:01:10 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8526676..b09e43e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180313) +set(CMake_VERSION_PATCH 20180314) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 14 10:55:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 14 Mar 2018 10:55:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-228-gccdd79d Message-ID: <20180314145508.5C01110A29E@public.kitware.com> 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, master has been updated via ccdd79d38ed3eadabbfcc18e8e6de5bd6080777c (commit) via 443a52aa850c1a19d3da0608212a41a4f074d3e9 (commit) via 4fb91a886870dc9b86c7861b2bdd3e572df01624 (commit) via 6a2a9d107dfeb86187459c224805128ee332f8eb (commit) via 8b43adc45c2cf7a25b739589dec2010029f91a83 (commit) via 4b25cc452ae5fdcb1ec2f420f05d98b01054e5e9 (commit) from 65b7648609fdd37f5926efebfe9c3d7f4434a65d (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ccdd79d38ed3eadabbfcc18e8e6de5bd6080777c commit ccdd79d38ed3eadabbfcc18e8e6de5bd6080777c Merge: 443a52a 6a2a9d1 Author: Brad King AuthorDate: Wed Mar 14 14:49:14 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 14 10:51:11 2018 -0400 Merge topic 'cmake_project_xxx_docs' 6a2a9d107d Help: Fix incorrect CMAKE_PROJECT_xxx docs Acked-by: Kitware Robot Merge-request: !1847 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=443a52aa850c1a19d3da0608212a41a4f074d3e9 commit 443a52aa850c1a19d3da0608212a41a4f074d3e9 Merge: 4fb91a8 8b43adc Author: Brad King AuthorDate: Wed Mar 14 14:49:06 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 14 10:50:29 2018 -0400 Merge topic 'build_and_test_mode_docs' 8b43adc45c Help: Clarify ctest build-and-test mode options Acked-by: Kitware Robot Merge-request: !1848 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4fb91a886870dc9b86c7861b2bdd3e572df01624 commit 4fb91a886870dc9b86c7861b2bdd3e572df01624 Merge: 65b7648 4b25cc4 Author: Brad King AuthorDate: Wed Mar 14 14:48:57 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 14 10:49:11 2018 -0400 Merge topic 'doc-vs-workdir-versions' 4b25cc452a Help: Document VS_DEBUGGER_WORKING_DIRECTORY supported VS versions Acked-by: Kitware Robot Merge-request: !1843 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a2a9d107dfeb86187459c224805128ee332f8eb commit 6a2a9d107dfeb86187459c224805128ee332f8eb Author: Craig Scott AuthorDate: Tue Mar 13 22:30:36 2018 +1100 Commit: Craig Scott CommitDate: Wed Mar 14 07:33:38 2018 +1100 Help: Fix incorrect CMAKE_PROJECT_xxx docs The docs for CMAKE_PROJECT_NAME and CMAKE_PROJECT_DESCRIPTION were erroneously documenting the behavior of PROJECT_NAME and PROJECT_DESCRIPTION respectively. Fix these and update the project() docs to also mention CMAKE_PROJECT_NAME and CMAKE_PROJECT_DESCRIPTION. Fixes: #17815 diff --git a/Help/command/project.rst b/Help/command/project.rst index eb185e4..ac71d7a 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -1,7 +1,7 @@ project ------- -Set a name, version, and enable languages for the entire project. +Sets project details such as name, version, etc. and enables languages. .. code-block:: cmake @@ -63,7 +63,10 @@ The top-level ``CMakeLists.txt`` file for a project must contain a literal, direct call to the :command:`project` command; loading one through the :command:`include` command is not sufficient. If no such call exists CMake will implicitly add one to the top that enables the -default languages (``C`` and ``CXX``). +default languages (``C`` and ``CXX``). The name of the project set in +the top level CMakeLists.txt file is available from the +:variable:`CMAKE_PROJECT_NAME` variable and its description from +:variable:`CMAKE_PROJECT_DESCRIPTION`. .. note:: Call the :command:`cmake_minimum_required` command at the beginning diff --git a/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst b/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst index f1911ec..6db5b9e 100644 --- a/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst +++ b/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst @@ -1,7 +1,35 @@ CMAKE_PROJECT_DESCRIPTION ------------------------- -The description of the current project. +The description of the top level project. -This specifies description of the current project from the closest inherited -:command:`project` command. +This variable holds the description of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. In the event that +the top level CMakeLists.txt contains multiple :command:`project` calls, +the most recently called one from that top level CMakeLists.txt will determine +the name that ``CMAKE_PROJECT_DESCRIPTION`` contains. For example, consider +the following top level CMakeLists.txt: + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.0) + project(First DESCRIPTION "I am First") + project(Second DESCRIPTION "I am Second") + add_subdirectory(sub) + project(Third DESCRIPTION "I am Third") + +And ``sub/CMakeLists.txt`` with the following contents: + +.. code-block:: cmake + + project(SubProj DESCRIPTION "I am SubProj") + message("CMAKE_PROJECT_DESCRIPTION = ${CMAKE_PROJECT_DESCRIPTION}") + +The most recently seen :command:`project` command from the top level +CMakeLists.txt would be ``project(Second ...)``, so this will print:: + + CMAKE_PROJECT_DESCRIPTION = I am Second + +To obtain the description from the most recent call to :command:`project` in +the current directory scope or above, see the :variable:`PROJECT_DESCRIPTION` +variable. diff --git a/Help/variable/CMAKE_PROJECT_NAME.rst b/Help/variable/CMAKE_PROJECT_NAME.rst index 431e9f3..94b8dba 100644 --- a/Help/variable/CMAKE_PROJECT_NAME.rst +++ b/Help/variable/CMAKE_PROJECT_NAME.rst @@ -1,7 +1,35 @@ CMAKE_PROJECT_NAME ------------------ -The name of the current project. +The name of the top level project. -This specifies name of the current project from the closest inherited -:command:`project` command. +This variable holds the name of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. In the event that +the top level CMakeLists.txt contains multiple :command:`project` calls, +the most recently called one from that top level CMakeLists.txt will determine +the name that ``CMAKE_PROJECT_NAME`` contains. For example, consider +the following top level CMakeLists.txt: + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.0) + project(First) + project(Second) + add_subdirectory(sub) + project(Third) + +And ``sub/CMakeLists.txt`` with the following contents: + +.. code-block:: cmake + + project(SubProj) + message("CMAKE_PROJECT_NAME = ${CMAKE_PROJECT_NAME}") + +The most recently seen :command:`project` command from the top level +CMakeLists.txt would be ``project(Second)``, so this will print:: + + CMAKE_PROJECT_NAME = Second + +To obtain the name from the most recent call to :command:`project` in +the current directory scope or above, see the :variable:`PROJECT_NAME` +variable. diff --git a/Help/variable/PROJECT_DESCRIPTION.rst b/Help/variable/PROJECT_DESCRIPTION.rst index 05ede8f..2833e11 100644 --- a/Help/variable/PROJECT_DESCRIPTION.rst +++ b/Help/variable/PROJECT_DESCRIPTION.rst @@ -3,4 +3,7 @@ PROJECT_DESCRIPTION Short project description given to the project command. -This is the description given to the most recent :command:`project` command. +This is the description given to the most recently called :command:`project` +command in the current directory scope or above. To obtain the description +of the top level project, see the :variable:`CMAKE_PROJECT_DESCRIPTION` +variable. diff --git a/Help/variable/PROJECT_NAME.rst b/Help/variable/PROJECT_NAME.rst index 61aa8bc..672680a 100644 --- a/Help/variable/PROJECT_NAME.rst +++ b/Help/variable/PROJECT_NAME.rst @@ -3,4 +3,6 @@ PROJECT_NAME Name of the project given to the project command. -This is the name given to the most recent :command:`project` command. +This is the name given to the most recently called :command:`project` +command in the current directory scope or above. To obtain the name of +the top level project, see the :variable:`CMAKE_PROJECT_NAME` variable. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8b43adc45c2cf7a25b739589dec2010029f91a83 commit 8b43adc45c2cf7a25b739589dec2010029f91a83 Author: Craig Scott AuthorDate: Tue Mar 13 23:11:17 2018 +1100 Commit: Craig Scott CommitDate: Wed Mar 14 07:27:54 2018 +1100 Help: Clarify ctest build-and-test mode options Fixes: #17807 diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index a04c403..75af22e 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -368,15 +368,17 @@ for "SubprojectB"). Build and Test Mode =================== -CTest provides a command-line signature to to configure (i.e. run cmake on), -build, and or execute a test:: +CTest provides a command-line signature to configure (i.e. run cmake on), +build, and/or execute a test:: ctest --build-and-test - --build-generator [...] [-- ...] - [--test-command ] + --build-generator + [...] + [--build-options ...] + [--test-command [...]] The configure and test steps are optional. The arguments to this command line -are the source and binary directories. The ``--build-generator`` option *must* +are the source and binary directories. The ``--build-generator`` option *must* be provided to use ``--build-and-test``. If ``--test-command`` is specified then that will be run after the build is complete. Other options that affect this mode include: @@ -425,13 +427,15 @@ this mode include: should be used. e.g. Debug/Release/etc. ``--build-options`` - Add extra options to the build step. - - This option must be the last option with the exception of - ``--test-command`` + Additional options for configuring the build (i.e. for CMake, not for + the build tool). Note that if this is specified, the ``--build-options`` + keyword and its arguments must be the last option given on the command + line, with the possible exception of ``--test-command``. ``--test-command`` - The test to run with the ``--build-and-test`` option. + The command to run as the test step with the ``--build-and-test`` option. + All arguments following this keyword will be assumed to be part of the + test command line, so it must be the last option given. ``--test-timeout`` The time limit in seconds https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4b25cc452ae5fdcb1ec2f420f05d98b01054e5e9 commit 4b25cc452ae5fdcb1ec2f420f05d98b01054e5e9 Author: Hannes Mezger AuthorDate: Mon Mar 12 16:30:00 2018 +0100 Commit: Hannes Mezger CommitDate: Tue Mar 13 10:13:59 2018 +0100 Help: Document VS_DEBUGGER_WORKING_DIRECTORY supported VS versions diff --git a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst index 0af85cb..fb0389e 100644 --- a/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst +++ b/Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst @@ -4,3 +4,6 @@ VS_DEBUGGER_WORKING_DIRECTORY Sets the local debugger working directory for Visual Studio C++ targets. This is defined in ```` in the Visual Studio project file. + +This property only works for Visual Studio 2010 and above; +it is ignored on other generators. ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 7 +++-- Help/manual/ctest.1.rst | 24 +++++++++------- Help/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY.rst | 3 ++ Help/variable/CMAKE_PROJECT_DESCRIPTION.rst | 34 +++++++++++++++++++++-- Help/variable/CMAKE_PROJECT_NAME.rst | 34 +++++++++++++++++++++-- Help/variable/PROJECT_DESCRIPTION.rst | 5 +++- Help/variable/PROJECT_NAME.rst | 4 ++- 7 files changed, 91 insertions(+), 20 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 15 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 15 Mar 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-229-g07f9f41 Message-ID: <20180315040504.9F29310AB14@public.kitware.com> 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, master has been updated via 07f9f41f503985dbd1fb0a657beadcfee95347e0 (commit) from ccdd79d38ed3eadabbfcc18e8e6de5bd6080777c (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07f9f41f503985dbd1fb0a657beadcfee95347e0 commit 07f9f41f503985dbd1fb0a657beadcfee95347e0 Author: Kitware Robot AuthorDate: Thu Mar 15 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Thu Mar 15 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b09e43e..f95375e 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180314) +set(CMake_VERSION_PATCH 20180315) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 15 07:55:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 15 Mar 2018 07:55:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-238-g6723261 Message-ID: <20180315115506.D61DA10ABFD@public.kitware.com> 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, master has been updated via 67232619319dfa3ebfaa5f1cda141bfec6b3ee9b (commit) via bd64d60194edeba43746339212f85935b4a82c62 (commit) via aaf56620d11bc3f497b5327bfd5a69f7471a8620 (commit) via c388487bd5ec14c8bc9e61202d0c5302fda5bd15 (commit) via 298e1bfe2870d649ed1ec0054137d6417c7d5ef2 (commit) via 194b74daec04c46ab1ae3c5b18d51ae805a9dbe0 (commit) via 25eb6e60d7079aa911031bd66b72b61379ed6c22 (commit) via 7bbaead87d8e9096d8ba90e0eb239d9c76840fff (commit) via 8c92596e9621e687b333f3dcdac5c2bb6d5ca1b1 (commit) from 07f9f41f503985dbd1fb0a657beadcfee95347e0 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=67232619319dfa3ebfaa5f1cda141bfec6b3ee9b commit 67232619319dfa3ebfaa5f1cda141bfec6b3ee9b Merge: bd64d60 298e1bf Author: Brad King AuthorDate: Thu Mar 15 07:53:35 2018 -0400 Commit: Brad King CommitDate: Thu Mar 15 07:53:35 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd64d60194edeba43746339212f85935b4a82c62 commit bd64d60194edeba43746339212f85935b4a82c62 Merge: aaf5662 194b74d Author: Brad King AuthorDate: Thu Mar 15 11:51:49 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 15 07:52:59 2018 -0400 Merge topic 'xl-cc-default-std' 194b74daec XL: Fix C default level detection when invoked as 'cc' Acked-by: Kitware Robot Merge-request: !1854 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aaf56620d11bc3f497b5327bfd5a69f7471a8620 commit aaf56620d11bc3f497b5327bfd5a69f7471a8620 Merge: c388487 25eb6e6 Author: Brad King AuthorDate: Thu Mar 15 11:51:32 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 15 07:52:19 2018 -0400 Merge topic 'bootstrap-clarify-error' 25eb6e60d7 bootstrap: Clarify error when building with invalid CXXFLAGS Acked-by: Kitware Robot Acked-by: Ben Boeckel Merge-request: !1850 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c388487bd5ec14c8bc9e61202d0c5302fda5bd15 commit c388487bd5ec14c8bc9e61202d0c5302fda5bd15 Merge: 07f9f41 8c92596 Author: Brad King AuthorDate: Thu Mar 15 11:51:18 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 15 07:51:29 2018 -0400 Merge topic 'findjni-mips-r6-new-arch' 8c92596e96 FindJNI: add some new architecture names for mips release 6 Acked-by: Kitware Robot Merge-request: !1853 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=25eb6e60d7079aa911031bd66b72b61379ed6c22 commit 25eb6e60d7079aa911031bd66b72b61379ed6c22 Author: Ben Chaney AuthorDate: Wed Mar 14 00:10:54 2018 -0400 Commit: Brad King CommitDate: Wed Mar 14 11:28:10 2018 -0400 bootstrap: Clarify error when building with invalid CXXFLAGS Mention the flags used when complaining that the compiler does not work. diff --git a/bootstrap b/bootstrap index 0bee6c5..d152c34 100755 --- a/bootstrap +++ b/bootstrap @@ -1116,8 +1116,10 @@ done rm -f "${TMPFILE}.cxx" if [ -z "${cmake_cxx_compiler}" ]; then -cmake_error 7 "Cannot find a C++ compiler supporting C++11 on this system. +cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags. Please specify one using environment variable CXX. +The C++ flags are \"$cmake_cxx_flags\". +They can be changed using the environment variable CXXFLAGS. See cmake_bootstrap.log for compilers attempted." fi echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}" ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCCompilerId.c.in | 3 ++- Modules/FindJNI.cmake | 5 ++++- bootstrap | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 15 07:55:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 15 Mar 2018 07:55:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-13-g298e1bf Message-ID: <20180315115507.1E64010ABFF@public.kitware.com> 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, release has been updated via 298e1bfe2870d649ed1ec0054137d6417c7d5ef2 (commit) via 194b74daec04c46ab1ae3c5b18d51ae805a9dbe0 (commit) via 7bbaead87d8e9096d8ba90e0eb239d9c76840fff (commit) via 8c92596e9621e687b333f3dcdac5c2bb6d5ca1b1 (commit) from a039029e7c4e00f3a64578f94e593f00719bb01c (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/CMakeCCompilerId.c.in | 3 ++- Modules/FindJNI.cmake | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 15 08:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 15 Mar 2018 08:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-242-g018946a Message-ID: <20180315120505.DEB2910B107@public.kitware.com> 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, master has been updated via 018946aaafc9ada6852d55cb8034faf0f4c1afbc (commit) via 27502491dd0500144311cf31750ed5fa24ac5988 (commit) via 2ab900c71b21a0faae46573c2720d867a896bb29 (commit) via ce0b9832163624291db04d38984c6aa7ea8ca7d7 (commit) from 67232619319dfa3ebfaa5f1cda141bfec6b3ee9b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=018946aaafc9ada6852d55cb8034faf0f4c1afbc commit 018946aaafc9ada6852d55cb8034faf0f4c1afbc Merge: 2ab900c 2750249 Author: Brad King AuthorDate: Thu Mar 15 11:58:27 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 15 07:58:33 2018 -0400 Merge topic 'clarify-contributing-doc' 27502491dd CONTRIBUTING: Clarify choice of master or release branch as a base Acked-by: Kitware Robot Acked-by: Jean-Christophe Fillion-Robin Merge-request: !1845 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27502491dd0500144311cf31750ed5fa24ac5988 commit 27502491dd0500144311cf31750ed5fa24ac5988 Author: Jean-Christophe Fillion-Robin AuthorDate: Mon Mar 12 23:39:32 2018 -0400 Commit: Brad King CommitDate: Thu Mar 15 07:56:30 2018 -0400 CONTRIBUTING: Clarify choice of master or release branch as a base diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 381769d..fa2c23d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -29,6 +29,8 @@ To contribute patches: #. Base all new work on the upstream ``master`` branch. Base work on the upstream ``release`` branch only if it fixes a regression or bug in a feature new to that release. + If in doubt, prefer ``master``. Reviewers may simply ask for + a rebase if deemed appropriate in particular cases. #. Create commits making incremental, distinct, logically complete changes with appropriate `commit messages`_. #. Push a topic branch to a personal repository fork on GitLab. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ab900c71b21a0faae46573c2720d867a896bb29 commit 2ab900c71b21a0faae46573c2720d867a896bb29 Merge: 6723261 ce0b983 Author: Brad King AuthorDate: Thu Mar 15 11:55:09 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 15 07:55:14 2018 -0400 Merge topic 'compile-options-shell' ce0b983216 target_compile_options: Add syntax to specify shell strings Acked-by: Kitware Robot Merge-request: !1841 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce0b9832163624291db04d38984c6aa7ea8ca7d7 commit ce0b9832163624291db04d38984c6aa7ea8ca7d7 Author: Brad King AuthorDate: Mon Mar 12 09:10:57 2018 -0400 Commit: Brad King CommitDate: Wed Mar 14 11:10:25 2018 -0400 target_compile_options: Add syntax to specify shell strings Options specified via `COMPILE_OPTIONS` and `INTERFACE_COMPILE_OPTIONS` are deduplicated, but individual options can legitimately be duplicated when grouped with other options, e.g. -D A -D B After deduplication that becomes `-D A B`. Therefore we need a way to treat groups of options as units during deduplication. A simple approach is to specify each group as one option, e.g. "-D A" "-D B" However, that conflicts with options that legitimately have spaces. To break this ambiguity, add a `SHELL:` prefix syntax to specify that an option should be parsed like shell command line arguments after deduplication, e.g. "SHELL:-D A" "SHELL:-D B" These will survive deduplication intact, and then be parsed to produce `-D A -D B` on the final command line. Fixes: #15826 diff --git a/Help/command/COMPILE_OPTIONS_SHELL.txt b/Help/command/COMPILE_OPTIONS_SHELL.txt new file mode 100644 index 0000000..a1316c8 --- /dev/null +++ b/Help/command/COMPILE_OPTIONS_SHELL.txt @@ -0,0 +1,9 @@ +The final set of compile options used for a target is constructed by +accumulating options from the current target and the usage requirements of +it dependencies. The set of options is de-duplicated to avoid repetition. +While beneficial for individual options, the de-duplication step can break +up option groups. For example, ``-D A -D B`` becomes ``-D A B``. One may +specify a group of options using shell-like quoting along with a ``SHELL:`` +prefix. The ``SHELL:`` prefix is dropped and the rest of the option string +is parsed using the :command:`separate_arguments` ``UNIX_COMMAND`` mode. +For example, ``"SHELL:-D A" "SHELL:-D B"`` becomes ``-D A -D B``. diff --git a/Help/command/add_compile_options.rst b/Help/command/add_compile_options.rst index 3fe2a33..44924e6 100644 --- a/Help/command/add_compile_options.rst +++ b/Help/command/add_compile_options.rst @@ -21,3 +21,5 @@ Arguments to ``add_compile_options`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. + +.. include:: COMPILE_OPTIONS_SHELL.txt diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst index 3e7dc47..b7b4dc1 100644 --- a/Help/command/target_compile_options.rst +++ b/Help/command/target_compile_options.rst @@ -38,3 +38,5 @@ Arguments to ``target_compile_options`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. + +.. include:: COMPILE_OPTIONS_SHELL.txt diff --git a/Help/release/dev/compile-options-shell.rst b/Help/release/dev/compile-options-shell.rst new file mode 100644 index 0000000..3f83e0c --- /dev/null +++ b/Help/release/dev/compile-options-shell.rst @@ -0,0 +1,6 @@ +compile-options-shell +--------------------- + +* :command:`target_compile_options` and :command:`add_compile_options` + commands gained a ``SHELL:`` prefix to specify a group of related + options using shell-like quoting. diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8cdba93..c3872c1 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2622,13 +2622,20 @@ std::vector cmGeneratorTarget::GetIncludeDirectories( return includes; } +enum class OptionsParse +{ + None, + Shell +}; + static void processCompileOptionsInternal( cmGeneratorTarget const* tgt, const std::vector& entries, std::vector& options, std::unordered_set& uniqueOptions, cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, - bool debugOptions, const char* logName, std::string const& language) + bool debugOptions, const char* logName, std::string const& language, + OptionsParse parse) { for (cmGeneratorTarget::TargetPropertyEntry* entry : entries) { std::vector entryOptions; @@ -2639,7 +2646,12 @@ static void processCompileOptionsInternal( std::string usedOptions; for (std::string const& opt : entryOptions) { if (uniqueOptions.insert(opt).second) { - options.push_back(opt); + if (parse == OptionsParse::Shell && + cmHasLiteralPrefix(opt, "SHELL:")) { + cmSystemTools::ParseUnixCommandLine(opt.c_str() + 6, options); + } else { + options.push_back(opt); + } if (debugOptions) { usedOptions += " * " + opt + "\n"; } @@ -2664,7 +2676,7 @@ static void processCompileOptions( { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, "options", - language); + language, OptionsParse::Shell); } void cmGeneratorTarget::GetCompileOptions(std::vector& result, @@ -2718,7 +2730,7 @@ static void processCompileFeatures( { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, "features", - std::string()); + std::string(), OptionsParse::None); } void cmGeneratorTarget::GetCompileFeatures(std::vector& result, @@ -2768,7 +2780,7 @@ static void processCompileDefinitions( { processCompileOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, config, debugOptions, - "definitions", language); + "definitions", language, OptionsParse::None); } void cmGeneratorTarget::GetCompileDefinitions( diff --git a/Tests/CompileOptions/CMakeLists.txt b/Tests/CompileOptions/CMakeLists.txt index 692e0de..c9f1710 100644 --- a/Tests/CompileOptions/CMakeLists.txt +++ b/Tests/CompileOptions/CMakeLists.txt @@ -18,9 +18,21 @@ set_property(TARGET CompileOptions PROPERTY COMPILE_OPTIONS "-DTEST_DEFINE" "-DNEEDS_ESCAPE=\"E$CAPE\"" "$<$:-DTEST_DEFINE_GNU>" + "SHELL:" # produces no options ${c_tests} ${cxx_tests} ) +if(BORLAND OR WATCOM) + # these compilers do not support separate -D flags + target_compile_definitions(CompileOptions PRIVATE NO_DEF_TESTS) +else() + set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS + "SHELL:-D DEF_A" + "$<1:SHELL:-D DEF_B>" + "SHELL:-D 'DEF_C' -D \"DEF_D\"" + [[SHELL:-D "DEF_STR=\"string with spaces\""]] + ) +endif() if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|Borland|Embarcadero") set_property(TARGET CompileOptions APPEND PROPERTY COMPILE_OPTIONS diff --git a/Tests/CompileOptions/main.cpp b/Tests/CompileOptions/main.cpp index 63a0480..4779b88 100644 --- a/Tests/CompileOptions/main.cpp +++ b/Tests/CompileOptions/main.cpp @@ -12,6 +12,28 @@ #endif #endif +#ifndef NO_DEF_TESTS +#ifndef DEF_A +#error Expected definition DEF_A +#endif + +#ifndef DEF_B +#error Expected definition DEF_B +#endif + +#ifndef DEF_C +#error Expected definition DEF_C +#endif + +#ifndef DEF_D +#error Expected definition DEF_D +#endif + +#ifndef DEF_STR +#error Expected definition DEF_STR +#endif +#endif + #include int main() @@ -20,6 +42,9 @@ int main() #ifdef TEST_OCTOTHORPE && strcmp(TEST_OCTOTHORPE, "#") == 0 #endif +#ifndef NO_DEF_TESTS + && strcmp(DEF_STR, "string with spaces") == 0 +#endif && strcmp(EXPECTED_C_COMPILER_VERSION, TEST_C_COMPILER_VERSION) == 0 && strcmp(EXPECTED_CXX_COMPILER_VERSION, TEST_CXX_COMPILER_VERSION) == ----------------------------------------------------------------------- Summary of changes: CONTRIBUTING.rst | 2 ++ Help/command/COMPILE_OPTIONS_SHELL.txt | 9 +++++++++ Help/command/add_compile_options.rst | 2 ++ Help/command/target_compile_options.rst | 2 ++ Help/release/dev/compile-options-shell.rst | 6 ++++++ Source/cmGeneratorTarget.cxx | 22 +++++++++++++++++----- Tests/CompileOptions/CMakeLists.txt | 12 ++++++++++++ Tests/CompileOptions/main.cpp | 25 +++++++++++++++++++++++++ 8 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 Help/command/COMPILE_OPTIONS_SHELL.txt create mode 100644 Help/release/dev/compile-options-shell.rst hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 00:05:35 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 00:05:35 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-243-g43e8e0b Message-ID: <20180316040536.0D53610A837@public.kitware.com> 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, master has been updated via 43e8e0b6884ddcf3f55826c2247af268698f23a6 (commit) from 018946aaafc9ada6852d55cb8034faf0f4c1afbc (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=43e8e0b6884ddcf3f55826c2247af268698f23a6 commit 43e8e0b6884ddcf3f55826c2247af268698f23a6 Author: Kitware Robot AuthorDate: Fri Mar 16 00:01:12 2018 -0400 Commit: Kitware Robot CommitDate: Fri Mar 16 00:01:12 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f95375e..184082a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180315) +set(CMake_VERSION_PATCH 20180316) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 07:35:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 07:35:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-247-g5eb20f6 Message-ID: <20180316113507.CBBC710B2E3@public.kitware.com> 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, master has been updated via 5eb20f66ec6ff8edb8b95b4b45d2b5a14c7d0ff8 (commit) via 30b7c40ad88a83eef1ef842bf93b777214808db4 (commit) via aa41fa90fde0fdff5529b27a52f592fc72e64cca (commit) via 96fdde26bbbc969944e556ad649191cd21f46990 (commit) from 43e8e0b6884ddcf3f55826c2247af268698f23a6 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5eb20f66ec6ff8edb8b95b4b45d2b5a14c7d0ff8 commit 5eb20f66ec6ff8edb8b95b4b45d2b5a14c7d0ff8 Merge: 30b7c40 aa41fa9 Author: Brad King AuthorDate: Fri Mar 16 07:29:11 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 07:29:11 2018 -0400 Merge branch 'release-3.10' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30b7c40ad88a83eef1ef842bf93b777214808db4 commit 30b7c40ad88a83eef1ef842bf93b777214808db4 Merge: 43e8e0b 96fdde2 Author: Brad King AuthorDate: Fri Mar 16 11:27:01 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 16 07:27:16 2018 -0400 Merge topic 'gtest_discover_tests_timeout' 96fdde26bb GoogleTest: Rename TIMEOUT parameter to avoid clash Acked-by: Kitware Robot Merge-request: !1851 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=aa41fa90fde0fdff5529b27a52f592fc72e64cca commit aa41fa90fde0fdff5529b27a52f592fc72e64cca Merge: 354a33f 96fdde2 Author: Brad King AuthorDate: Thu Mar 15 07:45:05 2018 -0400 Commit: Brad King CommitDate: Thu Mar 15 07:45:05 2018 -0400 Merge branch 'gtest_discover_tests_timeout' into release-3.10 Merge-request: !1851 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=96fdde26bbbc969944e556ad649191cd21f46990 commit 96fdde26bbbc969944e556ad649191cd21f46990 Author: Craig Scott AuthorDate: Thu Mar 15 00:16:36 2018 +1100 Commit: Brad King CommitDate: Thu Mar 15 07:36:42 2018 -0400 GoogleTest: Rename TIMEOUT parameter to avoid clash In gtest_discover_tests(), the TIMEOUT keyword was making it impossible to set the TIMEOUT test property via the PROPERTIES keyword. This would be a frequent case, but it doesn't complain and instead silently does something different to what would normally be expected. The TIMEOUT keyword has been renamed to DISCOVERY_TIMEOUT, thereby removing the clash. This is a breaking change. 3.10.1 and 3.10.2 were the only versions that supported the TIMEOUT keyword and uses of it were likely not working as intended. Fixes: #17801 diff --git a/Help/release/3.10.rst b/Help/release/3.10.rst index 6a19dbf..1205b17 100644 --- a/Help/release/3.10.rst +++ b/Help/release/3.10.rst @@ -139,7 +139,8 @@ Modules This is robust against unusual ways of labeling tests, provides much better support for advanced features such as parameterized tests, and does not require re-running CMake to discover added or removed tests within a test - executable. + executable. Note that a breaking change was made in CMake 3.10.3 to address + an ambiguity of the ``TIMEOUT`` keyword (see :ref:`Release Notes 3.10.3`). * The :module:`InstallRequiredSystemLibraries` module gained support for installing Intel compiler runtimes. @@ -267,3 +268,17 @@ Changes made since CMake 3.10.0 include the following. * The :manual:`cmake-server(7)` ``codemodel`` response ``crossReferences`` field added by 3.10.0 has been dropped due to excessive memory usage. Another approach will be needed to provide backtrace information. + +.. _`Release Notes 3.10.3`: + +3.10.3 +------ + +* CMake 3.10.1 added a ``TIMEOUT`` option to :command:`gtest_discover_tests` + from the :module:`GoogleTest` module. That keyword clashed with the + ``TIMEOUT`` test property, which is one of the common properties that + would be set with the command's ``PROPERTIES`` keyword, usually leading + to legal but unintended behavior. The keyword was changed to + ``DISCOVERY_TIMEOUT`` in CMake 3.10.3 to address this problem. The + ambiguous behavior of the :command:`gtest_discover_tests` command's + ``TIMEOUT`` keyword in 3.10.1 and 3.10.2 has not been preserved. diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index c525101..bfb83e1 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -150,6 +150,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also [NO_PRETTY_TYPES] [NO_PRETTY_VALUES] [PROPERTIES name1 value1...] [TEST_LIST var] + [DISCOVERY_TIMEOUT seconds] ) ``gtest_discover_tests`` sets up a post-build command on the test executable @@ -217,7 +218,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also executable is being used in multiple calls to ``gtest_discover_tests()``. Note that this variable is only available in CTest. - ``TIMEOUT num`` + ``DISCOVERY_TIMEOUT num`` Specifies how long (in seconds) CMake will wait for the test to enumerate available tests. If the test takes longer than this, discovery (and your build) will fail. Most test executables will enumerate their tests very @@ -225,6 +226,16 @@ same as the Google Test name (i.e. ``suite.testcase``); see also longer timeout. The default is 5. See also the ``TIMEOUT`` option of :command:`execute_process`. + .. note:: + + In CMake versions 3.10.1 and 3.10.2, this option was called ``TIMEOUT``. + This clashed with the ``TIMEOUT`` test property, which is one of the + common properties that would be set with the ``PROPERTIES`` keyword, + usually leading to legal but unintended behavior. The keyword was + changed to ``DISCOVERY_TIMEOUT`` in CMake 3.10.3 to address this + problem. The ambiguous behavior of the ``TIMEOUT`` keyword in 3.10.1 + and 3.10.2 has not been preserved. + #]=======================================================================] #------------------------------------------------------------------------------ @@ -357,7 +368,7 @@ function(gtest_discover_tests TARGET) cmake_parse_arguments( "" "NO_PRETTY_TYPES;NO_PRETTY_VALUES" - "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;TIMEOUT" + "TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;DISCOVERY_TIMEOUT" "EXTRA_ARGS;PROPERTIES" ${ARGN} ) @@ -368,8 +379,8 @@ function(gtest_discover_tests TARGET) if(NOT _TEST_LIST) set(_TEST_LIST ${TARGET}_TESTS) endif() - if(NOT _TIMEOUT) - set(_TIMEOUT 5) + if(NOT _DISCOVERY_TIMEOUT) + set(_DISCOVERY_TIMEOUT 5) endif() get_property( @@ -418,7 +429,7 @@ function(gtest_discover_tests TARGET) -D "NO_PRETTY_VALUES=${_NO_PRETTY_VALUES}" -D "TEST_LIST=${_TEST_LIST}" -D "CTEST_FILE=${ctest_tests_file}" - -D "TEST_DISCOVERY_TIMEOUT=${_TIMEOUT}" + -D "TEST_DISCOVERY_TIMEOUT=${_DISCOVERY_TIMEOUT}" -P "${_GOOGLETEST_DISCOVER_TESTS_SCRIPT}" VERBATIM ) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-timeout-result.txt similarity index 100% copy from Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt copy to Tests/RunCMake/GoogleTest/GoogleTest-discovery-timeout-result.txt diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-timeout-stdout.txt similarity index 80% rename from Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt rename to Tests/RunCMake/GoogleTest/GoogleTest-discovery-timeout-stdout.txt index 8464c80..3a6572c 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-discovery-timeout-stdout.txt @@ -1,7 +1,7 @@ ( *|[0-9]+>)CMake Error at .*GoogleTestAddTests.cmake:[0-9]+ \(message\): ( *|[0-9]+>) Error running test executable. ?( *|[0-9]+>) -( *|[0-9]+>) Path: '.*timeout_test(\.exe)?' +( *|[0-9]+>) Path: '.*discovery_timeout_test(\.exe)?' ( *|[0-9]+>) Result: Process terminated due to timeout ( *|[0-9]+>) Output: ( *|[0-9]+>) + diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-result.txt similarity index 100% copy from Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt copy to Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-result.txt diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt new file mode 100644 index 0000000..0dda49d --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt @@ -0,0 +1,10 @@ +Test project .*GoogleTest-build +[ \t]*Start [0-9]+: property_timeout.case_no_discovery +[^\n]+property_timeout.case_no_discovery +\.+\*\*\*Timeout +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[^\n]*property_timeout.case_no_discovery \(Timeout\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-result.txt similarity index 100% rename from Tests/RunCMake/GoogleTest/GoogleTest-timeout-result.txt rename to Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-result.txt diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt new file mode 100644 index 0000000..72cea55 --- /dev/null +++ b/Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt @@ -0,0 +1,10 @@ +Test project .*GoogleTest-build +[ \t]*Start [0-9]+: property_timeout.case_with_discovery +[^\n]+property_timeout.case_with_discovery +\.+\*\*\*Timeout +[0-9.]+ sec ++ +0% tests passed, 1 tests failed out of 1 ++ +Total Test time \(real\) = +[0-9.]+ sec ++ +The following tests FAILED: +[^\n]*property_timeout.case_with_discovery \(Timeout\) diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt index 55a4a7a..a4cc971 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test-missing-stderr.txt @@ -1,2 +1,2 @@ -Unable to find executable: timeout_test_NOT_BUILT +Unable to find executable: no_tests_defined_NOT_BUILT Errors while running CTest diff --git a/Tests/RunCMake/GoogleTest/GoogleTest.cmake b/Tests/RunCMake/GoogleTest/GoogleTest.cmake index 5e4b8ef..31808c6 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest.cmake +++ b/Tests/RunCMake/GoogleTest/GoogleTest.cmake @@ -22,8 +22,38 @@ gtest_discover_tests( PROPERTIES LABELS TEST2 ) -add_executable(timeout_test timeout_test.cpp) +add_executable(no_tests_defined no_tests_defined.cpp) gtest_discover_tests( - timeout_test + no_tests_defined +) + +# Note change in behavior of TIMEOUT keyword in 3.10.3 +# where it was renamed to DISCOVERY_TIMEOUT to prevent it +# from shadowing the TIMEOUT test property. Verify the +# 3.10.3 and later behavior, old behavior added in 3.10.1 +# is not supported. +add_executable(property_timeout_test timeout_test.cpp) +target_compile_definitions(property_timeout_test PRIVATE sleepSec=10) + +gtest_discover_tests( + property_timeout_test + TEST_PREFIX property_ + TEST_SUFFIX _no_discovery + PROPERTIES TIMEOUT 2 +) +gtest_discover_tests( + property_timeout_test + TEST_PREFIX property_ + TEST_SUFFIX _with_discovery + DISCOVERY_TIMEOUT 20 + PROPERTIES TIMEOUT 2 +) + +add_executable(discovery_timeout_test timeout_test.cpp) +target_compile_definitions(discovery_timeout_test PRIVATE discoverySleepSec=10) +gtest_discover_tests( + discovery_timeout_test + TEST_PREFIX discovery_ + DISCOVERY_TIMEOUT 2 ) diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake index 73014d1..50979ec 100644 --- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake @@ -19,12 +19,19 @@ function(run_GoogleTest) --target fake_gtest ) + run_cmake_command(GoogleTest-property-timeout-exe + ${CMAKE_COMMAND} + --build . + --config Debug + --target property_timeout_test + ) + set(RunCMake_TEST_OUTPUT_MERGE 1) - run_cmake_command(GoogleTest-timeout + run_cmake_command(GoogleTest-discovery-timeout ${CMAKE_COMMAND} --build . --config Debug - --target timeout_test + --target discovery_timeout_test ) set(RunCMake_TEST_OUTPUT_MERGE 0) @@ -45,7 +52,21 @@ function(run_GoogleTest) run_cmake_command(GoogleTest-test-missing ${CMAKE_CTEST_COMMAND} -C Debug - -R timeout + -R no_tests_defined + --no-label-summary + ) + + run_cmake_command(GoogleTest-property-timeout1 + ${CMAKE_CTEST_COMMAND} + -C Debug + -R property_timeout\\.case_no_discovery + --no-label-summary + ) + + run_cmake_command(GoogleTest-property-timeout2 + ${CMAKE_CTEST_COMMAND} + -C Debug + -R property_timeout\\.case_with_discovery --no-label-summary ) endfunction() diff --git a/Tests/RunCMake/GoogleTest/no_tests_defined.cpp b/Tests/RunCMake/GoogleTest/no_tests_defined.cpp new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/RunCMake/GoogleTest/no_tests_defined.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/GoogleTest/timeout_test.cpp b/Tests/RunCMake/GoogleTest/timeout_test.cpp index a8e5c1c..9162dcf 100644 --- a/Tests/RunCMake/GoogleTest/timeout_test.cpp +++ b/Tests/RunCMake/GoogleTest/timeout_test.cpp @@ -4,12 +4,36 @@ #include #endif -int main() +#include +#include + +void sleepFor(unsigned seconds) { #if defined(_WIN32) - Sleep(10000); + Sleep(seconds * 1000); #else - sleep(10); + sleep(seconds); +#endif +} + +int main(int argc, char** argv) +{ + // Note: GoogleTest.cmake doesn't actually depend on Google Test as such; + // it only requires that we produce output in the expected format when + // invoked with --gtest_list_tests. Thus, we fake that here. This allows us + // to test the module without actually needing Google Test. + if (argc > 1 && std::string(argv[1]) == "--gtest_list_tests") { + std::cout << "timeout." << std::endl; + std::cout << " case" << std::endl; +#ifdef discoverySleepSec + sleepFor(discoverySleepSec); +#endif + return 0; + } + +#ifdef sleepSec + sleepFor(sleepSec); #endif + return 0; } ----------------------------------------------------------------------- Summary of changes: Help/release/3.10.rst | 17 +++++++++- Modules/GoogleTest.cmake | 21 +++++++++--- ...txt => GoogleTest-discovery-timeout-result.txt} | 0 ...txt => GoogleTest-discovery-timeout-stdout.txt} | 2 +- .../GoogleTest-property-timeout1-result.txt} | 0 .../GoogleTest-property-timeout1-stderr.txt} | 0 .../GoogleTest-property-timeout1-stdout.txt | 10 ++++++ .../GoogleTest-property-timeout2-result.txt} | 0 .../GoogleTest-property-timeout2-stderr.txt} | 0 .../GoogleTest-property-timeout2-stdout.txt | 10 ++++++ .../GoogleTest/GoogleTest-test-missing-stderr.txt | 2 +- Tests/RunCMake/GoogleTest/GoogleTest.cmake | 34 ++++++++++++++++++-- Tests/RunCMake/GoogleTest/RunCMakeTest.cmake | 27 ++++++++++++++-- .../RunCMake/GoogleTest/no_tests_defined.cpp | 0 Tests/RunCMake/GoogleTest/timeout_test.cpp | 30 +++++++++++++++-- 15 files changed, 137 insertions(+), 16 deletions(-) rename Tests/RunCMake/GoogleTest/{GoogleTest-timeout-result.txt => GoogleTest-discovery-timeout-result.txt} (100%) rename Tests/RunCMake/GoogleTest/{GoogleTest-timeout-stdout.txt => GoogleTest-discovery-timeout-stdout.txt} (80%) copy Tests/RunCMake/{CMP0060/CMP0060-OLD-Build-result.txt => GoogleTest/GoogleTest-property-timeout1-result.txt} (100%) copy Tests/RunCMake/{CTestCommandLine/TestOutputSize-stderr.txt => GoogleTest/GoogleTest-property-timeout1-stderr.txt} (100%) create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt copy Tests/RunCMake/{CMP0060/CMP0060-OLD-Build-result.txt => GoogleTest/GoogleTest-property-timeout2-result.txt} (100%) copy Tests/RunCMake/{CTestCommandLine/TestOutputSize-stderr.txt => GoogleTest/GoogleTest-property-timeout2-stderr.txt} (100%) create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt copy Modules/DummyCXXFile.cxx => Tests/RunCMake/GoogleTest/no_tests_defined.cpp (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 07:55:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 07:55:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-249-gf919600 Message-ID: <20180316115504.81F3AFBC96@public.kitware.com> 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, master has been updated via f919600ed6ec910f14ae73e583745fc5b05f7882 (commit) via df27bd3f83f3854df24bce9b0a57b425b0396585 (commit) from 5eb20f66ec6ff8edb8b95b4b45d2b5a14c7d0ff8 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f919600ed6ec910f14ae73e583745fc5b05f7882 commit f919600ed6ec910f14ae73e583745fc5b05f7882 Merge: 5eb20f6 df27bd3 Author: Brad King AuthorDate: Fri Mar 16 07:52:47 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 07:52:47 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 07:55:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 07:55:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-15-gdf27bd3 Message-ID: <20180316115504.ED41BFBCAB@public.kitware.com> 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, release has been updated via df27bd3f83f3854df24bce9b0a57b425b0396585 (commit) via 96fdde26bbbc969944e556ad649191cd21f46990 (commit) from 298e1bfe2870d649ed1ec0054137d6417c7d5ef2 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/release/3.10.rst | 17 +++++++++- Modules/GoogleTest.cmake | 21 +++++++++--- ...txt => GoogleTest-discovery-timeout-result.txt} | 0 ...txt => GoogleTest-discovery-timeout-stdout.txt} | 2 +- .../GoogleTest-property-timeout1-result.txt} | 0 .../GoogleTest-property-timeout1-stderr.txt} | 0 .../GoogleTest-property-timeout1-stdout.txt | 10 ++++++ .../GoogleTest-property-timeout2-result.txt} | 0 .../GoogleTest-property-timeout2-stderr.txt} | 0 .../GoogleTest-property-timeout2-stdout.txt | 10 ++++++ .../GoogleTest/GoogleTest-test-missing-stderr.txt | 2 +- Tests/RunCMake/GoogleTest/GoogleTest.cmake | 34 ++++++++++++++++++-- Tests/RunCMake/GoogleTest/RunCMakeTest.cmake | 27 ++++++++++++++-- .../RunCMake/GoogleTest/no_tests_defined.cpp | 0 Tests/RunCMake/GoogleTest/timeout_test.cpp | 30 +++++++++++++++-- 15 files changed, 137 insertions(+), 16 deletions(-) rename Tests/RunCMake/GoogleTest/{GoogleTest-timeout-result.txt => GoogleTest-discovery-timeout-result.txt} (100%) rename Tests/RunCMake/GoogleTest/{GoogleTest-timeout-stdout.txt => GoogleTest-discovery-timeout-stdout.txt} (80%) copy Tests/RunCMake/{CMP0060/CMP0060-OLD-Build-result.txt => GoogleTest/GoogleTest-property-timeout1-result.txt} (100%) copy Tests/RunCMake/{CTestCommandLine/TestOutputSize-stderr.txt => GoogleTest/GoogleTest-property-timeout1-stderr.txt} (100%) create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-property-timeout1-stdout.txt copy Tests/RunCMake/{CMP0060/CMP0060-OLD-Build-result.txt => GoogleTest/GoogleTest-property-timeout2-result.txt} (100%) copy Tests/RunCMake/{CTestCommandLine/TestOutputSize-stderr.txt => GoogleTest/GoogleTest-property-timeout2-stderr.txt} (100%) create mode 100644 Tests/RunCMake/GoogleTest/GoogleTest-property-timeout2-stdout.txt copy Modules/DummyCXXFile.cxx => Tests/RunCMake/GoogleTest/no_tests_defined.cpp (100%) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 08:45:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 08:45:02 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-251-gb3e668e Message-ID: <20180316124502.DE9E5FBC96@public.kitware.com> 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, master has been updated via b3e668ea25d35a04adc41e17cfb4c8ab7a97a7d9 (commit) via e4a0d8f39987a4574336892106b39781fd2d4e50 (commit) from f919600ed6ec910f14ae73e583745fc5b05f7882 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b3e668ea25d35a04adc41e17cfb4c8ab7a97a7d9 commit b3e668ea25d35a04adc41e17cfb4c8ab7a97a7d9 Merge: f919600 e4a0d8f Author: Brad King AuthorDate: Fri Mar 16 08:39:53 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 08:39:53 2018 -0400 Merge branch 'release-3.10' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4a0d8f39987a4574336892106b39781fd2d4e50 commit e4a0d8f39987a4574336892106b39781fd2d4e50 Author: Brad King AuthorDate: Fri Mar 16 07:34:34 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 07:34:34 2018 -0400 CMake 3.10.3 diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c262bdd..9367e48 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 10) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 16 08:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 16 Mar 2018 08:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.10.3, created. v3.10.3 Message-ID: <20180316125502.8A34C1073F1@public.kitware.com> 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 annotated tag, v3.10.3 has been created at 808ee50cfb5c0fa5dc2bc98013095c2a6f13848e (tag) tagging e4a0d8f39987a4574336892106b39781fd2d4e50 (commit) replaces v3.10.2 tagged by Brad King on Fri Mar 16 08:39:16 2018 -0400 - Log ----------------------------------------------------------------- CMake 3.10.3 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlqruvQWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhI9mD/97EfgZT5hboa4kGIGhmGjS/2Bl /EJjktx/80smi3HE5bhsNXeagGhlVBaZj9ul8hArHOgP/ZGho0AOI/ZmO82ZW6TR fe7XhrOUztEY06JfcFtI0YexfhVO9X/euPywev/VWZBF/hf+0yS90ZO9Hro24jU4 I8Nn21MXE3wDaLjyUPFybct3qklojWT+kSya0lv+44cm6AWdygB51zcvSnfI8hs6 KYU/VTExc5H20T107oeEu/sa0ilXkepKpy3ylm2GzV1IxlIvcTTgqc6ikzBwL6RV UfReMcHvzf1wxdji1KoSrCHuFuPyxLQIT0lymvqJTi38QDLum/1ssLBZo9GwYLlO uZ7gwiuKrI0sT/SyAmByEL3Yh+MLn7VVrP8DGYuNvpIq5mxZQn9ZgCn3nJWIsVQY v2ipB3peGJI+YcavrGtVHPm84w9/tZyqlS0XPZKx3qw/oMbOGac67u+vScWSRSD1 x9CI0QLj08Z3inhOuiTnZVswxiIeoPzVzEveNqWxUo4kmyCp9zZyyJe8ITT30MZC Ck3DG66nGgI0hUCbCEGU5e62nVxfubZq1rrbfilkSQMvE+k6LQUIMWM4Gozl9vZv Ddx9rsz9fBwYbptcoDikz+Y2pCKXkvOQVv61K8MEhSm1r+uSBan4+PkJcYChLKMJ ODvf+Z2YH7+fzihMYQ== =+sfB -----END PGP SIGNATURE----- Brad King (4): Merge branch 'autogen-empty-source-file-fix' into release-3.10 Merge branch 'ccmake-stack-smashing' into release-3.10 Merge branch 'gtest_discover_tests_timeout' into release-3.10 CMake 3.10.3 Craig Scott (1): GoogleTest: Rename TIMEOUT parameter to avoid clash Sebastian Holtermann (1): Autogen: Fix for the empty source file crash in 3.10.2 Tianhao Chai (1): ccmake: fix status line buffer overflow on very wide terminals ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 17 00:05:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 17 Mar 2018 00:05:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-252-gc824b6c Message-ID: <20180317040509.7196910ABFD@public.kitware.com> 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, master has been updated via c824b6c667cdcb978d6ed52ca5d19fd0b6bfde27 (commit) from b3e668ea25d35a04adc41e17cfb4c8ab7a97a7d9 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c824b6c667cdcb978d6ed52ca5d19fd0b6bfde27 commit c824b6c667cdcb978d6ed52ca5d19fd0b6bfde27 Author: Kitware Robot AuthorDate: Sat Mar 17 00:01:12 2018 -0400 Commit: Kitware Robot CommitDate: Sat Mar 17 00:01:12 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 184082a..4895556 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180316) +set(CMake_VERSION_PATCH 20180317) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 17 18:25:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 17 Mar 2018 18:25:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-257-g80784ef Message-ID: <20180317222507.597A510AEB8@public.kitware.com> 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, master has been updated via 80784ef77fa95138b197416905b3d4acf0a0d78a (commit) via 73f9b2974c80394564e6af5b808133cba48ccf34 (commit) via fd28c382b44ee355099750419ecd46e0aa175de0 (commit) via 9b57cb62ea7f1557694054b552cbeb39fb12788e (commit) via c89993d529efa53ce869537cd902f57064c9c678 (commit) from c824b6c667cdcb978d6ed52ca5d19fd0b6bfde27 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80784ef77fa95138b197416905b3d4acf0a0d78a commit 80784ef77fa95138b197416905b3d4acf0a0d78a Merge: c824b6c 73f9b29 Author: Craig Scott AuthorDate: Sat Mar 17 22:24:12 2018 +0000 Commit: Kitware Robot CommitDate: Sat Mar 17 18:24:44 2018 -0400 Merge topic 'project-homepage-url' 73f9b2974c project: Add HOMEPAGE_URL named parameter fd28c382b4 project: Add _DESCRIPTION 9b57cb62ea Help: Fix minor typo in docs for CMAKE_PROJECT_DESCRIPTION c89993d529 Tests: Avoid enabling languages unnecessarily in RunCMake.project Acked-by: Kitware Robot Merge-request: !1816 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73f9b2974c80394564e6af5b808133cba48ccf34 commit 73f9b2974c80394564e6af5b808133cba48ccf34 Author: Alex Turbov AuthorDate: Fri Mar 16 07:29:31 2018 +1100 Commit: Craig Scott CommitDate: Sat Mar 17 08:25:48 2018 +1100 project: Add HOMEPAGE_URL named parameter This sets variables like PROJECT_HOMEPAGE_URL, which can be used as default values for various things (packaging modules, doxygen defaults, etc.). Some packaging modules have been updated to do this as part of this commit. Co-Author: Craig Scott diff --git a/Help/command/project.rst b/Help/command/project.rst index 062e9ea..e46dd69 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -9,6 +9,7 @@ Sets project details such as name, version, etc. and enables languages. project( [VERSION [.[.[.]]]] [DESCRIPTION ] + [HOMEPAGE_URL ] [LANGUAGES ...]) Sets the name of the project and stores the name in the @@ -46,6 +47,14 @@ and :variable:`_DESCRIPTION` will be set to its argument. The description is expected to be a relatively short string, usually no more than a few words. +The optional ``HOMEPAGE_URL`` sets the analogous variables +:variable:`PROJECT_HOMEPAGE_URL` and :variable:`_HOMEPAGE_URL`. +When this option is given, the URL provided should be the canonical home for +the project. + +Note that the description and homepage URL may be used as defaults for +things like packaging meta-data, documentation, etc. + Optionally you can specify which languages your project supports. Example languages include ``C``, ``CXX`` (i.e. C++), ``CUDA``, ``Fortran``, and ``ASM``. @@ -65,9 +74,10 @@ literal, direct call to the :command:`project` command; loading one through the :command:`include` command is not sufficient. If no such call exists CMake will implicitly add one to the top that enables the default languages (``C`` and ``CXX``). The name of the project set in -the top level CMakeLists.txt file is available from the -:variable:`CMAKE_PROJECT_NAME` variable and its description from -:variable:`CMAKE_PROJECT_DESCRIPTION`. +the top level ``CMakeLists.txt`` file is available from the +:variable:`CMAKE_PROJECT_NAME` variable, its description from +:variable:`CMAKE_PROJECT_DESCRIPTION` and its homepage URL from +:variable:`CMAKE_PROJECT_HOMEPAGE_URL`. .. note:: Call the :command:`cmake_minimum_required` command at the beginning diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 2bf8c9c..0cb90d4 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -67,6 +67,7 @@ Variables that Provide Information /variable/CMAKE_PARENT_LIST_FILE /variable/CMAKE_PATCH_VERSION /variable/CMAKE_PROJECT_DESCRIPTION + /variable/CMAKE_PROJECT_HOMEPAGE_URL /variable/CMAKE_PROJECT_NAME /variable/CMAKE_RANLIB /variable/CMAKE_ROOT @@ -98,6 +99,7 @@ Variables that Provide Information /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT-NAME_BINARY_DIR /variable/PROJECT-NAME_DESCRIPTION + /variable/PROJECT-NAME_HOMEPAGE_URL /variable/PROJECT-NAME_SOURCE_DIR /variable/PROJECT-NAME_VERSION /variable/PROJECT-NAME_VERSION_MAJOR @@ -106,6 +108,7 @@ Variables that Provide Information /variable/PROJECT-NAME_VERSION_TWEAK /variable/PROJECT_BINARY_DIR /variable/PROJECT_DESCRIPTION + /variable/PROJECT_HOMEPAGE_URL /variable/PROJECT_NAME /variable/PROJECT_SOURCE_DIR /variable/PROJECT_VERSION diff --git a/Help/release/dev/project-homepage.rst b/Help/release/dev/project-homepage.rst new file mode 100644 index 0000000..25799a4 --- /dev/null +++ b/Help/release/dev/project-homepage.rst @@ -0,0 +1,7 @@ +project-homepage +---------------- + +* The :command:`project` command learned an optional ``HOMEPAGE_URL`` + parameter which has the effect of setting variables like + :variable:`PROJECT_HOMEPAGE_URL`, :variable:`_HOMEPAGE_URL` + and :variable:`CMAKE_PROJECT_HOMEPAGE_URL`. diff --git a/Help/variable/CMAKE_PROJECT_HOMEPAGE_URL.rst b/Help/variable/CMAKE_PROJECT_HOMEPAGE_URL.rst new file mode 100644 index 0000000..ee0bf7c --- /dev/null +++ b/Help/variable/CMAKE_PROJECT_HOMEPAGE_URL.rst @@ -0,0 +1,35 @@ +CMAKE_PROJECT_HOMEPAGE_URL +-------------------------- + +The homepage URL of the top level project. + +This variable holds the homepage URL of the project as specified in the top +level CMakeLists.txt file by a :command:`project` command. In the event that +the top level CMakeLists.txt contains multiple :command:`project` calls, +the most recently called one from that top level CMakeLists.txt will determine +the value that ``CMAKE_PROJECT_HOMEPAGE_URL`` contains. For example, consider +the following top level CMakeLists.txt: + +.. code-block:: cmake + + cmake_minimum_required(VERSION 3.0) + project(First HOMEPAGE_URL "http://first.example.com") + project(Second HOMEPAGE_URL "http://second.example.com") + add_subdirectory(sub) + project(Third HOMEPAGE_URL "http://third.example.com") + +And ``sub/CMakeLists.txt`` with the following contents: + +.. code-block:: cmake + + project(SubProj HOMEPAGE_URL "http://subproj.example.com") + message("CMAKE_PROJECT_HOMEPAGE_URL = ${CMAKE_PROJECT_HOMEPAGE_URL}") + +The most recently seen :command:`project` command from the top level +CMakeLists.txt would be ``project(Second ...)``, so this will print:: + + CMAKE_PROJECT_HOMEPAGE_URL = http://second.example.com + +To obtain the homepage URL from the most recent call to :command:`project` in +the current directory scope or above, see the :variable:`PROJECT_HOMEPAGE_URL` +variable. diff --git a/Help/variable/PROJECT-NAME_HOMEPAGE_URL.rst b/Help/variable/PROJECT-NAME_HOMEPAGE_URL.rst new file mode 100644 index 0000000..22cc304 --- /dev/null +++ b/Help/variable/PROJECT-NAME_HOMEPAGE_URL.rst @@ -0,0 +1,5 @@ +_HOMEPAGE_URL +--------------------------- + +Value given to the ``HOMEPAGE_URL`` option of the most recent call to the +:command:`project` command with project name ````, if any. diff --git a/Help/variable/PROJECT_HOMEPAGE_URL.rst b/Help/variable/PROJECT_HOMEPAGE_URL.rst new file mode 100644 index 0000000..754c9e8 --- /dev/null +++ b/Help/variable/PROJECT_HOMEPAGE_URL.rst @@ -0,0 +1,9 @@ +PROJECT_HOMEPAGE_URL +-------------------- + +The homepage URL of the project. + +This is the homepage URL given to the most recently called :command:`project` +command in the current directory scope or above. To obtain the homepage URL +of the top level project, see the :variable:`CMAKE_PROJECT_HOMEPAGE_URL` +variable. diff --git a/Modules/CPackDeb.cmake b/Modules/CPackDeb.cmake index 35447c9..444f632 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -254,7 +254,7 @@ # upstream documentation or information may be found. # # * Mandatory : NO -# * Default : - +# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` # # .. note:: # @@ -914,6 +914,11 @@ function(cpack_deb_prepare_package_vars) endif() endif() + # Homepage: (optional) + if(NOT CPACK_DEBIAN_PACKAGE_HOMEPAGE AND CMAKE_PROJECT_HOMEPAGE_URL) + set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CMAKE_PROJECT_HOMEPAGE_URL}") + endif() + # Section: (recommended) if(NOT CPACK_DEBIAN_PACKAGE_SECTION) set(CPACK_DEBIAN_PACKAGE_SECTION "devel") diff --git a/Modules/CPackFreeBSD.cmake b/Modules/CPackFreeBSD.cmake index 7fec78a..b681d4f 100644 --- a/Modules/CPackFreeBSD.cmake +++ b/Modules/CPackFreeBSD.cmake @@ -80,7 +80,8 @@ the RPM information (e.g. package license). * Mandatory: YES * Default: - - :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already + - :variable:`CMAKE_PROJECT_HOMEPAGE_URL`, or if that is not set, + :variable:`CPACK_DEBIAN_PACKAGE_HOMEPAGE` (this may be set already for Debian packaging, so we may as well re-use it). .. variable:: CPACK_FREEBSD_PACKAGE_LICENSE @@ -208,6 +209,7 @@ _cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_DESCRIPTION" # There's really only one homepage for a project, so # re-use the Debian setting if it's there. _cpack_freebsd_fallback_var("CPACK_FREEBSD_PACKAGE_WWW" + "CMAKE_PROJECT_HOMEPAGE_URL" "CPACK_DEBIAN_PACKAGE_HOMEPAGE" "_cpack_freebsd_fallback_www" ) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 258922c..87385de 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -191,7 +191,7 @@ # The projects URL. # # * Mandatory : NO -# * Default : - +# * Default : :variable:`CMAKE_PROJECT_HOMEPAGE_URL` # # .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION # CPACK_RPM__PACKAGE_DESCRIPTION @@ -1787,6 +1787,10 @@ function(cpack_rpm_generate_package) endif() endif() + if(NOT CPACK_RPM_PACKAGE_URL AND CMAKE_PROJECT_HOMEPAGE_URL) + set(CPACK_RPM_PACKAGE_URL "${CMAKE_PROJECT_HOMEPAGE_URL}") + endif() + # CPACK_RPM_PACKAGE_NAME (mandatory) if(NOT CPACK_RPM_PACKAGE_NAME) string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 3470648..6ddb0b8 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -68,8 +68,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, bool haveVersion = false; bool haveLanguages = false; bool haveDescription = false; + bool haveHomepage = false; std::string version; std::string description; + std::string homepage; std::vector languages; std::function missedValueReporter; auto resetReporter = [&missedValueReporter]() { @@ -78,6 +80,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, enum Doing { DoingDescription, + DoingHomepage, DoingLanguages, DoingVersion }; @@ -141,6 +144,22 @@ bool cmProjectCommand::InitialPass(std::vector const& args, "by a value that expanded to nothing."); resetReporter(); }; + } else if (args[i] == "HOMEPAGE_URL") { + if (haveHomepage) { + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, "HOMEPAGE_URL may be specified at most once."); + cmSystemTools::SetFatalErrorOccured(); + return true; + } + haveHomepage = true; + doing = DoingHomepage; + missedValueReporter = [this, &resetReporter]() { + this->Makefile->IssueMessage( + cmake::WARNING, + "HOMEPAGE_URL keyword not followed by a value or was followed " + "by a value that expanded to nothing."); + resetReporter(); + }; } else if (doing == DoingVersion) { doing = DoingLanguages; version = args[i]; @@ -149,6 +168,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, doing = DoingLanguages; description = args[i]; resetReporter(); + } else if (doing == DoingHomepage) { + doing = DoingLanguages; + homepage = args[i]; + resetReporter(); } else // doing == DoingLanguages { languages.push_back(args[i]); @@ -159,12 +182,12 @@ bool cmProjectCommand::InitialPass(std::vector const& args, missedValueReporter(); } - if ((haveVersion || haveDescription) && !haveLanguages && + if ((haveVersion || haveDescription || haveHomepage) && !haveLanguages && !languages.empty()) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, - "project with VERSION or DESCRIPTION must use LANGUAGES before " - "language names."); + "project with VERSION, DESCRIPTION or HOMEPAGE_URL must " + "use LANGUAGES before language names."); cmSystemTools::SetFatalErrorOccured(); return true; } @@ -277,6 +300,24 @@ bool cmProjectCommand::InitialPass(std::vector const& args, } } + if (haveHomepage) { + this->Makefile->AddDefinition("PROJECT_HOMEPAGE_URL", homepage.c_str()); + this->Makefile->AddDefinition(projectName + "_HOMEPAGE_URL", + homepage.c_str()); + // Set the CMAKE_PROJECT_HOMEPAGE_URL variable to be the highest-level + // project name in the tree. If there are two project commands + // in the same CMakeLists.txt file, and it is the top level + // CMakeLists.txt file, then go with the last one. + if (!this->Makefile->GetDefinition("CMAKE_PROJECT_HOMEPAGE_URL") || + (this->Makefile->IsRootMakefile())) { + this->Makefile->AddDefinition("CMAKE_PROJECT_HOMEPAGE_URL", + homepage.c_str()); + this->Makefile->AddCacheDefinition( + "CMAKE_PROJECT_HOMEPAGE_URL", homepage.c_str(), + "Value Computed by CMake", cmStateEnums::STATIC); + } + } + if (languages.empty()) { // if no language is specified do c and c++ languages.push_back("C"); diff --git a/Tests/RunCMake/project/ProjectHomepage-stdout.txt b/Tests/RunCMake/project/ProjectHomepage-stdout.txt new file mode 100644 index 0000000..253990f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage-stdout.txt @@ -0,0 +1,3 @@ +-- PROJECT_HOMEPAGE_URL=http://example.com +-- CMAKE_PROJECT_HOMEPAGE_URL=http://example.com +-- ProjectHomepageTest_HOMEPAGE_URL=http://example.com diff --git a/Tests/RunCMake/project/ProjectHomepage.cmake b/Tests/RunCMake/project/ProjectHomepage.cmake new file mode 100644 index 0000000..3307f1f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage.cmake @@ -0,0 +1,14 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectHomepageTest VERSION 1.0.0 HOMEPAGE_URL "http://example.com" LANGUAGES) +if(NOT PROJECT_HOMEPAGE_URL) + message(FATAL_ERROR "PROJECT_HOMEPAGE_URL expected to be set") +endif() +if(NOT CMAKE_PROJECT_HOMEPAGE_URL) + message(FATAL_ERROR "CMAKE_PROJECT_HOMEPAGE_URL expected to be set") +endif() +if(NOT ProjectHomepageTest_HOMEPAGE_URL) + message(FATAL_ERROR "ProjectHomepageTest_HOMEPAGE_URL expected to be set") +endif() +message(STATUS "PROJECT_HOMEPAGE_URL=${PROJECT_HOMEPAGE_URL}") +message(STATUS "CMAKE_PROJECT_HOMEPAGE_URL=${CMAKE_PROJECT_HOMEPAGE_URL}") +message(STATUS "ProjectHomepageTest_HOMEPAGE_URL=${ProjectHomepageTest_HOMEPAGE_URL}") diff --git a/Tests/RunCMake/project/ProjectHomepage2-result.txt b/Tests/RunCMake/project/ProjectHomepage2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/project/ProjectHomepage2-stderr.txt b/Tests/RunCMake/project/ProjectHomepage2-stderr.txt new file mode 100644 index 0000000..4a0adc2 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at ProjectHomepage2.cmake:2 \(project\): + HOMEPAGE_URL may be specified at most once. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/ProjectHomepage2.cmake b/Tests/RunCMake/project/ProjectHomepage2.cmake new file mode 100644 index 0000000..184c392 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepage2.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 HOMEPAGE_URL "http://example.com" HOMEPAGE_URL "http://example.com" LANGUAGES) diff --git a/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt b/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt new file mode 100644 index 0000000..c9503b7 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning at ProjectHomepageNoArg.cmake:2 \(project\): + HOMEPAGE_URL keyword not followed by a value or was followed by a value + that expanded to nothing. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/project/ProjectHomepageNoArg.cmake b/Tests/RunCMake/project/ProjectHomepageNoArg.cmake new file mode 100644 index 0000000..4605541 --- /dev/null +++ b/Tests/RunCMake/project/ProjectHomepageNoArg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0048 NEW) +project(ProjectDescriptionTest VERSION 1.0.0 LANGUAGES NONE HOMEPAGE_URL) diff --git a/Tests/RunCMake/project/RunCMakeTest.cmake b/Tests/RunCMake/project/RunCMakeTest.cmake index f77c15d..e9fb929 100644 --- a/Tests/RunCMake/project/RunCMakeTest.cmake +++ b/Tests/RunCMake/project/RunCMakeTest.cmake @@ -12,6 +12,9 @@ run_cmake(ProjectDescription) run_cmake(ProjectDescription2) run_cmake(ProjectDescriptionNoArg) run_cmake(ProjectDescriptionNoArg2) +run_cmake(ProjectHomepage) +run_cmake(ProjectHomepage2) +run_cmake(ProjectHomepageNoArg) run_cmake(VersionAndLanguagesEmpty) run_cmake(VersionEmpty) run_cmake(VersionInvalid) diff --git a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt index 1139df7..576ac69 100644 --- a/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt +++ b/Tests/RunCMake/project/VersionMissingLanguages-stderr.txt @@ -1,5 +1,5 @@ CMake Error at VersionMissingLanguages.cmake:2 \(project\): - project with VERSION or DESCRIPTION must use LANGUAGES before language - names. + project with VERSION, DESCRIPTION or HOMEPAGE_URL must use LANGUAGES before + language names. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd28c382b44ee355099750419ecd46e0aa175de0 commit fd28c382b44ee355099750419ecd46e0aa175de0 Author: Craig Scott AuthorDate: Fri Mar 16 07:18:42 2018 +1100 Commit: Craig Scott CommitDate: Sat Mar 17 08:25:48 2018 +1100 project: Add _DESCRIPTION For consistency with the VERSION keyword, also define the _DESCRIPTION variable. diff --git a/Help/command/project.rst b/Help/command/project.rst index ac71d7a..062e9ea 100644 --- a/Help/command/project.rst +++ b/Help/command/project.rst @@ -41,9 +41,10 @@ in variables Variables corresponding to unspecified versions are set to the empty string (if policy :policy:`CMP0048` is set to ``NEW``). -If optional ``DESCRIPTION`` is given, then additional :variable:`PROJECT_DESCRIPTION` -variable will be set to its argument. The argument must be a string with short -description of the project (only a few words). +If the optional ``DESCRIPTION`` is given, then :variable:`PROJECT_DESCRIPTION` +and :variable:`_DESCRIPTION` will be set to its argument. +The description is expected to be a relatively short string, usually no more +than a few words. Optionally you can specify which languages your project supports. Example languages include ``C``, ``CXX`` (i.e. C++), ``CUDA``, diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 13a72df..2bf8c9c 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -97,6 +97,7 @@ Variables that Provide Information /variable/CMAKE_XCODE_GENERATE_SCHEME /variable/CMAKE_XCODE_PLATFORM_TOOLSET /variable/PROJECT-NAME_BINARY_DIR + /variable/PROJECT-NAME_DESCRIPTION /variable/PROJECT-NAME_SOURCE_DIR /variable/PROJECT-NAME_VERSION /variable/PROJECT-NAME_VERSION_MAJOR diff --git a/Help/variable/PROJECT-NAME_DESCRIPTION.rst b/Help/variable/PROJECT-NAME_DESCRIPTION.rst new file mode 100644 index 0000000..2b88b1a --- /dev/null +++ b/Help/variable/PROJECT-NAME_DESCRIPTION.rst @@ -0,0 +1,5 @@ +_DESCRIPTION +-------------------------- + +Value given to the ``DESCRIPTION`` option of the most recent call to the +:command:`project` command with project name ````, if any. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 67c971f..3470648 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -261,6 +261,8 @@ bool cmProjectCommand::InitialPass(std::vector const& args, if (haveDescription) { this->Makefile->AddDefinition("PROJECT_DESCRIPTION", description.c_str()); + this->Makefile->AddDefinition(projectName + "_DESCRIPTION", + description.c_str()); // Set the CMAKE_PROJECT_DESCRIPTION variable to be the highest-level // project name in the tree. If there are two project commands // in the same CMakeLists.txt file, and it is the top level https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b57cb62ea7f1557694054b552cbeb39fb12788e commit 9b57cb62ea7f1557694054b552cbeb39fb12788e Author: Craig Scott AuthorDate: Sat Mar 17 08:22:33 2018 +1100 Commit: Craig Scott CommitDate: Sat Mar 17 08:25:48 2018 +1100 Help: Fix minor typo in docs for CMAKE_PROJECT_DESCRIPTION diff --git a/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst b/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst index 6db5b9e..51b0592 100644 --- a/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst +++ b/Help/variable/CMAKE_PROJECT_DESCRIPTION.rst @@ -7,7 +7,7 @@ This variable holds the description of the project as specified in the top level CMakeLists.txt file by a :command:`project` command. In the event that the top level CMakeLists.txt contains multiple :command:`project` calls, the most recently called one from that top level CMakeLists.txt will determine -the name that ``CMAKE_PROJECT_DESCRIPTION`` contains. For example, consider +the value that ``CMAKE_PROJECT_DESCRIPTION`` contains. For example, consider the following top level CMakeLists.txt: .. code-block:: cmake https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c89993d529efa53ce869537cd902f57064c9c678 commit c89993d529efa53ce869537cd902f57064c9c678 Author: Brad King AuthorDate: Fri Mar 9 07:15:33 2018 -0500 Commit: Craig Scott CommitDate: Thu Mar 15 21:52:21 2018 +1100 Tests: Avoid enabling languages unnecessarily in RunCMake.project diff --git a/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake index 64bac54..25acff8 100644 --- a/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake +++ b/Tests/RunCMake/project/ProjectDescriptionNoArg.cmake @@ -1,2 +1,2 @@ cmake_policy(SET CMP0048 NEW) -project(ProjectDescriptionTest VERSION 1.0.0 DESCRIPTION) +project(ProjectDescriptionTest VERSION 1.0.0 LANGUAGES NONE DESCRIPTION) ----------------------------------------------------------------------- Summary of changes: Help/command/project.rst | 23 ++++++--- Help/manual/cmake-variables.7.rst | 4 ++ Help/release/dev/project-homepage.rst | 7 +++ Help/variable/CMAKE_PROJECT_DESCRIPTION.rst | 2 +- Help/variable/CMAKE_PROJECT_HOMEPAGE_URL.rst | 35 ++++++++++++++ Help/variable/PROJECT-NAME_DESCRIPTION.rst | 5 ++ Help/variable/PROJECT-NAME_HOMEPAGE_URL.rst | 5 ++ Help/variable/PROJECT_HOMEPAGE_URL.rst | 9 ++++ Modules/CPackDeb.cmake | 7 ++- Modules/CPackFreeBSD.cmake | 4 +- Modules/CPackRPM.cmake | 6 ++- Source/cmProjectCommand.cxx | 49 ++++++++++++++++++-- .../RunCMake/project/ProjectDescriptionNoArg.cmake | 2 +- Tests/RunCMake/project/ProjectHomepage-stdout.txt | 3 ++ Tests/RunCMake/project/ProjectHomepage.cmake | 14 ++++++ .../ProjectHomepage2-result.txt} | 0 Tests/RunCMake/project/ProjectHomepage2-stderr.txt | 4 ++ Tests/RunCMake/project/ProjectHomepage2.cmake | 2 + .../project/ProjectHomepageNoArg-stderr.txt | 5 ++ Tests/RunCMake/project/ProjectHomepageNoArg.cmake | 2 + Tests/RunCMake/project/RunCMakeTest.cmake | 3 ++ .../project/VersionMissingLanguages-stderr.txt | 4 +- 22 files changed, 179 insertions(+), 16 deletions(-) create mode 100644 Help/release/dev/project-homepage.rst create mode 100644 Help/variable/CMAKE_PROJECT_HOMEPAGE_URL.rst create mode 100644 Help/variable/PROJECT-NAME_DESCRIPTION.rst create mode 100644 Help/variable/PROJECT-NAME_HOMEPAGE_URL.rst create mode 100644 Help/variable/PROJECT_HOMEPAGE_URL.rst create mode 100644 Tests/RunCMake/project/ProjectHomepage-stdout.txt create mode 100644 Tests/RunCMake/project/ProjectHomepage.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => project/ProjectHomepage2-result.txt} (100%) create mode 100644 Tests/RunCMake/project/ProjectHomepage2-stderr.txt create mode 100644 Tests/RunCMake/project/ProjectHomepage2.cmake create mode 100644 Tests/RunCMake/project/ProjectHomepageNoArg-stderr.txt create mode 100644 Tests/RunCMake/project/ProjectHomepageNoArg.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 18 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 18 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-258-g6aab885 Message-ID: <20180318040505.38D02109C6C@public.kitware.com> 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, master has been updated via 6aab885c928b2296f02c7bedfdb5070066aca593 (commit) from 80784ef77fa95138b197416905b3d4acf0a0d78a (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6aab885c928b2296f02c7bedfdb5070066aca593 commit 6aab885c928b2296f02c7bedfdb5070066aca593 Author: Kitware Robot AuthorDate: Sun Mar 18 00:01:15 2018 -0400 Commit: Kitware Robot CommitDate: Sun Mar 18 00:01:15 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4895556..72929f6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180317) +set(CMake_VERSION_PATCH 20180318) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 00:05:10 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 00:05:10 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-259-gdfc9036 Message-ID: <20180319040510.537F710A666@public.kitware.com> 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, master has been updated via dfc9036bcf65afc4aa0fd21092d47da4ccd259cb (commit) from 6aab885c928b2296f02c7bedfdb5070066aca593 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dfc9036bcf65afc4aa0fd21092d47da4ccd259cb commit dfc9036bcf65afc4aa0fd21092d47da4ccd259cb Author: Kitware Robot AuthorDate: Mon Mar 19 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Mon Mar 19 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 72929f6..ca63858 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180318) +set(CMake_VERSION_PATCH 20180319) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 08:25:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 08:25:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-263-g5b78ed5 Message-ID: <20180319122506.B859E107D50@public.kitware.com> 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, master has been updated via 5b78ed57704557bda84296626ddf08f7dd2c51a4 (commit) via cc2e5709ed91f7dba70fcc5d1516a0b75633cb25 (commit) via 4e9aa8015842758ccfadd694723c7b6c705b9745 (commit) via fc96d99c3efae369f60db6f13cb1610121563d7f (commit) from dfc9036bcf65afc4aa0fd21092d47da4ccd259cb (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b78ed57704557bda84296626ddf08f7dd2c51a4 commit 5b78ed57704557bda84296626ddf08f7dd2c51a4 Merge: cc2e570 4e9aa80 Author: Brad King AuthorDate: Mon Mar 19 08:18:20 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 08:18:20 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cc2e5709ed91f7dba70fcc5d1516a0b75633cb25 commit cc2e5709ed91f7dba70fcc5d1516a0b75633cb25 Merge: dfc9036 fc96d99 Author: Brad King AuthorDate: Mon Mar 19 12:17:06 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:17:18 2018 -0400 Merge topic 'intel-initializer-list' fc96d99c3e Features: Record initializer list support for Intel 14 and above Acked-by: Kitware Robot Merge-request: !1855 ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-CXX-FeatureTests.cmake | 6 +----- Tests/CompileFeatures/cxx_generalized_initializers.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 08:25:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 08:25:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-17-g4e9aa80 Message-ID: <20180319122506.D0114109C6C@public.kitware.com> 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, release has been updated via 4e9aa8015842758ccfadd694723c7b6c705b9745 (commit) via fc96d99c3efae369f60db6f13cb1610121563d7f (commit) from df27bd3f83f3854df24bce9b0a57b425b0396585 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-CXX-FeatureTests.cmake | 6 +----- Tests/CompileFeatures/cxx_generalized_initializers.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 08:35:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 08:35:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-276-g180a36e Message-ID: <20180319123506.518D210AB64@public.kitware.com> 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, master has been updated via 180a36e243f9d5191c523774ec077727833e4f9b (commit) via cded54f48d2b7b1780a2364096982e86a843266a (commit) via 20fc763b326d1d1f5635e4d5a7f48be10752e58c (commit) via c3b95b5a9a6cf2d3fefd17b5c071c89f44b56b9c (commit) via 60299bc6f057da13230551a56bf35a9c9825c036 (commit) via 360886b18009b61f1e5aa29fcab6eeb520e26e83 (commit) via 81226c73a43ec1ff4cf1271efaeb3fefefd604c7 (commit) via eb35d8884b4cf9f4f96482b1bf6017511fdcdda3 (commit) via 6db61f072588bb097b16094290b0b415fa4905e5 (commit) via a74d5a5c8b4fdcd965d5faa4dea85705b9ac7d78 (commit) via 5a7113d8fb2a6f1290b4533ff46e88a55fc2c656 (commit) via 334c8ba7a4da445732858162dc430200891f0433 (commit) via acd322ebe4b1ef3a8b07df7f66860d06e6eb7cb5 (commit) from 5b78ed57704557bda84296626ddf08f7dd2c51a4 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=180a36e243f9d5191c523774ec077727833e4f9b commit 180a36e243f9d5191c523774ec077727833e4f9b Merge: cded54f eb35d88 Author: Brad King AuthorDate: Mon Mar 19 12:29:57 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:30:05 2018 -0400 Merge topic 'find-package_root-restore' eb35d8884b find_package: Use PackageName_ROOT variables as search prefixes Acked-by: Kitware Robot Merge-request: !1858 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cded54f48d2b7b1780a2364096982e86a843266a commit cded54f48d2b7b1780a2364096982e86a843266a Merge: 20fc763 81226c7 Author: Brad King AuthorDate: Mon Mar 19 12:28:41 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:28:51 2018 -0400 Merge topic 'doc-list-command' 81226c73a4 Help: refresh list() command documentation Acked-by: Kitware Robot Merge-request: !1860 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20fc763b326d1d1f5635e4d5a7f48be10752e58c commit 20fc763b326d1d1f5635e4d5a7f48be10752e58c Merge: c3b95b5 6db61f0 Author: Brad King AuthorDate: Mon Mar 19 12:28:05 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:28:14 2018 -0400 Merge topic 'export-properties' 6db61f0725 Export: allow exporting of additional properties Acked-by: Kitware Robot Merge-request: !1834 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3b95b5a9a6cf2d3fefd17b5c071c89f44b56b9c commit c3b95b5a9a6cf2d3fefd17b5c071c89f44b56b9c Merge: 60299bc 334c8ba Author: Brad King AuthorDate: Mon Mar 19 12:26:30 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:27:14 2018 -0400 Merge topic 'codelite-project-settings' 334c8ba7a4 CodeLite: Prefer CMAKE_RUNTIME_OUTPUT_DIRECTORY for output path acd322ebe4 CodeLite: Use project Makefile instead of workspace Makefile. Acked-by: Kitware Robot Merge-request: !1840 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=60299bc6f057da13230551a56bf35a9c9825c036 commit 60299bc6f057da13230551a56bf35a9c9825c036 Merge: 360886b 5a7113d Author: Brad King AuthorDate: Mon Mar 19 12:26:18 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:26:33 2018 -0400 Merge topic 'vs-debugger-command' 5a7113d8fb VS: Add target property VS_DEBUGGER_COMMAND Acked-by: Kitware Robot Merge-request: !1842 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=360886b18009b61f1e5aa29fcab6eeb520e26e83 commit 360886b18009b61f1e5aa29fcab6eeb520e26e83 Merge: 5b78ed5 a74d5a5 Author: Brad King AuthorDate: Mon Mar 19 12:25:43 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 08:25:49 2018 -0400 Merge topic 'vs10-cmelem' a74d5a5c8b cmVisualStudio10TargetGenerator: improved XML nesting Acked-by: Kitware Robot Merge-request: !1849 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=81226c73a43ec1ff4cf1271efaeb3fefefd604c7 commit 81226c73a43ec1ff4cf1271efaeb3fefefd604c7 Author: Marc Chevrier AuthorDate: Fri Mar 16 10:04:44 2018 +0100 Commit: Marc Chevrier CommitDate: Fri Mar 16 15:28:14 2018 +0100 Help: refresh list() command documentation Reformat `list` command documentation be consistent with the `string` command. diff --git a/Help/command/list.rst b/Help/command/list.rst index f6b75bc..e6a7069 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -1,68 +1,151 @@ list ---- +.. only:: html + + .. contents:: + List operations. +The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``, +``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create +new values for the list within the current CMake variable scope. Similar to +the :command:`set` command, the LIST command creates new variable values in +the current scope, even if the list itself is actually defined in a parent +scope. To propagate the results of these operations upwards, use +:command:`set` with ``PARENT_SCOPE``, :command:`set` with +``CACHE INTERNAL``, or some other means of value propagation. + +.. note:: + + A list in cmake is a ``;`` separated group of strings. To create a + list the set command can be used. For example, ``set(var a b c d e)`` + creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a + string or a list with one item in it. (Note macro arguments are not + variables, and therefore cannot be used in LIST commands.) + +.. note:: + + When specifying index values, if ```` is 0 or greater, it + is indexed from the beginning of the list, with 0 representing the + first list element. If ```` is -1 or lesser, it is indexed + from the end of the list, with -1 representing the last list element. + Be careful when counting with negative indices: they do not start from + 0. -0 is equivalent to 0, the first list element. + +Capacity and Element access +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +LENGTH +"""""" + :: list(LENGTH ) - list(GET [ ...] - ) + +Returns the list's length. + +GET +""" + +:: + + list(GET [ ...] ) + +Returns the list of elements specified by indices from the list. + +Search +^^^^^^ + +FIND +"""" + +:: + + list(FIND ) + +Returns the index of the element specified in the list or -1 +if it wasn't found. + +Modification +^^^^^^^^^^^^ + +APPEND +"""""" + +:: + list(APPEND [ ...]) + +Appends elements to the list. + +FILTER +"""""" + +:: + list(FILTER REGEX ) - list(FIND ) + +Includes or removes items from the list that match the mode's pattern. +In ``REGEX`` mode, items will be matched against the given regular expression. + +For more information on regular expressions see also the +:command:`string` command. + +INSERT +"""""" + +:: + list(INSERT [ ...]) + +Inserts elements to the list to the specified location. + +REMOVE_ITEM +""""""""""" + +:: + list(REMOVE_ITEM [ ...]) + +Removes the given items from the list. + +REMOVE_AT +""""""""" + +:: + list(REMOVE_AT [ ...]) - list(REMOVE_DUPLICATES ) - list(REVERSE ) - list(SORT ) -``LENGTH`` will return a given list's length. +Removes items at given indices from the list. -``GET`` will return list of elements specified by indices from the list. +REMOVE_DUPLICATES +""""""""""""""""" -``APPEND`` will append elements to the list. +:: -``FILTER`` will include or remove items from the list that match the -mode's pattern. -In ``REGEX`` mode, items will be matched against the given regular expression. -For more information on regular expressions see also the :command:`string` -command. + list(REMOVE_DUPLICATES ) -``FIND`` will return the index of the element specified in the list or -1 -if it wasn't found. +Removes duplicated items in the list. + +Sorting +^^^^^^^ + +REVERSE +""""""" -``INSERT`` will insert elements to the list to the specified location. +:: -``REMOVE_AT`` and ``REMOVE_ITEM`` will remove items from the list. The -difference is that ``REMOVE_ITEM`` will remove the given items, while -``REMOVE_AT`` will remove the items at the given indices. + list(REVERSE ) -``REMOVE_DUPLICATES`` will remove duplicated items in the list. +Reverses the contents of the list in-place. -``REVERSE`` reverses the contents of the list in-place. +SORT +"""" -``SORT`` sorts the list in-place alphabetically. +:: + + list(SORT ) -The list subcommands ``APPEND``, ``INSERT``, ``FILTER``, ``REMOVE_AT``, -``REMOVE_ITEM``, ``REMOVE_DUPLICATES``, ``REVERSE`` and ``SORT`` may create new -values for the list within the current CMake variable scope. Similar to the -:command:`set` command, the LIST command creates new variable values in the -current scope, even if the list itself is actually defined in a parent -scope. To propagate the results of these operations upwards, use -:command:`set` with ``PARENT_SCOPE``, :command:`set` with -``CACHE INTERNAL``, or some other means of value propagation. -NOTES: A list in cmake is a ``;`` separated group of strings. To create a -list the set command can be used. For example, ``set(var a b c d e)`` -creates a list with ``a;b;c;d;e``, and ``set(var "a b c d e")`` creates a -string or a list with one item in it. (Note macro arguments are not -variables, and therefore cannot be used in LIST commands.) - -When specifying index values, if ```` is 0 or greater, it -is indexed from the beginning of the list, with 0 representing the -first list element. If ```` is -1 or lesser, it is indexed -from the end of the list, with -1 representing the last list element. -Be careful when counting with negative indices: they do not start from -0. -0 is equivalent to 0, the first list element. +Sorts the list in-place alphabetically. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb35d8884b4cf9f4f96482b1bf6017511fdcdda3 commit eb35d8884b4cf9f4f96482b1bf6017511fdcdda3 Author: Brad King AuthorDate: Thu Mar 15 13:22:07 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 09:19:28 2018 -0400 find_package: Use PackageName_ROOT variables as search prefixes This feature was originally added by commit v3.9.0-rc1~71^2~2 (find_*: Add a new PackageRoot search path group, 2017-05-03) and documented by commit v3.9.0-rc1~71^2 (find_*: Add docs for PackageRoot search path group, 2017-05-03). However, we had to disable the feature and remove the documentation in commit v3.9.1~2^2 (find_*: Disable the PACKAGE_ROOT search path group for CMake 3.9, 2017-08-08) due to breaking projects that used `PackageName_ROOT` variables themselves. Add policy `CMP0074` to restore the `PackageName_ROOT` variable behavior in a compatible way. Also revise the stack of root paths to store the paths themselves rather than the package names. This way the policy can be considered at the `find_package` call site instead of individual `find_` calls inside a find module. Co-Author: Chuck Atkins Issue: #17144 diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt index 7db221c..13ea8ab 100644 --- a/Help/command/FIND_XXX.txt +++ b/Help/command/FIND_XXX.txt @@ -16,6 +16,7 @@ The general signature is: [PATH_SUFFIXES suffix1 [suffix2 ...]] [DOC "cache documentation string"] [NO_DEFAULT_PATH] + [NO_PACKAGE_ROOT_PATH] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] [NO_SYSTEM_ENVIRONMENT_PATH] @@ -60,6 +61,10 @@ If ``NO_DEFAULT_PATH`` is specified, then no additional paths are added to the search. If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: +.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| replace:: + |prefix_XXX_SUBDIR| for each ```` in ``PackageName_ROOT`` if called + from within a find module + .. |CMAKE_PREFIX_PATH_XXX_SUBDIR| replace:: |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_PREFIX_PATH` @@ -71,7 +76,19 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: |prefix_XXX_SUBDIR| for each ```` in :variable:`CMAKE_SYSTEM_PREFIX_PATH` -1. Search paths specified in cmake-specific cache variables. +1. If called from within a find module, search prefix paths unique to the + current package being found. Specifically look in the ``PackageName_ROOT`` + CMake and environment variables. The package root variables are maintained + as a stack so if called from nested find modules, root paths from the + parent's find module will be searchd after paths from the current module, + i.e. ``CurrentPackage_ROOT``, ``ENV{CurrentPackage_ROOT}``, + ``ParentPackage_ROOT``, ``ENV{ParentPacakge_ROOT}``, etc. + This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed. + See policy :policy:`CMP0074`. + + * |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| + +2. Search paths specified in cmake-specific cache variables. These are intended to be used on the command line with a ``-DVAR=value``. The values are interpreted as :ref:`;-lists `. This can be skipped if ``NO_CMAKE_PATH`` is passed. @@ -80,7 +97,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: * |CMAKE_XXX_PATH| * |CMAKE_XXX_MAC_PATH| -2. Search paths specified in cmake-specific environment variables. +3. Search paths specified in cmake-specific environment variables. These are intended to be set in the user's shell configuration, and therefore use the host's native path separator (``;`` on Windows and ``:`` on UNIX). @@ -90,17 +107,17 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: * |CMAKE_XXX_PATH| * |CMAKE_XXX_MAC_PATH| -3. Search the paths specified by the ``HINTS`` option. +4. Search the paths specified by the ``HINTS`` option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. Hard-coded guesses should be specified with the ``PATHS`` option. -4. Search the standard system environment variables. +5. Search the standard system environment variables. This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is an argument. * |SYSTEM_ENVIRONMENT_PATH_XXX| -5. Search cmake variables defined in the Platform files +6. Search cmake variables defined in the Platform files for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed. @@ -108,7 +125,7 @@ If ``NO_DEFAULT_PATH`` is not specified, the search process is as follows: * |CMAKE_SYSTEM_XXX_PATH| * |CMAKE_SYSTEM_XXX_MAC_PATH| -6. Search the paths specified by the PATHS option +7. Search the paths specified by the PATHS option or in the short-hand version of the command. These are typically hard-coded guesses. diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index e56097b..2a14ad7 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -8,6 +8,9 @@ find_file .. |prefix_XXX_SUBDIR| replace:: ``/include`` .. |entry_XXX_SUBDIR| replace:: ``/include`` +.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace:: + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| .. |CMAKE_PREFIX_PATH_XXX| replace:: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index f774f17..0861d67 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -8,6 +8,9 @@ find_library .. |prefix_XXX_SUBDIR| replace:: ``/lib`` .. |entry_XXX_SUBDIR| replace:: ``/lib`` +.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace:: + ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, + and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| .. |CMAKE_PREFIX_PATH_XXX| replace:: ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index b2e70f2..89c5a7a 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -64,6 +64,7 @@ The complete Config mode command signature is:: [PATHS path1 [path2 ... ]] [PATH_SUFFIXES suffix1 [suffix2 ...]] [NO_DEFAULT_PATH] + [NO_PACKAGE_ROOT_PATH] [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH] [NO_SYSTEM_ENVIRONMENT_PATH] @@ -249,7 +250,14 @@ The set of installation prefixes is constructed using the following steps. If ``NO_DEFAULT_PATH`` is specified all ``NO_*`` options are enabled. -1. Search paths specified in cmake-specific cache variables. These +1. Search paths specified in the ``PackageName_ROOT`` CMake and environment + variables. The package root variables are maintained as a stack so if + called from within a find module, root paths from the parent's find + module will also be searched after paths for the current package. + This can be skipped if ``NO_PACKAGE_ROOT_PATH`` is passed. + See policy :policy:`CMP0074`. + +2. Search paths specified in cmake-specific cache variables. These are intended to be used on the command line with a ``-DVAR=value``. The values are interpreted as :ref:`;-lists `. This can be skipped if ``NO_CMAKE_PATH`` is passed:: @@ -258,7 +266,7 @@ enabled. CMAKE_FRAMEWORK_PATH CMAKE_APPBUNDLE_PATH -2. Search paths specified in cmake-specific environment variables. +3. Search paths specified in cmake-specific environment variables. These are intended to be set in the user's shell configuration, and therefore use the host's native path separator (``;`` on Windows and ``:`` on UNIX). @@ -269,26 +277,26 @@ enabled. CMAKE_FRAMEWORK_PATH CMAKE_APPBUNDLE_PATH -3. Search paths specified by the ``HINTS`` option. These should be paths +4. Search paths specified by the ``HINTS`` option. These should be paths computed by system introspection, such as a hint provided by the location of another item already found. Hard-coded guesses should be specified with the ``PATHS`` option. -4. Search the standard system environment variables. This can be +5. Search the standard system environment variables. This can be skipped if ``NO_SYSTEM_ENVIRONMENT_PATH`` is passed. Path entries ending in ``/bin`` or ``/sbin`` are automatically converted to their parent directories:: PATH -5. Search paths stored in the CMake :ref:`User Package Registry`. +6. Search paths stored in the CMake :ref:`User Package Registry`. This can be skipped if ``NO_CMAKE_PACKAGE_REGISTRY`` is passed or by setting the :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` to ``TRUE``. See the :manual:`cmake-packages(7)` manual for details on the user package registry. -6. Search cmake variables defined in the Platform files for the +7. Search cmake variables defined in the Platform files for the current system. This can be skipped if ``NO_CMAKE_SYSTEM_PATH`` is passed:: @@ -296,14 +304,14 @@ enabled. CMAKE_SYSTEM_FRAMEWORK_PATH CMAKE_SYSTEM_APPBUNDLE_PATH -7. Search paths stored in the CMake :ref:`System Package Registry`. +8. Search paths stored in the CMake :ref:`System Package Registry`. This can be skipped if ``NO_CMAKE_SYSTEM_PACKAGE_REGISTRY`` is passed or by setting the :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY` to ``TRUE``. See the :manual:`cmake-packages(7)` manual for details on the system package registry. -8. Search paths specified by the ``PATHS`` option. These are typically +9. Search paths specified by the ``PATHS`` option. These are typically hard-coded guesses. .. |FIND_XXX| replace:: find_package diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index 76342d0..988a3fa 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -8,6 +8,9 @@ find_path .. |prefix_XXX_SUBDIR| replace:: ``/include`` .. |entry_XXX_SUBDIR| replace:: ``/include`` +.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace:: + ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` + is set, and |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| .. |CMAKE_PREFIX_PATH_XXX| replace:: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |CMAKE_PREFIX_PATH_XXX_SUBDIR| diff --git a/Help/command/find_program.rst b/Help/command/find_program.rst index d3430c0..4f00773 100644 --- a/Help/command/find_program.rst +++ b/Help/command/find_program.rst @@ -8,6 +8,8 @@ find_program .. |prefix_XXX_SUBDIR| replace:: ``/[s]bin`` .. |entry_XXX_SUBDIR| replace:: ``/[s]bin`` +.. |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX| replace:: + |FIND_PACKAGE_ROOT_PREFIX_PATH_XXX_SUBDIR| .. |CMAKE_PREFIX_PATH_XXX| replace:: |CMAKE_PREFIX_PATH_XXX_SUBDIR| .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_PROGRAM_PATH` diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 254656a..7e2255d 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.12 .. toctree:: :maxdepth: 1 + CMP0074: find_package uses PackageName_ROOT variables. CMP0073: Do not produce legacy _LIB_DEPENDS cache entries. Policies Introduced by CMake 3.11 diff --git a/Help/policy/CMP0074.rst b/Help/policy/CMP0074.rst new file mode 100644 index 0000000..ffac4a7 --- /dev/null +++ b/Help/policy/CMP0074.rst @@ -0,0 +1,22 @@ +CMP0074 +------- + +:command:`find_package` uses ``PackageName_ROOT`` variables. + +In CMake 3.12 and above the ``find_package(PackageName)`` command now searches +a prefix specified by a ``PackageName_ROOT`` CMake or environment variable. +Package roots are maintained as a stack so nested calls to all ``find_*`` +commands inside find modules also search the roots as prefixes. This policy +provides compatibility with projects that have not been updated to avoid using +``PackageName_ROOT`` variables for other purposes. + +The ``OLD`` behavior for this policy is to ignore ``PackageName_ROOT`` +variables. The ``NEW`` behavior for this policy is to use ``PackageName_ROOT`` +variables. + +This policy was introduced in CMake version 3.12. 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. + +.. include:: DEPRECATED.txt diff --git a/Help/release/dev/find-package_root-restore.rst b/Help/release/dev/find-package_root-restore.rst new file mode 100644 index 0000000..3e6b69e --- /dev/null +++ b/Help/release/dev/find-package_root-restore.rst @@ -0,0 +1,8 @@ +find-package_root-restore +------------------------- + +* The :command:`find_package` command now searches a prefix specified by + a ``PackageName_ROOT`` CMake or environment variable. Package roots are + maintained as a stack so nested calls to all ``find_*`` commands inside + find modules also search the roots as prefixes. + See policy :policy:`CMP0074`. diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 7069386..865595b 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -67,8 +67,6 @@ bool cmFindBase::ParseArguments(std::vector const& argsIn) } this->AlreadyInCache = false; - this->SelectDefaultNoPackageRootPath(); - // Find the current root path mode. this->SelectDefaultRootPathMode(); @@ -206,16 +204,12 @@ void cmFindBase::FillPackageRootPath() { cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot]; - // Add package specific search prefixes - // NOTE: This should be using const_reverse_iterator but HP aCC and - // Oracle sunCC both currently have standard library issues - // with the reverse iterator APIs. - for (std::deque::reverse_iterator pkg = - this->Makefile->FindPackageModuleStack.rbegin(); - pkg != this->Makefile->FindPackageModuleStack.rend(); ++pkg) { - std::string varName = *pkg + "_ROOT"; - paths.AddCMakePrefixPath(varName); - paths.AddEnvPrefixPath(varName); + // Add the PACKAGE_ROOT_PATH from each enclosing find_package call. + for (std::deque>::const_reverse_iterator pkgPaths = + this->Makefile->FindPackageRootPathStack.rbegin(); + pkgPaths != this->Makefile->FindPackageRootPathStack.rend(); + ++pkgPaths) { + paths.AddPrefixPaths(*pkgPaths); } paths.AddSuffixes(this->SearchPathSuffixes); diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 4a467f3..64108d7 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -88,13 +88,6 @@ void cmFindCommon::InitializeSearchPathGroups() std::make_pair(PathLabel::Guess, cmSearchPath(this))); } -void cmFindCommon::SelectDefaultNoPackageRootPath() -{ - if (!this->Makefile->IsOn("__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT")) { - this->NoPackageRootPath = true; - } -} - void cmFindCommon::SelectDefaultRootPathMode() { // Check the policy variable for this find command type. diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index b237f1b..89ff174 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -84,9 +84,6 @@ protected: /** Compute final search path list (reroot + trailing slash). */ void ComputeFinalPaths(); - /** Decide whether to enable the PACKAGE_ROOT search entries. */ - void SelectDefaultNoPackageRootPath(); - /** Compute the current default root path mode. */ void SelectDefaultRootPathMode(); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 2f3a85b..e9ac4a7 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -21,6 +21,7 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmPolicies.h" #include "cmSearchPath.h" #include "cmState.h" #include "cmStateTypes.h" @@ -209,8 +210,6 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, this->SortDirection = strcmp(sd, "ASC") == 0 ? Asc : Dec; } - this->SelectDefaultNoPackageRootPath(); - // Find the current root path mode. this->SelectDefaultRootPathMode(); @@ -454,6 +453,38 @@ bool cmFindPackageCommand::InitialPass(std::vector const& args, return true; } + { + // Allocate a PACKAGE_ROOT_PATH for the current find_package call. + this->Makefile->FindPackageRootPathStack.emplace_back(); + std::vector& rootPaths = + *this->Makefile->FindPackageRootPathStack.rbegin(); + + // Add root paths from _ROOT CMake and environment variables, + // subject to CMP0074. + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0074)) { + case cmPolicies::WARN: + this->Makefile->MaybeWarnCMP0074(this->Name); + CM_FALLTHROUGH; + case cmPolicies::OLD: + // OLD behavior is to ignore the _ROOT variables. + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0074)); + break; + case cmPolicies::NEW: { + // NEW behavior is to honor the _ROOT variables. + std::string const rootVar = this->Name + "_ROOT"; + if (const char* pkgRoot = this->Makefile->GetDefinition(rootVar)) { + cmSystemTools::ExpandListArgument(pkgRoot, rootPaths, false); + } + cmSystemTools::GetPath(rootPaths, rootVar.c_str()); + } break; + } + } + this->SetModuleVariables(components); // See if there is a Find.cmake module. @@ -589,9 +620,6 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) exact += "_FIND_VERSION_EXACT"; this->AddFindDefinition(exact, this->VersionExact ? "1" : "0"); } - - // Push on to the package stack - this->Makefile->FindPackageModuleStack.push_back(this->Name); } void cmFindPackageCommand::AddFindDefinition(const std::string& var, @@ -1076,7 +1104,7 @@ void cmFindPackageCommand::AppendSuccessInformation() this->RestoreFindDefinitions(); // Pop the package stack - this->Makefile->FindPackageModuleStack.pop_back(); + this->Makefile->FindPackageRootPathStack.pop_back(); } void cmFindPackageCommand::ComputePrefixes() @@ -1116,16 +1144,14 @@ void cmFindPackageCommand::FillPrefixesPackageRoot() { cmSearchPath& paths = this->LabeledPaths[PathLabel::PackageRoot]; - // Add package specific search prefixes - // NOTE: This should be using const_reverse_iterator but HP aCC and - // Oracle sunCC both currently have standard library issues - // with the reverse iterator APIs. - for (std::deque::reverse_iterator pkg = - this->Makefile->FindPackageModuleStack.rbegin(); - pkg != this->Makefile->FindPackageModuleStack.rend(); ++pkg) { - std::string varName = *pkg + "_ROOT"; - paths.AddCMakePath(varName); - paths.AddEnvPath(varName); + // Add the PACKAGE_ROOT_PATH from each enclosing find_package call. + for (std::deque>::const_reverse_iterator pkgPaths = + this->Makefile->FindPackageRootPathStack.rbegin(); + pkgPaths != this->Makefile->FindPackageRootPathStack.rend(); + ++pkgPaths) { + for (std::string const& path : *pkgPaths) { + paths.AddPath(path); + } } } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9e53579..1191490 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -158,6 +158,26 @@ bool cmMakefile::CheckCMP0037(std::string const& targetName, return true; } +void cmMakefile::MaybeWarnCMP0074(std::string const& pkg) +{ + // Warn if a _ROOT variable we may use is set. + std::string const varName = pkg + "_ROOT"; + bool const haveVar = this->GetDefinition(varName) != nullptr; + bool const haveEnv = cmSystemTools::HasEnv(varName); + if ((haveVar || haveEnv) && this->WarnedCMP0074.insert(varName).second) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0074) << "\n"; + if (haveVar) { + w << "CMake variable " << varName << " is set.\n"; + } + if (haveEnv) { + w << "Environment variable " << varName << " is set.\n"; + } + w << "For compatibility, CMake is ignoring the variable."; + this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } +} + cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const { return this->StateSnapshot.GetDirectory().GetIncludeDirectoriesEntries(); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 95ba53a..aafe60b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -832,9 +832,11 @@ public: void RemoveExportBuildFileGeneratorCMP0024(cmExportBuildFileGenerator* gen); void AddExportBuildFileGenerator(cmExportBuildFileGenerator* gen); - // Maintain a stack of package names to determine the depth of find modules - // we are currently being called with - std::deque FindPackageModuleStack; + // Maintain a stack of package roots to allow nested PACKAGE_ROOT_PATH + // searches + std::deque> FindPackageRootPathStack; + + void MaybeWarnCMP0074(std::string const& pkg); protected: // add link libraries and directories to the target @@ -1001,6 +1003,7 @@ private: bool WarnUnused; bool CheckSystemVars; bool CheckCMP0000; + std::set WarnedCMP0074; bool IsSourceFileTryCompile; mutable bool SuppressWatches; }; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a784f98..34fe09d 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -217,7 +217,9 @@ class cmMakefile; cmPolicies::WARN) \ SELECT(POLICY, CMP0073, \ "Do not produce legacy _LIB_DEPENDS cache entries.", 3, 12, 0, \ - cmPolicies::WARN) + cmPolicies::WARN) \ + SELECT(POLICY, CMP0074, "find_package uses PackageName_ROOT variables.", 3, \ + 12, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index fd0c7c5..2a576ed 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -39,10 +39,10 @@ public: void AddCMakePrefixPath(const std::string& variable); void AddEnvPrefixPath(const std::string& variable, bool stripBin = false); void AddSuffixes(const std::vector& suffixes); - -protected: void AddPrefixPaths(const std::vector& paths, const char* base = nullptr); + +protected: void AddPathInternal(const std::string& path, const char* base = nullptr); cmFindCommon* FC; diff --git a/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt new file mode 100644 index 0000000..4c2e517 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt @@ -0,0 +1,12 @@ +---------- +Foo_ROOT :/foo/cmake_root +ENV{Foo_ROOT} :/foo/env_root + +find_package\(Foo\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +---------- diff --git a/Tests/RunCMake/find_package/CMP0074-OLD.cmake b/Tests/RunCMake/find_package/CMP0074-OLD.cmake new file mode 100644 index 0000000..4358317 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0074 OLD) +include(CMP0074-common.cmake) diff --git a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt new file mode 100644 index 0000000..c762d92 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt @@ -0,0 +1,28 @@ +---------- +Foo_ROOT :/foo/cmake_root +ENV{Foo_ROOT} :/foo/env_root ++ +CMake Warning \(dev\) at CMP0074-common.cmake:[0-9]+ \(find_package\): + Policy CMP0074 is not set: find_package uses PackageName_ROOT variables. + Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + CMake variable Foo_ROOT is set. + + Environment variable Foo_ROOT is set. + + For compatibility, CMake is ignoring the variable. +Call Stack \(most recent call first\): + CMP0074-common.cmake:[0-9]+ \(RunPackageRootTest\) + CMP0074-WARN.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. ++ +find_package\(Foo\) +FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND +FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND +FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND +FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND +FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND + +---------- diff --git a/Tests/RunCMake/find_package/CMP0074-WARN.cmake b/Tests/RunCMake/find_package/CMP0074-WARN.cmake new file mode 100644 index 0000000..0d4ada7 --- /dev/null +++ b/Tests/RunCMake/find_package/CMP0074-WARN.cmake @@ -0,0 +1,2 @@ +# (do not set CMP0074) +include(CMP0074-common.cmake) diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/CMP0074-common.cmake similarity index 86% copy from Tests/RunCMake/find_package/PackageRoot.cmake copy to Tests/RunCMake/find_package/CMP0074-common.cmake index 4c4f4c2..bfacd82 100644 --- a/Tests/RunCMake/find_package/PackageRoot.cmake +++ b/Tests/RunCMake/find_package/CMP0074-common.cmake @@ -1,4 +1,4 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) +# (includer selects CMP0074) cmake_policy(SET CMP0057 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) @@ -40,14 +40,7 @@ macro(RunPackageRootTest) message("") endmacro() -RunPackageRootTest() - -set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) -RunPackageRootTest() - -set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) -RunPackageRootTest() - set(Foo_ROOT ${PackageRoot_BASE}/foo/cmake_root) set(ENV{Foo_ROOT} ${PackageRoot_BASE}/foo/env_root) RunPackageRootTest() +message("----------") diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake index 4c4f4c2..aa12e9b 100644 --- a/Tests/RunCMake/find_package/PackageRoot.cmake +++ b/Tests/RunCMake/find_package/PackageRoot.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake index ba06c09..1ef32cb 100644 --- a/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake +++ b/Tests/RunCMake/find_package/PackageRootNestedConfig.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake index 2795cd4..017834c 100644 --- a/Tests/RunCMake/find_package/PackageRootNestedModule.cmake +++ b/Tests/RunCMake/find_package/PackageRootNestedModule.cmake @@ -1,5 +1,5 @@ -set(__UNDOCUMENTED_CMAKE_FIND_PACKAGE_ROOT 1) cmake_policy(SET CMP0057 NEW) +cmake_policy(SET CMP0074 NEW) list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) set(PackageRoot_BASE ${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot) diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index d548da0..c068402 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake(CMP0074-WARN) +run_cmake(CMP0074-OLD) run_cmake(ComponentRequiredAndOptional) run_cmake(MissingNormal) run_cmake(MissingNormalRequired) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6db61f072588bb097b16094290b0b415fa4905e5 commit 6db61f072588bb097b16094290b0b415fa4905e5 Author: Wouter Klouwen AuthorDate: Thu Mar 8 17:46:49 2018 +0000 Commit: Brad King CommitDate: Fri Mar 16 09:00:56 2018 -0400 Export: allow exporting of additional properties This change introduces an additional property that may be set on a target to allow additional properties to be exported. Normally only a limited number of properties are exported. Additional properties may be exported by simply setting the `EXPORT_PROPERTIES` property on a target that is exported. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 9d4a7e8..051306b 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -176,6 +176,7 @@ Properties on Targets /prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD_CONFIG /prop_tgt/EXCLUDE_FROM_DEFAULT_BUILD /prop_tgt/EXPORT_NAME + /prop_tgt/EXPORT_PROPERTIES /prop_tgt/FOLDER /prop_tgt/Fortran_FORMAT /prop_tgt/Fortran_MODULE_DIRECTORY diff --git a/Help/prop_tgt/EXPORT_PROPERTIES.rst b/Help/prop_tgt/EXPORT_PROPERTIES.rst new file mode 100644 index 0000000..bcf47a6 --- /dev/null +++ b/Help/prop_tgt/EXPORT_PROPERTIES.rst @@ -0,0 +1,14 @@ +EXPORT_PROPERTIES +----------------- + +List additional properties to export for a target. + +This property contains a list of property names that should be exported by +the :command:`install(EXPORT)` and :command:`export` commands. By default +only a limited number of properties are exported. This property can be used +to additionally export other properties as well. + +Properties starting with ``INTERFACE_`` or ``IMPORTED_`` are not allowed as +they are reserved for internal CMake use. + +Properties containing generator expressions are also not allowed. diff --git a/Help/release/dev/export-properties.rst b/Help/release/dev/export-properties.rst new file mode 100644 index 0000000..9b20799 --- /dev/null +++ b/Help/release/dev/export-properties.rst @@ -0,0 +1,6 @@ +EXPORT_PROPERTIES +----------------- + +* An :prop_tgt:`EXPORT_PROPERTIES` target property was added to specify a + custom list of target properties to include in targets exported by the + :command:`install(EXPORT)` and :command:`export` commands. diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index f0ae47b..bbbc998 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -97,6 +97,15 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gte, properties); + + std::string errorMessage; + if (!this->PopulateExportProperties(gte, properties, errorMessage)) { + this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, errorMessage, + this->LG->GetMakefile()->GetBacktrace()); + return false; + } + const bool newCMP0022Behavior = gte->GetPolicyStatusCMP0022() != cmPolicies::WARN && gte->GetPolicyStatusCMP0022() != cmPolicies::OLD; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 0f1d745..2dcbfa0 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -11,6 +11,8 @@ #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmProperty.h" +#include "cmPropertyMap.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" @@ -1097,3 +1099,41 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode( os << ")\n\n"; } + +bool cmExportFileGenerator::PopulateExportProperties( + cmGeneratorTarget* gte, ImportPropertyMap& properties, + std::string& errorMessage) +{ + auto& targetProperties = gte->Target->GetProperties(); + const auto& exportProperties = targetProperties.find("EXPORT_PROPERTIES"); + if (exportProperties != targetProperties.end()) { + std::vector propsToExport; + cmSystemTools::ExpandListArgument(exportProperties->second.GetValue(), + propsToExport); + for (auto& prop : propsToExport) { + /* Black list reserved properties */ + if (cmSystemTools::StringStartsWith(prop, "IMPORTED_") || + cmSystemTools::StringStartsWith(prop, "INTERFACE_")) { + std::ostringstream e; + e << "Target \"" << gte->Target->GetName() << "\" contains property \"" + << prop << "\" in EXPORT_PROPERTIES but IMPORTED_* and INTERFACE_* " + << "properties are reserved."; + errorMessage = e.str(); + return false; + } + auto propertyValue = targetProperties.GetPropertyValue(prop); + std::string evaluatedValue = cmGeneratorExpression::Preprocess( + propertyValue, cmGeneratorExpression::StripAllGeneratorExpressions); + if (evaluatedValue != propertyValue) { + std::ostringstream e; + e << "Target \"" << gte->Target->GetName() << "\" contains property \"" + << prop << "\" in EXPORT_PROPERTIES but this property contains a " + << "generator expression. This is not allowed."; + errorMessage = e.str(); + return false; + } + properties[prop] = propertyValue; + } + } + return true; +} diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index e541372..954e6c5 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -168,6 +168,10 @@ protected: virtual void GenerateRequiredCMakeVersion(std::ostream& os, const char* versionString); + bool PopulateExportProperties(cmGeneratorTarget* gte, + ImportPropertyMap& properties, + std::string& errorMessage); + // The namespace in which the exports are placed in the generated file. std::string Namespace; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 93ba2ce..63d04a6 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -104,6 +104,12 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) cmGeneratorExpression::InstallInterface, properties, missingTargets); + std::string errorMessage; + if (!this->PopulateExportProperties(gt, properties, errorMessage)) { + cmSystemTools::Error(errorMessage.c_str()); + return false; + } + const bool newCMP0022Behavior = gt->GetPolicyStatusCMP0022() != cmPolicies::WARN && gt->GetPolicyStatusCMP0022() != cmPolicies::OLD; diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index cbc8c6b..0f1a556 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -356,6 +356,14 @@ install(FILES set_property(TARGET testLib2 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB2) set_property(TARGET testLib3 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS USING_TESTLIB3) +set_target_properties(testLib3 PROPERTIES + EXPORT_PROPERTIES "EXPORTED_PROPERTY1" + EXPORTED_PROPERTY1 "EXPORTING_TESTLIB3") +set_target_properties(testLib4 PROPERTIES + EXPORTED_PROPERTY2 "EXPORTING_TESTLIB4_1" + EXPORTED_PROPERTY3 "EXPORTING_TESTLIB4_2") +set_property(TARGET testLib4 PROPERTY + EXPORT_PROPERTIES EXPORTED_PROPERTY2 EXPORTED_PROPERTY3) set_property(TARGET cmp0022NEW APPEND PROPERTY INTERFACE_LINK_LIBRARIES testLib2) # set_property(TARGET cmp0022NEW APPEND PROPERTY LINK_INTERFACE_LIBRARIES testLibIncludeRequired2) # TODO: Test for error diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index 4e8eac2..39a89dc 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -32,6 +32,20 @@ add_executable(imp_testExe1 ${Import_BINARY_DIR}/exp_generated4.c ) +function(checkForProperty _TARGET _PROP _EXPECTED) + get_target_property(EXPORTED_PROPERTY ${_TARGET} "${_PROP}") + if (NOT EXPORTED_PROPERTY STREQUAL "${_EXPECTED}") + message(SEND_ERROR "${_TARGET} was expected to export \"${_PROP}\" with value \"${_EXPECTED}\" but got \"${EXPORTED_PROPERTY}\"") + endif() +endfunction() + +checkForProperty(bld_testLib3 "EXPORTED_PROPERTY1" "EXPORTING_TESTLIB3") +checkForProperty(exp_testLib3 "EXPORTED_PROPERTY1" "EXPORTING_TESTLIB3") +checkForProperty(bld_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1") +checkForProperty(exp_testLib4 "EXPORTED_PROPERTY2" "EXPORTING_TESTLIB4_1") +checkForProperty(bld_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2") +checkForProperty(exp_testLib4 "EXPORTED_PROPERTY3" "EXPORTING_TESTLIB4_2") + # Try linking to a library imported from the install tree. target_link_libraries(imp_testExe1 exp_testLib2 diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt new file mode 100644 index 0000000..ab03943 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"IMPORTED_FOOBAR\" in EXPORT_PROPERTIES but + IMPORTED_\* and INTERFACE_\* properties are reserved. diff --git a/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake b/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake new file mode 100644 index 0000000..9c8653d --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + IMPORTED_FOOBAR "Some other string" + EXPORT_PROPERTIES "IMPORTED_FOOBAR" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt new file mode 100644 index 0000000..577602b --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"INTERFACE_FOOBAR\" in EXPORT_PROPERTIES but + IMPORTED_\* and INTERFACE_\* properties are reserved. diff --git a/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake new file mode 100644 index 0000000..bab8de0 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + INTERFACE_FOOBAR "Some string" + EXPORT_PROPERTIES "INTERFACE_FOOBAR" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt new file mode 100644 index 0000000..56488e6 --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt @@ -0,0 +1,3 @@ +CMake Error in CMakeLists.txt: + Target \"foo\" contains property \"JUST_A_PROPERTY\" in EXPORT_PROPERTIES but + this property contains a generator expression. This is not allowed. diff --git a/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake new file mode 100644 index 0000000..065cdbc --- /dev/null +++ b/Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake @@ -0,0 +1,12 @@ +enable_language(CXX) +add_library(foo empty.cpp) +set_target_properties(foo PROPERTIES + JUST_A_PROPERTY "$" + EXPORT_PROPERTIES "JUST_A_PROPERTY" +) +export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/foo.cmake") +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) diff --git a/Tests/RunCMake/export/RunCMakeTest.cmake b/Tests/RunCMake/export/RunCMakeTest.cmake index 6d0b7ca..10ced90 100644 --- a/Tests/RunCMake/export/RunCMakeTest.cmake +++ b/Tests/RunCMake/export/RunCMakeTest.cmake @@ -5,3 +5,6 @@ run_cmake(TargetNotFound) run_cmake(AppendExport) run_cmake(OldIface) run_cmake(NoExportSet) +run_cmake(ForbiddenToExportInterfaceProperties) +run_cmake(ForbiddenToExportImportedProperties) +run_cmake(ForbiddenToExportPropertyWithGenExp) diff --git a/Tests/RunCMake/export/empty.cpp b/Tests/RunCMake/export/empty.cpp new file mode 100644 index 0000000..11ec041 --- /dev/null +++ b/Tests/RunCMake/export/empty.cpp @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int empty() +{ + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a74d5a5c8b4fdcd965d5faa4dea85705b9ac7d78 commit a74d5a5c8b4fdcd965d5faa4dea85705b9ac7d78 Author: Vitaly Stakhovsky AuthorDate: Tue Mar 13 14:07:12 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 08:50:19 2018 -0400 cmVisualStudio10TargetGenerator: improved XML nesting Introduce an `Elem` helper class to track XML element state. This simplifies code in a few places, particularly OutputSourceSpecificFlags. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0fd8043..68fbc28 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -18,6 +18,42 @@ #include #include // IWYU pragma: keep +struct cmVisualStudio10TargetGenerator::Elem +{ + cmGeneratedFileStream& S; + int Indent; + bool HasElements = false; + + Elem(cmGeneratedFileStream& s, int i) + : S(s) + , Indent(i) + { + } + Elem(Elem& par) + : S(par.S) + , Indent(par.Indent + 1) + { + par.SetHasElements(); + } + void SetHasElements() + { + if (!HasElements) { + S << ">\n"; + HasElements = true; + } + } + void WriteEndTag(const char* tag) + { + if (HasElements) { + S.fill(' '); + S.width(Indent * 2); + S << "\n"; + } else { + S << " />\n"; + } + } +}; + inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag, const char* val, int indentLevel) @@ -787,7 +823,7 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() this->WriteString("\n", 1); for (cmSourceFile const* oi : xamlObjs) { std::string obj = oi->GetFullPath(); - std::string xamlType; + const char* xamlType; const char* xamlTypeProperty = oi->GetProperty("VS_XAML_TYPE"); if (xamlTypeProperty) { xamlType = xamlTypeProperty; @@ -795,7 +831,9 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() xamlType = "Page"; } - this->WriteSource(xamlType, oi, ">\n"); + Elem e2(*this->BuildFileStream, 2); + this->WriteSource(xamlType, oi); + e2.SetHasElements(); if (this->ProjectType == csproj && !this->InSourceBuild) { // add tag to written XAML source if necessary const std::string srcDir = this->Makefile->GetCurrentSourceDirectory(); @@ -814,8 +852,7 @@ void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup() } } this->WriteElem("SubType", "Designer", 3); - this->WriteString("BuildFileStream) << xamlType << ">\n"; + e2.WriteEndTag(xamlType); } this->WriteString("\n", 1); } @@ -1148,17 +1185,20 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } cmLocalVisualStudio7Generator* lg = this->LocalGenerator; + Elem e2(*this->BuildFileStream, 2); if (this->ProjectType != csproj) { - this->WriteSource("CustomBuild", source, ">\n"); + this->WriteSource("CustomBuild", source); + e2.SetHasElements(); } else { this->WriteString("\n", 1); std::string link; this->GetCSharpSourceLink(source, link); - this->WriteSource("None", source, ">\n"); + this->WriteSource("None", source); + e2.SetHasElements(); if (!link.empty()) { this->WriteElem("Link", link, 3); } - this->WriteString("\n", 2); + e2.WriteEndTag("None"); this->WriteString("\n", 1); } for (std::string const& c : this->Configurations) { @@ -1202,7 +1242,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } } if (this->ProjectType != csproj) { - this->WriteString("\n", 2); + e2.WriteEndTag("CustomBuild"); } } @@ -1473,24 +1513,23 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources( void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf) { std::string const& fileName = sf->GetFullPath(); + Elem e2(*this->BuildFileStream, 2); + this->WriteSource("ClInclude", sf); if (this->IsResxHeader(fileName)) { - this->WriteSource("ClInclude", sf, ">\n"); + e2.SetHasElements(); this->WriteElem("FileType", "CppForm", 3); - this->WriteString("\n", 2); } else if (this->IsXamlHeader(fileName)) { - this->WriteSource("ClInclude", sf, ">\n"); std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); + e2.SetHasElements(); this->WriteElem("DependentUpon", xamlFileName, 3); - this->WriteString("\n", 2); - } else { - this->WriteSource("ClInclude", sf); } + e2.WriteEndTag("ClInclude"); } void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) { bool toolHasSettings = false; - std::string tool = "None"; + const char* tool = "None"; std::string shaderType; std::string shaderEntryPoint; std::string shaderModel; @@ -1640,8 +1679,10 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } } + Elem e2(*this->BuildFileStream, 2); + this->WriteSource(tool, sf); if (toolHasSettings) { - this->WriteSource(tool, sf, ">\n"); + e2.SetHasElements(); if (!deployContent.empty()) { cmGeneratorExpression ge; @@ -1736,16 +1777,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf) } // write source file specific tags this->WriteCSharpSourceProperties(sourceFileTags); - this->WriteString("BuildFileStream) << tool << ">\n"; - } else { - this->WriteSource(tool, sf); } + e2.WriteEndTag(tool); } void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool, - cmSourceFile const* sf, - const char* end) + cmSourceFile const* sf) { // Visual Studio tools append relative paths to the current dir, as in: // @@ -1782,8 +1819,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool, ConvertToWindowsSlash(sourceFile); this->WriteString("<", 2); (*this->BuildFileStream) << tool << " Include=\"" - << cmVS10EscapeXML(sourceFile) << "\"" - << (end ? end : " />\n"); + << cmVS10EscapeXML(sourceFile) << "\""; ToolSource toolSource = { sf, forceRelative }; this->Tools[tool].push_back(toolSource); @@ -1805,7 +1841,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() this->GeneratorTarget->GetAllConfigSources(); for (cmGeneratorTarget::AllConfigSource const& si : sources) { - std::string tool; + const char* tool = nullptr; switch (si.Kind) { case cmGeneratorTarget::SourceKindAppManifest: tool = "AppxManifest"; @@ -1874,7 +1910,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() break; } - if (!tool.empty()) { + if (tool) { // Compute set of configurations to exclude, if any. std::vector const& include_configs = si.Configs; std::vector exclude_configs; @@ -1882,31 +1918,15 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() include_configs.begin(), include_configs.end(), std::back_inserter(exclude_configs)); + Elem e2(*this->BuildFileStream, 2); + this->WriteSource(tool, si.Source); if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) { - // FIXME: refactor generation to avoid tracking XML syntax state. - this->WriteSource(tool, si.Source, ""); - bool have_nested = this->OutputSourceSpecificFlags(si.Source); - if (!exclude_configs.empty()) { - if (!have_nested) { - (*this->BuildFileStream) << ">\n"; - } - this->WriteExcludeFromBuild(exclude_configs); - have_nested = true; - } - if (have_nested) { - this->WriteString("BuildFileStream) << tool << ">\n"; - } else { - (*this->BuildFileStream) << " />\n"; - } - } else if (!exclude_configs.empty()) { - this->WriteSource(tool, si.Source, ">\n"); - this->WriteExcludeFromBuild(exclude_configs); - this->WriteString("BuildFileStream) << tool << ">\n"; - } else { - this->WriteSource(tool, si.Source); + this->OutputSourceSpecificFlags(e2, si.Source); + } + if (!exclude_configs.empty()) { + this->WriteExcludeFromBuild(e2, exclude_configs); } + e2.WriteEndTag(tool); } } @@ -1917,8 +1937,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources() this->WriteString("\n", 1); } -bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( - cmSourceFile const* source) +void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( + Elem& e2, cmSourceFile const* source) { cmSourceFile const& sf = *source; @@ -1978,14 +1998,10 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } } bool noWinRT = this->TargetCompileAsWinRT && lang == "C"; - bool hasFlags = false; // for the first time we need a new line if there is something // produced here. - const char* firstString = ">\n"; if (!objectName.empty()) { - (*this->BuildFileStream) << firstString; - firstString = ""; - hasFlags = true; + e2.SetHasElements(); if (lang == "CUDA") { this->WriteElem("CompileOut", "$(IntDir)/" + objectName, 3); } else { @@ -2009,9 +2025,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( // use them if (!flags.empty() || !options.empty() || !configDefines.empty() || !includes.empty() || compileAs || noWinRT) { - (*this->BuildFileStream) << firstString; - firstString = ""; // only do firstString once - hasFlags = true; + e2.SetHasElements(); cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmIDEFlagTable const* flagtable = nullptr; const std::string& srclang = source->GetLanguage(); @@ -2086,9 +2100,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( } } if (this->IsXamlSource(source->GetFullPath())) { - (*this->BuildFileStream) << firstString; - firstString = ""; // only do firstString once - hasFlags = true; + e2.SetHasElements(); const std::string& fileName = source->GetFullPath(); std::string xamlFileName = fileName.substr(0, fileName.find_last_of(".")); this->WriteElem("DependentUpon", xamlFileName, 3); @@ -2106,19 +2118,16 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( this->GetCSharpSourceProperties(&sf, sourceFileTags); // write source file specific tags if (!sourceFileTags.empty()) { - hasFlags = true; - (*this->BuildFileStream) << firstString; - firstString = ""; + e2.SetHasElements(); this->WriteCSharpSourceProperties(sourceFileTags); } } - - return hasFlags; } void cmVisualStudio10TargetGenerator::WriteExcludeFromBuild( - std::vector const& exclude_configs) + Elem& e2, std::vector const& exclude_configs) { + e2.SetHasElements(); for (size_t ci : exclude_configs) { this->WriteString("", 3); (*this->BuildFileStream) diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 64121ed..d557255 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -53,6 +53,8 @@ private: std::vector Configs; }; + struct Elem; + std::string ConvertPath(std::string const& path, bool forceRelative); void WriteString(const char* line, int indentLevel); void WriteElem(const char* tag, const char* val, int indentLevel); @@ -66,9 +68,9 @@ private: void WriteHeaderSource(cmSourceFile const* sf); void WriteExtraSource(cmSourceFile const* sf); void WriteNsightTegraConfigurationValues(std::string const& config); - void WriteSource(std::string const& tool, cmSourceFile const* sf, - const char* end = 0); - void WriteExcludeFromBuild(std::vector const& exclude_configs); + void WriteSource(std::string const& tool, cmSourceFile const* sf); + void WriteExcludeFromBuild(Elem&, + std::vector const& exclude_configs); void WriteAllSources(); void WriteDotNetReferences(); void WriteDotNetReference(std::string const& ref, std::string const& hint); @@ -145,7 +147,7 @@ private: void WriteGroups(); void WriteProjectReferences(); void WriteApplicationTypeSettings(); - bool OutputSourceSpecificFlags(cmSourceFile const* source); + void OutputSourceSpecificFlags(Elem&, cmSourceFile const* source); void AddLibraries(cmComputeLinkInformation& cli, std::vector& libVec, std::vector& vsTargetVec); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5a7113d8fb2a6f1290b4533ff46e88a55fc2c656 commit 5a7113d8fb2a6f1290b4533ff46e88a55fc2c656 Author: Hannes Mezger AuthorDate: Mon Mar 12 16:19:08 2018 +0100 Commit: Brad King CommitDate: Wed Mar 14 13:27:15 2018 -0400 VS: Add target property VS_DEBUGGER_COMMAND Fixes: #17819 diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 9d4a7e8..86ca2e4 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -296,6 +296,7 @@ Properties on Targets /prop_tgt/VISIBILITY_INLINES_HIDDEN /prop_tgt/VS_CONFIGURATION_TYPE /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY + /prop_tgt/VS_DEBUGGER_COMMAND /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION /prop_tgt/VS_DOTNET_REFERENCE_refname /prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname diff --git a/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst new file mode 100644 index 0000000..f898750 --- /dev/null +++ b/Help/prop_tgt/VS_DEBUGGER_COMMAND.rst @@ -0,0 +1,9 @@ +VS_DEBUGGER_COMMAND +------------------- + +Sets the local debugger command for Visual Studio C++ targets. +This is defined in ```` in the Visual Studio +project file. + +This property only works for Visual Studio 2010 and above; +it is ignored on other generators. diff --git a/Help/release/dev/vs-debugger-config.rst b/Help/release/dev/vs-debugger-config.rst new file mode 100644 index 0000000..bddae0c --- /dev/null +++ b/Help/release/dev/vs-debugger-config.rst @@ -0,0 +1,6 @@ +vs-debugger-configuration +------------------------- + +* For the :ref:`Visual Studio Generators` for VS 2010 and above + the debugging command line can be set using a new + :prop_tgt:`VS_DEBUGGER_COMMAND` target property. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0fd8043..d6e0388 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2180,6 +2180,13 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() << "\n"; } + if (const char* debuggerCommand = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { + this->WritePlatformConfigTag("LocalDebuggerCommand", config, 2); + *this->BuildFileStream << cmVS10EscapeXML(debuggerCommand) + << "\n"; + } + std::string name = cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull); this->WritePlatformConfigTag("TargetName", config, 2); diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 7100b31..afe9d6d 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -3,6 +3,7 @@ run_cmake(VsConfigurationType) run_cmake(VsTargetsFileReferences) run_cmake(VsCustomProps) run_cmake(VsDebuggerWorkingDir) +run_cmake(VsDebuggerCommand) run_cmake(VsCSharpCustomTags) run_cmake(VsCSharpReferenceProps) run_cmake(VsCSharpWithoutSources) diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake new file mode 100644 index 0000000..0ded780 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake @@ -0,0 +1,22 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(debuggerCommandSet FALSE) + +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "^ *]*>([^<>]+)$") + if("${CMAKE_MATCH_1}" STREQUAL "my-debugger-command") + message(STATUS "foo.vcxproj has debugger command set") + set(debuggerCommandSet TRUE) + endif() + endif() +endforeach() + +if(NOT debuggerCommandSet) + set(RunCMake_TEST_FAILED "LocalDebuggerCommand not found or not set correctly.") + return() +endif() diff --git a/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake new file mode 100644 index 0000000..e29adc4 --- /dev/null +++ b/Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake @@ -0,0 +1,5 @@ +enable_language(CXX) +add_library(foo foo.cpp) + +set_target_properties(foo PROPERTIES + VS_DEBUGGER_COMMAND "my-debugger-command") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=334c8ba7a4da445732858162dc430200891f0433 commit 334c8ba7a4da445732858162dc430200891f0433 Author: Tobias R. Henle AuthorDate: Sun Mar 11 15:18:17 2018 +0100 Commit: Brad King CommitDate: Wed Mar 14 13:23:28 2018 -0400 CodeLite: Prefer CMAKE_RUNTIME_OUTPUT_DIRECTORY for output path Use the deprecated `EXECUTABLE_OUTPUT_PATH` as a fallback. diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 3e37aad..c7c780c 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -408,7 +408,6 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( const std::string& projectPath, const cmMakefile* mf, const std::string& projectType, const std::string& targetName) { - cmXMLWriter& xml(*_xml); FindMatchingHeaderfiles(cFiles, otherFiles); // Create 2 virtual folders: src and include @@ -469,10 +468,14 @@ void cmExtraCodeLiteGenerator::CreateProjectSourceEntries( xml.EndElement(); // ResourceCompiler xml.StartElement("General"); - std::string outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); + std::string outputPath = + mf->GetSafeDefinition("CMAKE_RUNTIME_OUTPUT_DIRECTORY"); + if (outputPath.empty()) { + outputPath = mf->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); + } std::string relapath; if (!outputPath.empty()) { - relapath = cmSystemTools::RelativePath(this->WorkspacePath, outputPath); + relapath = cmSystemTools::RelativePath(projectPath, outputPath); xml.Attribute("OutputFile", relapath + "/$(ProjectName)"); } else { xml.Attribute("OutputFile", "$(IntermediateDirectory)/$(ProjectName)"); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=acd322ebe4b1ef3a8b07df7f66860d06e6eb7cb5 commit acd322ebe4b1ef3a8b07df7f66860d06e6eb7cb5 Author: Tobias R. Henle AuthorDate: Sun Mar 11 15:27:12 2018 +0100 Commit: Brad King CommitDate: Wed Mar 14 13:20:28 2018 -0400 CodeLite: Use project Makefile instead of workspace Makefile. Use the selected project Makefile instead of the global workspace Makefile during build of a project. diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 4dbaa3f..3e37aad 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -635,7 +635,7 @@ std::string cmExtraCodeLiteGenerator::GetBuildCommand( if (generator == "NMake Makefiles" || generator == "Ninja") { ss << make; } else if (generator == "MinGW Makefiles" || generator == "Unix Makefiles") { - ss << make << " -j " << this->CpuCount; + ss << make << " -f$(ProjectPath)/Makefile -j " << this->CpuCount; } if (!targetName.empty()) { ss << " " << targetName; ----------------------------------------------------------------------- Summary of changes: Help/command/FIND_XXX.txt | 29 +++- Help/command/find_file.rst | 3 + Help/command/find_library.rst | 3 + Help/command/find_package.rst | 24 ++- Help/command/find_path.rst | 3 + Help/command/find_program.rst | 2 + Help/command/list.rst | 169 +++++++++++++++----- Help/manual/cmake-policies.7.rst | 1 + Help/manual/cmake-properties.7.rst | 2 + Help/policy/CMP0074.rst | 22 +++ Help/prop_tgt/EXPORT_PROPERTIES.rst | 14 ++ Help/prop_tgt/VS_DEBUGGER_COMMAND.rst | 9 ++ Help/release/dev/export-properties.rst | 6 + Help/release/dev/find-package_root-restore.rst | 8 + Help/release/dev/vs-debugger-config.rst | 6 + Source/cmExportBuildFileGenerator.cxx | 9 ++ Source/cmExportFileGenerator.cxx | 40 +++++ Source/cmExportFileGenerator.h | 4 + Source/cmExportInstallFileGenerator.cxx | 6 + Source/cmExtraCodeLiteGenerator.cxx | 11 +- Source/cmFindBase.cxx | 18 +-- Source/cmFindCommon.cxx | 7 - Source/cmFindCommon.h | 3 - Source/cmFindPackageCommand.cxx | 58 +++++-- Source/cmMakefile.cxx | 20 +++ Source/cmMakefile.h | 9 +- Source/cmPolicies.h | 4 +- Source/cmSearchPath.h | 4 +- Source/cmVisualStudio10TargetGenerator.cxx | 152 ++++++++++-------- Source/cmVisualStudio10TargetGenerator.h | 10 +- Tests/ExportImport/Export/CMakeLists.txt | 8 + Tests/ExportImport/Import/A/CMakeLists.txt | 14 ++ Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 + .../VS10Project/VsDebuggerCommand-check.cmake | 22 +++ Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake | 5 + ...ForbiddenToExportImportedProperties-result.txt} | 0 .../ForbiddenToExportImportedProperties-stderr.txt | 3 + .../ForbiddenToExportImportedProperties.cmake | 12 ++ ...orbiddenToExportInterfaceProperties-result.txt} | 0 ...ForbiddenToExportInterfaceProperties-stderr.txt | 3 + .../ForbiddenToExportInterfaceProperties.cmake | 12 ++ ...ForbiddenToExportPropertyWithGenExp-result.txt} | 0 .../ForbiddenToExportPropertyWithGenExp-stderr.txt | 3 + .../ForbiddenToExportPropertyWithGenExp.cmake | 12 ++ Tests/RunCMake/export/RunCMakeTest.cmake | 3 + .../Export => RunCMake/export}/empty.cpp | 0 Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt | 12 ++ Tests/RunCMake/find_package/CMP0074-OLD.cmake | 2 + .../RunCMake/find_package/CMP0074-WARN-stderr.txt | 28 ++++ Tests/RunCMake/find_package/CMP0074-WARN.cmake | 2 + .../{PackageRoot.cmake => CMP0074-common.cmake} | 11 +- Tests/RunCMake/find_package/PackageRoot.cmake | 2 +- .../find_package/PackageRootNestedConfig.cmake | 2 +- .../find_package/PackageRootNestedModule.cmake | 2 +- Tests/RunCMake/find_package/RunCMakeTest.cmake | 2 + 55 files changed, 628 insertions(+), 189 deletions(-) create mode 100644 Help/policy/CMP0074.rst create mode 100644 Help/prop_tgt/EXPORT_PROPERTIES.rst create mode 100644 Help/prop_tgt/VS_DEBUGGER_COMMAND.rst create mode 100644 Help/release/dev/export-properties.rst create mode 100644 Help/release/dev/find-package_root-restore.rst create mode 100644 Help/release/dev/vs-debugger-config.rst create mode 100644 Tests/RunCMake/VS10Project/VsDebuggerCommand-check.cmake create mode 100644 Tests/RunCMake/VS10Project/VsDebuggerCommand.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => export/ForbiddenToExportImportedProperties-result.txt} (100%) create mode 100644 Tests/RunCMake/export/ForbiddenToExportImportedProperties-stderr.txt create mode 100644 Tests/RunCMake/export/ForbiddenToExportImportedProperties.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => export/ForbiddenToExportInterfaceProperties-result.txt} (100%) create mode 100644 Tests/RunCMake/export/ForbiddenToExportInterfaceProperties-stderr.txt create mode 100644 Tests/RunCMake/export/ForbiddenToExportInterfaceProperties.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => export/ForbiddenToExportPropertyWithGenExp-result.txt} (100%) create mode 100644 Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp-stderr.txt create mode 100644 Tests/RunCMake/export/ForbiddenToExportPropertyWithGenExp.cmake copy Tests/{ExportImport/Export => RunCMake/export}/empty.cpp (100%) create mode 100644 Tests/RunCMake/find_package/CMP0074-OLD-stderr.txt create mode 100644 Tests/RunCMake/find_package/CMP0074-OLD.cmake create mode 100644 Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt create mode 100644 Tests/RunCMake/find_package/CMP0074-WARN.cmake copy Tests/RunCMake/find_package/{PackageRoot.cmake => CMP0074-common.cmake} (86%) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 09:25:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 09:25:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-280-gd882640 Message-ID: <20180319132504.1C58210AA68@public.kitware.com> 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, master has been updated via d8826406aa343580fb4436058c205581da377d37 (commit) via e35f4014f690d20bb1639cde334cd822e6119a26 (commit) via c78d12fc0df27c24b1a65a3050494b48b543dd75 (commit) via cf06962d73862d3092578ff5bc7080b3e5e0a290 (commit) from 180a36e243f9d5191c523774ec077727833e4f9b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d8826406aa343580fb4436058c205581da377d37 commit d8826406aa343580fb4436058c205581da377d37 Merge: e35f401 c78d12f Author: Brad King AuthorDate: Mon Mar 19 09:24:37 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 09:24:37 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e35f4014f690d20bb1639cde334cd822e6119a26 commit e35f4014f690d20bb1639cde334cd822e6119a26 Merge: 180a36e cf06962 Author: Brad King AuthorDate: Mon Mar 19 13:22:45 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 09:22:53 2018 -0400 Merge topic 'revert-findqt4-dirs-fix' cf06962d73 FindQt4: Revert "Set PLUGINS and IMPORTS dir even if empty" Acked-by: Kitware Robot Merge-request: !1867 ----------------------------------------------------------------------- Summary of changes: Modules/FindQt4.cmake | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 09:25:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 09:25:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-19-gc78d12f Message-ID: <20180319132504.33C1310AA86@public.kitware.com> 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, release has been updated via c78d12fc0df27c24b1a65a3050494b48b543dd75 (commit) via cf06962d73862d3092578ff5bc7080b3e5e0a290 (commit) from 4e9aa8015842758ccfadd694723c7b6c705b9745 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/FindQt4.cmake | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 10:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 10:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc3-282-g7ba6f40 Message-ID: <20180319144504.DB1C5FBC70@public.kitware.com> 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, master has been updated via 7ba6f40bb24aa74fdbc2d3547fc76a839ef5444f (commit) via 6b9172d759b5f00069e7d2c65f1c649d4a3b0a70 (commit) from d8826406aa343580fb4436058c205581da377d37 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ba6f40bb24aa74fdbc2d3547fc76a839ef5444f commit 7ba6f40bb24aa74fdbc2d3547fc76a839ef5444f Merge: d882640 6b9172d Author: Brad King AuthorDate: Mon Mar 19 10:43:56 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 10:43:56 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 10:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 10:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc3-20-g6b9172d Message-ID: <20180319144505.06B40FBC96@public.kitware.com> 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, release has been updated via 6b9172d759b5f00069e7d2c65f1c649d4a3b0a70 (commit) from c78d12fc0df27c24b1a65a3050494b48b543dd75 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 10:55:02 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 10:55:02 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.11.0-rc4, created. v3.11.0-rc4 Message-ID: <20180319145502.E78691034A4@public.kitware.com> 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 annotated tag, v3.11.0-rc4 has been created at da0e8a143e00a86f01ccd82cf3299d7a017bcbd4 (tag) tagging 6b9172d759b5f00069e7d2c65f1c649d4a3b0a70 (commit) replaces v3.11.0-rc3 tagged by Brad King on Mon Mar 19 10:42:50 2018 -0400 - Log ----------------------------------------------------------------- CMake 3.11.0-rc4 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlqvzGoWHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhEtGD/0VueJ8QPp1NIKp3MVRkRD1yZ42 SIuof6pPJhSDEAV2THS9NyPDis4TT0DBTIEj3cyvPL/J7oCpKW613nyhqhzn2deg Uxl8mX3DXaaXubLRIUEcPF8UWIQhJNoPSHfsh3+DM0gW9jFw7/PZUIWGeHmRrcT+ WemcTCo3S0+3EIC1VHtE5i9qLJRBHeRxR2ILyjyjFKHxy19smjqLqHsVd7j4cNFY 0Pup/5U/vtoH/3FYiuZd28Lfnb1ElEFocUDQO0YRzyommT9YZy0tFrtXA2yR2H4O GW2vmiBi5XxvN1EWE/Jc1UQWsXodU4q/leyRO/8IXMJOAXTlq8yZ4P6flHJCkHNZ ZmvDU4C/Emfy4CRk/XZSNyYLM39D0LlU0VC86urO7Y23kSl8gjPclOeNFz/I/z6g vWx5EXNMsHkDm9QmXXQ4xsi/1MY893bICfCsUnMUZ5r3GJ6Xf+R91UIJlRHodarH z5Ikv5VPGDxNRVAuRw71av341h+tqbSNbr78TxRIf9gXwM8kPb+A7MWWWZbUTDPa C0o7IEk0T3BK1mQsVbBYrGorK+o4khWlpizQclLd2mgE9r6omYT1zRngj3XxvlNR 1i6MqG8zUAsqwE/4Pb5Rq7NVERni9u8Otb9j3l8TjJgrLd14z2MqguYJ9/A8Ag1U 2IAuUMD5JKH7N7fqAA== =UM+T -----END PGP SIGNATURE----- Brad King (15): Merge branch 'update-buildsystem-docs' into release-3.11 Genex: Fix COMPILE_LANGUAGE in SYSTEM include directories Genex: Fix COMPILE_LANGUAGE propagation through try_compile Merge branch 'ep-support-passing-var-ending-with-notfound' into release-3.11 Merge branch 'ccmake-stack-smashing' into release-3.11 Merge branch 'genex-COMPILE_LANGUAGE-system-include' into release-3.11 Merge branch 'findjni-mips-r6-new-arch' into release-3.11 XL: Fix C default level detection when invoked as 'cc' Merge branch 'xl-cc-default-std' into release-3.11 Features: Record initializer list support for Intel 14 and above Merge branch 'gtest_discover_tests_timeout' into release-3.11 Merge branch 'intel-initializer-list' into release-3.11 FindQt4: Revert "Set PLUGINS and IMPORTS dir even if empty" Merge branch 'revert-findqt4-dirs-fix' into release-3.11 CMake 3.11.0-rc4 Craig Scott (1): GoogleTest: Rename TIMEOUT parameter to avoid clash Jean-Christophe Fillion-Robin (1): ExternalProject: Fix cache generation when last args ends with "-NOTFOUND" Kai Wolf (1): Help: Adapt cmake-buildsystem(7) to new IMPORTED targets features Tianhao Chai (1): ccmake: fix status line buffer overflow on very wide terminals YunQiang Su (1): FindJNI: add some new architecture names for mips release 6 ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 19 11:25:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 19 Mar 2018 11:25:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-265-g882ba7f Message-ID: <20180319152506.CB63C10AAB8@public.kitware.com> 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, master has been updated via 882ba7fd11d375ceb5dec433af79b63057907bcb (commit) via 89ee7ce3eae494c1d5fa4be3106e27aef5286500 (commit) via c27e3e0f2bf6163aa413fbe95ddcda2005185af6 (commit) from 7ba6f40bb24aa74fdbc2d3547fc76a839ef5444f (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=882ba7fd11d375ceb5dec433af79b63057907bcb commit 882ba7fd11d375ceb5dec433af79b63057907bcb Merge: 7ba6f40 89ee7ce Author: Brad King AuthorDate: Mon Mar 19 15:17:57 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 19 11:18:31 2018 -0400 Merge topic 'doc-set_target_properties-clarify' 89ee7ce3ea Help: Reference set_property from set_target_properties c27e3e0f2b Help: Clarify that set_target_properties supports multiple targets Acked-by: Kitware Robot Merge-request: !1866 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89ee7ce3eae494c1d5fa4be3106e27aef5286500 commit 89ee7ce3eae494c1d5fa4be3106e27aef5286500 Author: Brad King AuthorDate: Mon Mar 19 08:05:29 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 08:05:29 2018 -0400 Help: Reference set_property from set_target_properties diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index 77c631d..7db952d 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -15,4 +15,6 @@ set next. You can use any prop value pair you want and extract it later with the :command:`get_property` or :command:`get_target_property` command. +See also the :command:`set_property(TARGET)` command. + See :ref:`Target Properties` for the list of properties known to CMake. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c27e3e0f2bf6163aa413fbe95ddcda2005185af6 commit c27e3e0f2bf6163aa413fbe95ddcda2005185af6 Author: Brad King AuthorDate: Mon Mar 19 07:44:42 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 07:44:42 2018 -0400 Help: Clarify that set_target_properties supports multiple targets Reported-by: Alan W. Irwin diff --git a/Help/command/set_target_properties.rst b/Help/command/set_target_properties.rst index b894eac..77c631d 100644 --- a/Help/command/set_target_properties.rst +++ b/Help/command/set_target_properties.rst @@ -9,8 +9,8 @@ Targets can have properties that affect how they are built. PROPERTIES prop1 value1 prop2 value2 ...) -Set properties on a target. The syntax for the command is to list all -the files you want to change, and then provide the values you want to +Set properties on targets. The syntax for the command is to list all +the targets you want to change, and then provide the values you want to set next. You can use any prop value pair you want and extract it later with the :command:`get_property` or :command:`get_target_property` command. ----------------------------------------------------------------------- Summary of changes: Help/command/set_target_properties.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 20 00:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 20 Mar 2018 00:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-266-g5831b6a Message-ID: <20180320040503.E3B7D10AC44@public.kitware.com> 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, master has been updated via 5831b6a2aec74cd9d1d10b1d047da8fa0411c828 (commit) from 882ba7fd11d375ceb5dec433af79b63057907bcb (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5831b6a2aec74cd9d1d10b1d047da8fa0411c828 commit 5831b6a2aec74cd9d1d10b1d047da8fa0411c828 Author: Kitware Robot AuthorDate: Tue Mar 20 00:01:08 2018 -0400 Commit: Kitware Robot CommitDate: Tue Mar 20 00:01:08 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca63858..d32319b 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180319) +set(CMake_VERSION_PATCH 20180320) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 20 09:25:11 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 20 Mar 2018 09:25:11 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-272-g3b99c96 Message-ID: <20180320132511.3533A107640@public.kitware.com> 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, master has been updated via 3b99c9689aae478708c83cafa552c4ce7bbf4a1b (commit) via 157ae9a0889a3d46347bf8d241f074c7b25df988 (commit) via f5f992b6f0dbd5451dbdf1cd1fd079fbced7afb3 (commit) via 73738f620f82ef0dc761559ec2b1ff25c9b21710 (commit) via b82ad18fe0c94e2869d1fb1f413502383db9f7e9 (commit) via 8e20ad1a5e998341cc579bcf501a6f9d68dba860 (commit) from 5831b6a2aec74cd9d1d10b1d047da8fa0411c828 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b99c9689aae478708c83cafa552c4ce7bbf4a1b commit 3b99c9689aae478708c83cafa552c4ce7bbf4a1b Merge: 157ae9a 73738f6 Author: Brad King AuthorDate: Tue Mar 20 13:20:22 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 20 09:21:49 2018 -0400 Merge topic 'FindwxWidgets-msvc-v141' 73738f620f FindwxWidgets: Add support for MSVC versions of the v141 toolset Acked-by: Kitware Robot Merge-request: !1861 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=157ae9a0889a3d46347bf8d241f074c7b25df988 commit 157ae9a0889a3d46347bf8d241f074c7b25df988 Merge: f5f992b 8e20ad1 Author: Brad King AuthorDate: Tue Mar 20 13:19:00 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 20 09:21:02 2018 -0400 Merge topic 'make_GetItems_const' 8e20ad1a5e cmComputeLinkInformation: make GetItems() const Acked-by: Kitware Robot Merge-request: !1863 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5f992b6f0dbd5451dbdf1cd1fd079fbced7afb3 commit f5f992b6f0dbd5451dbdf1cd1fd079fbced7afb3 Merge: 5831b6a b82ad18 Author: Brad King AuthorDate: Tue Mar 20 13:18:45 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 20 09:19:26 2018 -0400 Merge topic 'vs-indentfix' b82ad18fe0 cmVisualStudio10TargetGenerator: fix indentation Acked-by: Kitware Robot Merge-request: !1868 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=73738f620f82ef0dc761559ec2b1ff25c9b21710 commit 73738f620f82ef0dc761559ec2b1ff25c9b21710 Author: Adam Oleksy AuthorDate: Fri Mar 16 05:29:35 2018 -0400 Commit: Brad King CommitDate: Mon Mar 19 11:56:00 2018 -0400 FindwxWidgets: Add support for MSVC versions of the v141 toolset Since commit v3.8.0-rc3~7^2 (FindwxWidgets: Add support for VS 2017 v141 toolset, 2017-03-22) more MSVC updates have been released that use a MSVC_VERSION value higher than 1910. Revise our checks accordingly. Issue: #16735 diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 965948e..202d481 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -498,17 +498,17 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") set(_WX_TOOL gcc) elseif(MSVC) set(_WX_TOOL vc) - if(MSVC_VERSION EQUAL 1910) + if(NOT MSVC_VERSION LESS 1910) set(_WX_TOOLVER 141) - elseif(MSVC_VERSION EQUAL 1900) + elseif(NOT MSVC_VERSION LESS 1900) set(_WX_TOOLVER 140) - elseif(MSVC_VERSION EQUAL 1800) + elseif(NOT MSVC_VERSION LESS 1800) set(_WX_TOOLVER 120) - elseif(MSVC_VERSION EQUAL 1700) + elseif(NOT MSVC_VERSION LESS 1700) set(_WX_TOOLVER 110) - elseif(MSVC_VERSION EQUAL 1600) + elseif(NOT MSVC_VERSION LESS 1600) set(_WX_TOOLVER 100) - elseif(MSVC_VERSION EQUAL 1500) + elseif(NOT MSVC_VERSION LESS 1500) set(_WX_TOOLVER 90) endif() if(CMAKE_SIZEOF_VOID_P EQUAL 8) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b82ad18fe0c94e2869d1fb1f413502383db9f7e9 commit b82ad18fe0c94e2869d1fb1f413502383db9f7e9 Author: Vitaly Stakhovsky AuthorDate: Mon Mar 19 09:56:44 2018 -0400 Commit: Vitaly Stakhovsky CommitDate: Mon Mar 19 09:56:44 2018 -0400 cmVisualStudio10TargetGenerator: fix indentation Added printing empty string to get the right indentation. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 87d3c78..7e6e803 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -29,6 +29,7 @@ struct cmVisualStudio10TargetGenerator::Elem , Indent(i) { } + Elem(const Elem&) = delete; Elem(Elem& par) : S(par.S) , Indent(par.Indent + 1) @@ -47,6 +48,8 @@ struct cmVisualStudio10TargetGenerator::Elem if (HasElements) { S.fill(' '); S.width(Indent * 2); + // write an empty string to get the fill level indent to print + S << ""; S << "\n"; } else { S << " />\n"; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8e20ad1a5e998341cc579bcf501a6f9d68dba860 commit 8e20ad1a5e998341cc579bcf501a6f9d68dba860 Author: Michael St?rmer AuthorDate: Thu Mar 15 16:52:48 2018 +0100 Commit: Brad King CommitDate: Mon Mar 19 09:07:38 2018 -0400 cmComputeLinkInformation: make GetItems() const diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index e00450f..b82fc43 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -406,7 +406,7 @@ cmComputeLinkInformation::~cmComputeLinkInformation() } cmComputeLinkInformation::ItemVector const& -cmComputeLinkInformation::GetItems() +cmComputeLinkInformation::GetItems() const { return this->Items; } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index f8c6214..6c67fb4 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -48,7 +48,7 @@ public: cmGeneratorTarget const* Target; }; typedef std::vector ItemVector; - ItemVector const& GetItems(); + ItemVector const& GetItems() const; std::vector const& GetDirectories(); std::vector const& GetDepends(); std::vector const& GetFrameworkPaths(); ----------------------------------------------------------------------- Summary of changes: Modules/FindwxWidgets.cmake | 12 ++++++------ Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeLinkInformation.h | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 3 +++ 4 files changed, 11 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 20 09:45:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 20 Mar 2018 09:45:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-276-g1c3bbda Message-ID: <20180320134509.CD93EFBC2E@public.kitware.com> 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, master has been updated via 1c3bbda2f2920f416304086ece139ba1b50015ea (commit) via d41abae70f282c718f3109b7f76644adce41ff37 (commit) via 16eaf2d27112c739667049c633d1f522e9d6c1d1 (commit) via a58158727be4585f9fd71449e9cc9e801c59a009 (commit) from 3b99c9689aae478708c83cafa552c4ce7bbf4a1b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1c3bbda2f2920f416304086ece139ba1b50015ea commit 1c3bbda2f2920f416304086ece139ba1b50015ea Merge: d41abae 16eaf2d Author: Brad King AuthorDate: Tue Mar 20 13:43:12 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 20 09:43:22 2018 -0400 Merge topic 'pr.install_name_dir' 16eaf2d271 Help: Reference CMAKE_INSTALL_NAME_DIR from INSTALL_NAME_DIR Acked-by: Kitware Robot Acked-by: Brad King Merge-request: !1872 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d41abae70f282c718f3109b7f76644adce41ff37 commit d41abae70f282c718f3109b7f76644adce41ff37 Merge: 3b99c96 a581587 Author: Brad King AuthorDate: Tue Mar 20 13:39:45 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 20 09:40:40 2018 -0400 Merge topic 'list-join' a58158727b list(): add `JOIN` sub-command Acked-by: Kitware Robot Merge-request: !1846 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=16eaf2d27112c739667049c633d1f522e9d6c1d1 commit 16eaf2d27112c739667049c633d1f522e9d6c1d1 Author: Ruslan Baratov AuthorDate: Tue Mar 20 16:34:45 2018 +0300 Commit: Ruslan Baratov CommitDate: Tue Mar 20 16:34:45 2018 +0300 Help: Reference CMAKE_INSTALL_NAME_DIR from INSTALL_NAME_DIR diff --git a/Help/prop_tgt/INSTALL_NAME_DIR.rst b/Help/prop_tgt/INSTALL_NAME_DIR.rst index a67ec15..34348bb 100644 --- a/Help/prop_tgt/INSTALL_NAME_DIR.rst +++ b/Help/prop_tgt/INSTALL_NAME_DIR.rst @@ -6,3 +6,7 @@ Mac OSX directory name for installed targets. INSTALL_NAME_DIR is a string specifying the directory portion of the "install_name" field of shared libraries on Mac OSX to use in the installed targets. + +This property is initialized by the value of the variable +:variable:`CMAKE_INSTALL_NAME_DIR` if it is set when a target is +created. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a58158727be4585f9fd71449e9cc9e801c59a009 commit a58158727be4585f9fd71449e9cc9e801c59a009 Author: Marc Chevrier AuthorDate: Mon Mar 19 15:06:52 2018 +0100 Commit: Marc Chevrier CommitDate: Tue Mar 20 14:28:17 2018 +0100 list(): add `JOIN` sub-command diff --git a/Help/command/list.rst b/Help/command/list.rst index e6a7069..3c092bd 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -54,6 +54,17 @@ GET Returns the list of elements specified by indices from the list. +JOIN +"""" + +:: + + list(JOIN ) + +Returns a string joining all list's elements using the glue string. +To join multiple strings, which are not part of a list, use ``JOIN`` operator +from :command:`string` command. + Search ^^^^^^ diff --git a/Help/command/string.rst b/Help/command/string.rst index cd94bb4..bb07d29 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -161,6 +161,10 @@ JOIN Join all the input arguments together using the glue string and store the result in the named output variable. +To join list's elements, use preferably the ``JOIN`` operator +from :command:`list` command. This allows for the elements to have +special characters like ``;`` in them. + TOLOWER """"""" diff --git a/Help/release/dev/list-join.rst b/Help/release/dev/list-join.rst new file mode 100644 index 0000000..0756b60 --- /dev/null +++ b/Help/release/dev/list-join.rst @@ -0,0 +1,5 @@ +list-join +--------- + +* The :command:`list` command learned a ``JOIN`` sub-command + to concatenate list's elements separated by a glue string. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index ae4f0a8..62d4ea7 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -42,6 +42,9 @@ bool cmListCommand::InitialPass(std::vector const& args, if (subCommand == "INSERT") { return this->HandleInsertCommand(args); } + if (subCommand == "JOIN") { + return this->HandleJoinCommand(args); + } if (subCommand == "REMOVE_AT") { return this->HandleRemoveAtCommand(args); } @@ -294,6 +297,34 @@ bool cmListCommand::HandleInsertCommand(std::vector const& args) return true; } +bool cmListCommand::HandleJoinCommand(std::vector const& args) +{ + if (args.size() != 4) { + std::ostringstream error; + error << "sub-command JOIN requires three arguments (" << args.size() - 1 + << " found)."; + this->SetError(error.str()); + return false; + } + + const std::string& listName = args[1]; + const std::string& glue = args[2]; + const std::string& variableName = args[3]; + + // expand the variable + std::vector varArgsExpanded; + if (!this->GetList(varArgsExpanded, listName)) { + this->Makefile->AddDefinition(variableName, ""); + return true; + } + + std::string value = + cmJoin(cmMakeRange(varArgsExpanded.begin(), varArgsExpanded.end()), glue); + + this->Makefile->AddDefinition(variableName, value.c_str()); + return true; +} + bool cmListCommand::HandleRemoveItemCommand( std::vector const& args) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index 2965399..d6870e6 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -37,6 +37,7 @@ protected: bool HandleAppendCommand(std::vector const& args); bool HandleFindCommand(std::vector const& args); bool HandleInsertCommand(std::vector const& args); + bool HandleJoinCommand(std::vector const& args); bool HandleRemoveAtCommand(std::vector const& args); bool HandleRemoveItemCommand(std::vector const& args); bool HandleRemoveDuplicatesCommand(std::vector const& args); diff --git a/Tests/RunCMake/list/JOIN-NoArguments-result.txt b/Tests/RunCMake/list/JOIN-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt new file mode 100644 index 0000000..5e1b98f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(1 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoArguments.cmake b/Tests/RunCMake/list/JOIN-NoArguments.cmake new file mode 100644 index 0000000..2ab449a --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist) diff --git a/Tests/RunCMake/list/JOIN-NoVariable-result.txt b/Tests/RunCMake/list/JOIN-NoVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt new file mode 100644 index 0000000..db1d773 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-NoVariable.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(2 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-NoVariable.cmake b/Tests/RunCMake/list/JOIN-NoVariable.cmake new file mode 100644 index 0000000..b60d8f1 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-NoVariable.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue") diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt new file mode 100644 index 0000000..2b09e22 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at JOIN-TooManyArguments.cmake:1 \(list\): + list sub-command JOIN requires three arguments \(4 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/JOIN-TooManyArguments.cmake b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake new file mode 100644 index 0000000..dc651f6 --- /dev/null +++ b/Tests/RunCMake/list/JOIN-TooManyArguments.cmake @@ -0,0 +1 @@ +list(JOIN mylist "glue" out one_too_many) diff --git a/Tests/RunCMake/list/JOIN.cmake b/Tests/RunCMake/list/JOIN.cmake new file mode 100644 index 0000000..24a623e --- /dev/null +++ b/Tests/RunCMake/list/JOIN.cmake @@ -0,0 +1,18 @@ +list(JOIN undefList % out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"list(JOIN undefList % out)\" set out to \"${out}\"") +endif() +set(myList a) +list(JOIN myList % out) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"list(JOIN \"a\" % out)\" set out to \"${out}\"") +endif() +set(myList a b) +list(JOIN myList % out) +if(NOT out STREQUAL "a%b") + message(FATAL_ERROR "\"list(JOIN \"a;b\" % out)\" set out to \"${out}\"") +endif() +list(JOIN myList "" out) +if(NOT out STREQUAL "ab") + message(FATAL_ERROR "\"list(JOIN \"a;b\" \"\" out a)\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index b002ab3..1be4f85 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -15,6 +15,7 @@ run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) run_cmake(FILTER-REGEX-TooManyArguments) +run_cmake(JOIN-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) @@ -31,3 +32,7 @@ run_cmake(FILTER-REGEX-InvalidMode) run_cmake(FILTER-REGEX-InvalidOperator) run_cmake(FILTER-REGEX-Valid0) run_cmake(FILTER-REGEX-Valid1) + +run_cmake(JOIN-NoArguments) +run_cmake(JOIN-NoVariable) +run_cmake(JOIN) ----------------------------------------------------------------------- Summary of changes: Help/command/list.rst | 11 +++++++ Help/command/string.rst | 4 +++ Help/prop_tgt/INSTALL_NAME_DIR.rst | 4 +++ Help/release/dev/list-join.rst | 5 ++++ Source/cmListCommand.cxx | 31 ++++++++++++++++++++ Source/cmListCommand.h | 1 + .../JOIN-NoArguments-result.txt} | 0 Tests/RunCMake/list/JOIN-NoArguments-stderr.txt | 4 +++ Tests/RunCMake/list/JOIN-NoArguments.cmake | 1 + .../JOIN-NoVariable-result.txt} | 0 Tests/RunCMake/list/JOIN-NoVariable-stderr.txt | 4 +++ Tests/RunCMake/list/JOIN-NoVariable.cmake | 1 + .../JOIN-TooManyArguments-result.txt} | 0 .../RunCMake/list/JOIN-TooManyArguments-stderr.txt | 4 +++ Tests/RunCMake/list/JOIN-TooManyArguments.cmake | 1 + Tests/RunCMake/list/JOIN.cmake | 18 ++++++++++++ Tests/RunCMake/list/RunCMakeTest.cmake | 5 ++++ 17 files changed, 94 insertions(+) create mode 100644 Help/release/dev/list-join.rst copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/JOIN-NoArguments-result.txt} (100%) create mode 100644 Tests/RunCMake/list/JOIN-NoArguments-stderr.txt create mode 100644 Tests/RunCMake/list/JOIN-NoArguments.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/JOIN-NoVariable-result.txt} (100%) create mode 100644 Tests/RunCMake/list/JOIN-NoVariable-stderr.txt create mode 100644 Tests/RunCMake/list/JOIN-NoVariable.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/JOIN-TooManyArguments-result.txt} (100%) create mode 100644 Tests/RunCMake/list/JOIN-TooManyArguments-stderr.txt create mode 100644 Tests/RunCMake/list/JOIN-TooManyArguments.cmake create mode 100644 Tests/RunCMake/list/JOIN.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-277-g9fae23f Message-ID: <20180321040506.0A44810A3C5@public.kitware.com> 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, master has been updated via 9fae23f7032dda42312fc9e6d30c7dca028e83df (commit) from 1c3bbda2f2920f416304086ece139ba1b50015ea (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9fae23f7032dda42312fc9e6d30c7dca028e83df commit 9fae23f7032dda42312fc9e6d30c7dca028e83df Author: Kitware Robot AuthorDate: Wed Mar 21 00:01:12 2018 -0400 Commit: Kitware Robot CommitDate: Wed Mar 21 00:01:12 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d32319b..61d69bc 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180320) +set(CMake_VERSION_PATCH 20180321) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 08:55:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 08:55:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-281-gdebe401 Message-ID: <20180321125506.5544B10AA68@public.kitware.com> 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, master has been updated via debe4010a82a7cb75b12009893e797c8234eca9c (commit) via 2006e981dab0ea228f611756cdefef8ccfa33a51 (commit) via cb794ac78871f203cd0a4392c449ecd565b32974 (commit) via 4267960fc9751b1c7557cf1ef5234b328be7c839 (commit) from 9fae23f7032dda42312fc9e6d30c7dca028e83df (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=debe4010a82a7cb75b12009893e797c8234eca9c commit debe4010a82a7cb75b12009893e797c8234eca9c Merge: cb794ac 2006e98 Author: Brad King AuthorDate: Wed Mar 21 08:54:35 2018 -0400 Commit: Brad King CommitDate: Wed Mar 21 08:54:35 2018 -0400 Merge branch 'release-3.11' https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cb794ac78871f203cd0a4392c449ecd565b32974 commit cb794ac78871f203cd0a4392c449ecd565b32974 Merge: 9fae23f 4267960 Author: Brad King AuthorDate: Wed Mar 21 12:53:07 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 08:53:22 2018 -0400 Merge topic 'sunpro-5.15' 4267960fc9 Features: Record for SunPro 5.15 Acked-by: Kitware Robot Merge-request: !1875 ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-compile-features.7.rst | 2 +- Modules/Compiler/SunPro-CXX-FeatureTests.cmake | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 08:55:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 08:55:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc4-2-g2006e98 Message-ID: <20180321125506.6486210AA85@public.kitware.com> 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, release has been updated via 2006e981dab0ea228f611756cdefef8ccfa33a51 (commit) via 4267960fc9751b1c7557cf1ef5234b328be7c839 (commit) from 6b9172d759b5f00069e7d2c65f1c649d4a3b0a70 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-compile-features.7.rst | 2 +- Modules/Compiler/SunPro-CXX-FeatureTests.cmake | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 09:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 09:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-283-g64bb657 Message-ID: <20180321130503.73F8410AD3C@public.kitware.com> 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, master has been updated via 64bb65777ad011d96c6bedca36b24df7d9a1371d (commit) via 3b7be02480bbc462f2ebdd0eff156675dd57c50a (commit) from debe4010a82a7cb75b12009893e797c8234eca9c (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=64bb65777ad011d96c6bedca36b24df7d9a1371d commit 64bb65777ad011d96c6bedca36b24df7d9a1371d Merge: debe401 3b7be02 Author: Brad King AuthorDate: Wed Mar 21 12:55:37 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 08:56:09 2018 -0400 Merge topic 'ccmake-solaris' 3b7be02480 ccmake: Fix compilation with ncurses on Solaris Acked-by: Kitware Robot Merge-request: !1876 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3b7be02480bbc462f2ebdd0eff156675dd57c50a commit 3b7be02480bbc462f2ebdd0eff156675dd57c50a Author: Brad King AuthorDate: Tue Mar 20 11:39:28 2018 -0400 Commit: Brad King CommitDate: Tue Mar 20 11:39:28 2018 -0400 ccmake: Fix compilation with ncurses on Solaris On Solaris the ncurses header may define an `__attribute__` macro. This breaks C++ headers that use `__attribute__(...)` syntax. Somehow it causes references to unresolved symbols: __gthrw_pthread_once __gthrw_pthread_mutex_lock __gthrw_pthread_mutex_unlock instead of references to the correct symbols: pthread_once pthread_mutex_lock pthread_mutex_unlock Detect this case and undefine the `__attribute__` macro after including the curses headers. diff --git a/Source/CursesDialog/cmCursesStandardIncludes.h b/Source/CursesDialog/cmCursesStandardIncludes.h index 332d2af..60bad94 100644 --- a/Source/CursesDialog/cmCursesStandardIncludes.h +++ b/Source/CursesDialog/cmCursesStandardIncludes.h @@ -5,6 +5,11 @@ #include "cmConfigure.h" // IWYU pragma: keep +// Record whether __attribute__ is currently defined. See purpose below. +#ifndef __attribute__ +#define cm_no__attribute__ +#endif + #if defined(__hpux) #define _BOOL_DEFINED #include @@ -29,4 +34,12 @@ inline void curses_clear() #undef erase #undef clear +// The curses headers on some platforms (e.g. Solaris) may +// define __attribute__ as a macro. This breaks C++ headers +// in some cases, so undefine it now. +#if defined(cm_no__attribute__) && defined(__attribute__) +#undef __attribute__ +#endif +#undef cm_no__attribute__ + #endif // cmCursesStandardIncludes_h ----------------------------------------------------------------------- Summary of changes: Source/CursesDialog/cmCursesStandardIncludes.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 09:15:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 09:15:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-289-g948eb3b Message-ID: <20180321131504.9C56DFBC1C@public.kitware.com> 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, master has been updated via 948eb3b2bf450d9c1a562af9cb2f9cc188a9ec6a (commit) via 54ae5ee1d3d52ed685a707e1bcab64b0d93d070f (commit) via 87223a24f061c519caf72df63e61be9676e322ea (commit) via e743fc8e9137692232f0220ac901f5a15cbd62cf (commit) via 3af1daa186f01f1538cf9a7541e9269ac0c6e95a (commit) via 8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6 (commit) from 64bb65777ad011d96c6bedca36b24df7d9a1371d (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=948eb3b2bf450d9c1a562af9cb2f9cc188a9ec6a commit 948eb3b2bf450d9c1a562af9cb2f9cc188a9ec6a Merge: 54ae5ee e743fc8 Author: Brad King AuthorDate: Wed Mar 21 13:10:37 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 09:10:46 2018 -0400 Merge topic 'cuda_arch' e743fc8e91 FindCUDA/select_compute_arch: Add support for CUDA as a language Acked-by: Kitware Robot Merge-request: !1856 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54ae5ee1d3d52ed685a707e1bcab64b0d93d070f commit 54ae5ee1d3d52ed685a707e1bcab64b0d93d070f Merge: 87223a2 3af1daa Author: Brad King AuthorDate: Wed Mar 21 13:08:48 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 09:08:58 2018 -0400 Merge topic 'pr.target_compile_definitions' 3af1daa186 Help: Document target_compile_definitions handling of -D Acked-by: Kitware Robot Merge-request: !1873 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87223a24f061c519caf72df63e61be9676e322ea commit 87223a24f061c519caf72df63e61be9676e322ea Merge: 64bb657 8c0f12c Author: Brad King AuthorDate: Wed Mar 21 13:08:01 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 09:08:10 2018 -0400 Merge topic 'makefile-fix-depend-optimization' 8c0f12c4aa Makefile: Restore use of dependency scanning cache Acked-by: Kitware Robot Merge-request: !1870 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e743fc8e9137692232f0220ac901f5a15cbd62cf commit e743fc8e9137692232f0220ac901f5a15cbd62cf Author: Henry Fredrick Schreiner AuthorDate: Thu Mar 15 15:30:50 2018 +0100 Commit: Brad King CommitDate: Tue Mar 20 14:19:25 2018 -0400 FindCUDA/select_compute_arch: Add support for CUDA as a language Even though this is an internal module, we can still prepare it to be used in another public-facing module outside of `FindCUDA`. Issue: #16586 diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake index b604a17..2a196c2 100644 --- a/Modules/FindCUDA/select_compute_arch.cmake +++ b/Modules/FindCUDA/select_compute_arch.cmake @@ -23,6 +23,12 @@ set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell") # This list will be used for CUDA_ARCH_NAME = Common option (enabled by default) set(CUDA_COMMON_GPU_ARCHITECTURES "3.0" "3.5" "5.0") +if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language + if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA") + set(CUDA_VERSION "${CMAKE_CUDA_COMPILER_VERSION}") + endif() +endif() + if (CUDA_VERSION VERSION_GREATER "6.5") list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra") list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2") @@ -49,7 +55,11 @@ endif() # function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) if(NOT CUDA_GPU_DETECT_OUTPUT) - set(file ${PROJECT_BINARY_DIR}/detect_cuda_compute_capabilities.cpp) + if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language + set(file "${PROJECT_BINARY_DIR}/detect_cuda_compute_capabilities.cu") + else() + set(file "${PROJECT_BINARY_DIR}/detect_cuda_compute_capabilities.cpp") + endif() file(WRITE ${file} "" "#include \n" @@ -68,10 +78,15 @@ function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE) " return 0;\n" "}\n") - try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file} - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}" - LINK_LIBRARIES ${CUDA_LIBRARIES} - RUN_OUTPUT_VARIABLE compute_capabilities) + if(CMAKE_CUDA_COMPILER_LOADED) # CUDA as a language + try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file} + RUN_OUTPUT_VARIABLE compute_capabilities) + else() + try_run(run_result compile_result ${PROJECT_BINARY_DIR} ${file} + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CUDA_INCLUDE_DIRS}" + LINK_LIBRARIES ${CUDA_LIBRARIES} + RUN_OUTPUT_VARIABLE compute_capabilities) + endif() if(run_result EQUAL 0) string(REPLACE "2.1" "2.1(2.0)" compute_capabilities "${compute_capabilities}") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3af1daa186f01f1538cf9a7541e9269ac0c6e95a commit 3af1daa186f01f1538cf9a7541e9269ac0c6e95a Author: Ruslan Baratov AuthorDate: Tue Mar 20 17:13:41 2018 +0300 Commit: Brad King CommitDate: Tue Mar 20 14:06:15 2018 -0400 Help: Document target_compile_definitions handling of -D Add an example of using the `target_compile_definitions` command and a note about usage of ``-D`` in items. diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 3709e7a..a740117 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -27,3 +27,13 @@ Arguments to ``target_compile_definitions`` may use "generator expressions" with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for available expressions. See the :manual:`cmake-buildsystem(7)` manual for more on defining buildsystem properties. + +Any leading ``-D`` on an item will be removed. Empty items are ignored. +For example, the following are all equivalent: + +.. code-block:: cmake + + target_compile_definitions(foo PUBLIC FOO) + target_compile_definitions(foo PUBLIC -DFOO) # -D removed + target_compile_definitions(foo PUBLIC "" FOO) # "" ignored + target_compile_definitions(foo PUBLIC -D FOO) # -D becomes "", then ignored https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6 commit 8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6 Author: tsecer harry AuthorDate: Tue Mar 20 15:59:00 2018 +0800 Commit: Brad King CommitDate: Tue Mar 20 08:40:04 2018 -0400 Makefile: Restore use of dependency scanning cache Since commit v2.8.0~27 (Major optimization of C/C++ dependency scanning, 2009-09-23) our `VaildDeps` cache of `depend.internal` content is supposed to avoid re-scanning dependencies of object files whose dependencies have not changed. However, this was broken by changes to `cmDependsC::WriteDependencies` by commit v3.1.0-rc1~272^2~1 (cmDepends: Refactor object file path conversion, 2014-07-22). The object file path written to `depend.internal` was changed to a relative path, but the lookup in the `ValidDeps` cache of that information was not updated too. Therefore the cache is not used. Fix the object file path used for the `ValidDeps` lookup to restore the original optimization. diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 62bc8d9..34c0e94 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -96,9 +96,16 @@ bool cmDependsC::WriteDependencies(const std::set& sources, std::set dependencies; bool haveDeps = false; + std::string binDir = this->LocalGenerator->GetBinaryDirectory(); + + // Compute a path to the object file to write to the internal depend file. + // Any existing content of the internal depend file has already been + // loaded in ValidDeps with this path as a key. + std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); + if (this->ValidDeps != nullptr) { std::map::const_iterator tmpIt = - this->ValidDeps->find(obj); + this->ValidDeps->find(obj_i); if (tmpIt != this->ValidDeps->end()) { dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); haveDeps = true; @@ -222,8 +229,6 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // written by the original local generator for this directory // convert the dependencies to paths relative to the home output // directory. We must do the same here. - std::string binDir = this->LocalGenerator->GetBinaryDirectory(); - std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i); internalDepends << obj_i << std::endl; ----------------------------------------------------------------------- Summary of changes: Help/command/target_compile_definitions.rst | 10 ++++++++++ Modules/FindCUDA/select_compute_arch.cmake | 25 ++++++++++++++++++++----- Source/cmDependsC.cxx | 11 ++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 09:35:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 09:35:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-291-g3946cbc Message-ID: <20180321133504.6F26D10AEC1@public.kitware.com> 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, master has been updated via 3946cbc505a066677efe1faea3cc2d051b1132bc (commit) via dc863592bce3f4cda927c55a550af661a0663513 (commit) from 948eb3b2bf450d9c1a562af9cb2f9cc188a9ec6a (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3946cbc505a066677efe1faea3cc2d051b1132bc commit 3946cbc505a066677efe1faea3cc2d051b1132bc Merge: 948eb3b dc86359 Author: Brad King AuthorDate: Wed Mar 21 13:25:54 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 09:26:37 2018 -0400 Merge topic 'wcdh-gcc-null' dc863592bc WCDH: use better fallback value for nullptr with old gcc versions Acked-by: Kitware Robot Merge-request: !1877 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=dc863592bce3f4cda927c55a550af661a0663513 commit dc863592bce3f4cda927c55a550af661a0663513 Author: Rolf Eike Beer AuthorDate: Mon Mar 19 21:52:40 2018 +0100 Commit: Rolf Eike Beer CommitDate: Tue Mar 20 22:01:48 2018 +0100 WCDH: use better fallback value for nullptr with old gcc versions GCC supports the __null builtin basically forever (since at least 2.95), which behaves very much like nullptr later does. Use this instead of plain "0" as fallback value, otherwise passing the define to functions annotated with __attribute__((sentinel)) will result in a compiler warning. diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index e7f9912..675df84 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -557,7 +557,18 @@ template<> struct ${prefix_arg}StaticAssert{}; # endif \n") endif() - _simpledefine(cxx_nullptr NULLPTR nullptr 0) + if (feature STREQUAL cxx_nullptr) + set(def_value "${prefix_arg}_NULLPTR") + string(APPEND file_content " +# if defined(${def_name}) && ${def_name} +# define ${def_value} nullptr +# elif ${prefix_arg}_COMPILER_IS_GNU +# define ${def_value} __null +# else +# define ${def_value} 0 +# endif +\n") + endif() if (feature STREQUAL cxx_thread_local) set(def_value "${prefix_arg}_THREAD_LOCAL") string(APPEND file_content " ----------------------------------------------------------------------- Summary of changes: Modules/WriteCompilerDetectionHeader.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 21 10:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 21 Mar 2018 10:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-294-ga13cfa2 Message-ID: <20180321140505.86D3E10AF3F@public.kitware.com> 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, master has been updated via a13cfa246fee1ba99eeecda8b8e8d158d29841df (commit) via 50b5e9ed1316f82976a45c5fb2b00d0d3a3e4438 (commit) via 352baee2074d12637c65e3113f560bbf98d0640a (commit) from 3946cbc505a066677efe1faea3cc2d051b1132bc (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a13cfa246fee1ba99eeecda8b8e8d158d29841df commit a13cfa246fee1ba99eeecda8b8e8d158d29841df Merge: 3946cbc 50b5e9e Author: Brad King AuthorDate: Wed Mar 21 14:01:29 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 21 10:01:52 2018 -0400 Merge topic 'FindPython-new-implementation' 50b5e9ed13 CMake build: Use new FindPython module 352baee207 FindPython*: New implementation for Python stuff Acked-by: Kitware Robot Reviewed-by: Ben Boeckel Acked-by: Alex Turbov Merge-request: !1819 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=50b5e9ed1316f82976a45c5fb2b00d0d3a3e4438 commit 50b5e9ed1316f82976a45c5fb2b00d0d3a3e4438 Author: Marc Chevrier AuthorDate: Mon Mar 5 16:27:26 2018 +0100 Commit: Marc Chevrier CommitDate: Tue Mar 20 09:29:55 2018 +0100 CMake build: Use new FindPython module diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 2aa5f6f..25454fd 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -196,7 +196,7 @@ if(NOT DEFINED CXXTEST_TESTGEN_ARGS) set(CXXTEST_TESTGEN_ARGS --error-printer) endif() -find_package(PythonInterp QUIET) +find_package(Python QUIET) find_package(Perl QUIET) find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h) @@ -206,17 +206,17 @@ find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl PATHS ${CXXTEST_INCLUDE_DIR}) -if(PYTHONINTERP_FOUND OR PERL_FOUND) +if(PYTHON_FOUND OR PERL_FOUND) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON)) + if(PYTHON_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND OR NOT DEFINED CXXTEST_USE_PYTHON)) set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) execute_process(COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --version OUTPUT_VARIABLE _CXXTEST_OUT ERROR_VARIABLE _CXXTEST_OUT RESULT_VARIABLE _CXXTEST_RESULT) if(_CXXTEST_RESULT EQUAL 0) set(CXXTEST_TESTGEN_INTERPRETER "") else() - set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE}) + set(CXXTEST_TESTGEN_INTERPRETER ${Python_EXECUTABLE}) endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE) diff --git a/Tests/RunCMake/UseSWIG/BasicConfiguration.cmake b/Tests/RunCMake/UseSWIG/BasicConfiguration.cmake index 94d8dd3..2f46d63 100644 --- a/Tests/RunCMake/UseSWIG/BasicConfiguration.cmake +++ b/Tests/RunCMake/UseSWIG/BasicConfiguration.cmake @@ -9,10 +9,9 @@ unset(SWIG_LANG_OPTIONS) unset(SWIG_LANG_LIBRARIES) if(${language} MATCHES python) - find_package(PythonInterp REQUIRED) - find_package(PythonLibs REQUIRED) - set(SWIG_LANG_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_PATH}) - set(SWIG_LANG_LIBRARIES ${PYTHON_LIBRARIES}) + find_package(Python REQUIRED COMPONENTS Interpreter Development) + set(SWIG_LANG_INCLUDE_DIRECTORIES ${Python_INCLUDE_DIRS}) + set(SWIG_LANG_LIBRARIES ${Python_LIBRARIES}) endif() if(${language} MATCHES perl) find_package(Perl REQUIRED) diff --git a/Tests/RunCMake/UseSWIG/BasicPython.cmake b/Tests/RunCMake/UseSWIG/BasicPython.cmake index 0d8c824..873dbe9 100644 --- a/Tests/RunCMake/UseSWIG/BasicPython.cmake +++ b/Tests/RunCMake/UseSWIG/BasicPython.cmake @@ -5,5 +5,5 @@ include (BasicConfiguration.cmake) add_custom_target (RunTest COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" - "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py" + "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py" DEPENDS example) diff --git a/Tests/Server/CMakeLists.txt b/Tests/Server/CMakeLists.txt index 41d1131..8321edb 100644 --- a/Tests/Server/CMakeLists.txt +++ b/Tests/Server/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.4) project(Server CXX) -find_package(PythonInterp REQUIRED) +find_package(Python REQUIRED) macro(do_test bsname file type) - execute_process(COMMAND ${PYTHON_EXECUTABLE} + execute_process(COMMAND ${Python_EXECUTABLE} -B # no .pyc files "${CMAKE_SOURCE_DIR}/${type}-test.py" "${CMAKE_COMMAND}" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=352baee2074d12637c65e3113f560bbf98d0640a commit 352baee2074d12637c65e3113f560bbf98d0640a Author: Marc Chevrier AuthorDate: Thu Feb 22 16:18:43 2018 +0100 Commit: Marc Chevrier CommitDate: Tue Mar 20 09:29:44 2018 +0100 FindPython*: New implementation for Python stuff Fixes: #16142 diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index 41fe90c..32e8cfc 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -644,6 +644,8 @@ Documentation`_ section above. +.. _`CMake Developer Standard Variable Names`: + Standard Variable Names ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst index 694bae5..070c6ed 100644 --- a/Help/manual/cmake-modules.7.rst +++ b/Help/manual/cmake-modules.7.rst @@ -196,6 +196,9 @@ All Modules /module/FindPostgreSQL /module/FindProducer /module/FindProtobuf + /module/FindPython + /module/FindPython2 + /module/FindPython3 /module/FindPythonInterp /module/FindPythonLibs /module/FindQt3 diff --git a/Help/module/FindPython.rst b/Help/module/FindPython.rst new file mode 100644 index 0000000..057a350 --- /dev/null +++ b/Help/module/FindPython.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindPython.cmake diff --git a/Help/module/FindPython2.rst b/Help/module/FindPython2.rst new file mode 100644 index 0000000..1696bed --- /dev/null +++ b/Help/module/FindPython2.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindPython2.cmake diff --git a/Help/module/FindPython3.rst b/Help/module/FindPython3.rst new file mode 100644 index 0000000..e530ab8 --- /dev/null +++ b/Help/module/FindPython3.rst @@ -0,0 +1 @@ +.. cmake-module:: ../../Modules/FindPython3.cmake diff --git a/Help/release/dev/FindPython-new-implementation.rst b/Help/release/dev/FindPython-new-implementation.rst new file mode 100644 index 0000000..22051d0 --- /dev/null +++ b/Help/release/dev/FindPython-new-implementation.rst @@ -0,0 +1,5 @@ +FindPython(2|3) +--------------- + +* The new :module:`FindPython3` and :module:`FindPython2` modules, as well as + :module:`FindPython`, provide a new way to locate python environments. diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake new file mode 100644 index 0000000..c87f784 --- /dev/null +++ b/Modules/FindPython.cmake @@ -0,0 +1,180 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPython +---------- + +Find Python interpreter, compiler and development environment (include +directories and libraries). + +Three components are supported: + +* ``Interpreter``: search for Python interpreter. +* ``Compiler``: search for Python compiler. Only offered by IronPython. +* ``Development``: search for development artifacts (include directories and + libraries). + +If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. + +To ensure consistent versions between components ``Interpreter``, ``Compiler`` +and ``Development``, specify all components at the same time:: + + find_package (Python COMPONENTS Interpreter Development) + +This module looks preferably for version 3 of Python. If not found, version 2 +is searched. +To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and +:module:`FindPython2` modules rather than this one. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines the following :ref:`Imported Targets `: + +``Python::Interpreter`` + Python interpreter. Target defined if component ``Interpreter`` is found. +``Python::Compiler`` + Python compiler. Target defined if component ``Compiler`` is found. +``Python::Python`` + Python library. Target defined if component ``Development`` is found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project +(see :ref:`Standard Variable Names `): + +``Python_FOUND`` + System has the Python requested components. +``Python_Interpreter_FOUND`` + System has the Python interpreter. +``Python_EXECUTABLE`` + Path to the Python interpreter. +``Python_INTERPRETER_ID`` + A short string unique to the interpreter. Possible values include: + * Python + * ActivePython + * Anaconda + * Canopy + * IronPython +``Python_STDLIB`` + Standard platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. +``Python_STDARCH`` + Standard platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. +``Python_SITELIB`` + Third-party platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. +``Python_SITEARCH`` + Third-party platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. +``Python_Compiler_FOUND`` + System has the Python compiler. +``Python_COMPILER`` + Path to the Python compiler. Only offered by IronPython. +``Python_COMPILER_ID`` + A short string unique to the compiler. Possible values include: + * IronPython +``Python_Development_FOUND`` + System has the Python development artifacts. +``Python_INCLUDE_DIRS`` + The Python include directories. +``Python_LIBRARIES`` + The Python libraries. +``Python_LIBRARY_DIRS`` + The Python library directories. +``Python_RUNTIME_LIBRARY_DIRS`` + The Python runtime library directories. +``Python_VERSION`` + Python version. +``Python_VERSION_MAJOR`` + Python major version. +``Python_VERSION_MINOR`` + Python minor version. +``Python_VERSION_PATCH`` + Python patch version. + +Hints +^^^^^ + +``Python_ROOT_DIR`` + Define the root directory of a Python installation. + +``Python_USE_STATIC_LIBS`` + * If not defined, search for shared libraries and static libraries in that + order. + * If set to TRUE, search **only** for static libraries. + * If set to FALSE, search **only** for shared libraries. + +Commands +^^^^^^^^ + +This module defines the command ``Python_add_library`` which have the same +semantic as :command:`add_library` but take care of Python module naming rules +(only applied if library is of type ``MODULE``) and add dependency to target +``Python::Python``:: + + Python_add_library (my_module MODULE src1.cpp) + +If library type is not specified, ``MODULE`` is assumed. +#]=======================================================================] + + +set (_PYTHON_PREFIX Python) + +if (DEFINED Python_FIND_VERSION) + set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR}) + + include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) +else() + # iterate over versions in quiet and NOT required modes to avoid multiple + # "Found" messages and prematurally failure. + set (_Python_QUIETLY ${Python_FIND_QUIETLY}) + set (_Python_REQUIRED ${Python_FIND_REQUIRED}) + set (Python_FIND_QUIETLY TRUE) + set (Python_FIND_REQUIRED FALSE) + + foreach (_Python_REQUIRED_VERSION_MAJOR IN ITEMS 3 2) + set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR}) + include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) + if (Python_FOUND) + break() + endif() + # clean-up some CACHE variables to ensure look-up restart from scratch + foreach (_Python_ITEM IN ITEMS EXECUTABLE COMPILER + LIBRARY_RELEASE RUNTIME_LIBRARY_RELEASE + LIBRARY_DEBUG RUNTIME_LIBRARY_DEBUG + INCLUDE_DIR) + unset (Python_${_Python_ITEM} CACHE) + endforeach() + endforeach() + + unset (Python_FIND_VERSION) + + set (Python_FIND_QUIETLY ${_Python_QUIETLY}) + set (Python_FIND_REQUIRED ${_Python_REQUIRED}) + if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY) + # call again validation command to get "Found" or error message + find_package_handle_standard_args (Python HANDLE_COMPONENTS + REQUIRED_VARS ${_Python_REQUIRED_VARS} + VERSION_VAR Python_VERSION) + endif() +endif() + +if (COMMAND __Python_add_library) + macro (Python_add_library) + __Python_add_library (Python ${ARGV}) + endmacro() +endif() + +unset (_PYTHON_PREFIX) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake new file mode 100644 index 0000000..be34624 --- /dev/null +++ b/Modules/FindPython/Support.cmake @@ -0,0 +1,843 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# +# This file is a "template" file used by various FindPython modules. +# + +cmake_policy (VERSION 3.7) + +# +# Initial configuration +# +if (NOT DEFINED _PYTHON_PREFIX) + message (FATAL_ERROR "FindPython: INTERNAL ERROR") +endif() +if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + message (FATAL_ERROR "FindPython: INTERNAL ERROR") +endif() +if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 3) + set(_${_PYTHON_PREFIX}_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0) +elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL 2) + set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) +else() + message (FATAL_ERROR "FindPython: INTERNAL ERROR") +endif() + + +# +# helper commands +# +macro (_PYTHON_DISPLAY_FAILURE _PYTHON_MSG) + if (${_PYTHON_PREFIX}_FIND_REQUIRED) + message (FATAL_ERROR "${_PYTHON_MSG}") + else() + if (NOT ${_PYTHON_PREFIX}_FIND_QUIETLY) + message(STATUS "${_PYTHON_MSG}") + endif () + endif() + + set (${_PYTHON_PREFIX}_FOUND FALSE) + string (TOUPPER "${_PYTHON_PREFIX}" _${_PYTHON_PREFIX}_UPPER_PREFIX) + set (${_PYTHON_UPPER_PREFIX}_FOUND FALSE) + return() +endmacro() + + +function (_PYTHON_GET_FRAMEWORKS _PYTHON_PGF_FRAMEWORK_PATHS _PYTHON_VERSION) + set (_PYTHON_FRAMEWORK_PATHS) + foreach (_PYTHON_FRAMEWORK IN LISTS Python_FRAMEWORKS) + list (APPEND _PYTHON_FRAMEWORK_PATHS + "${_PYTHON_FRAMEWORK}/Versions/${_PYTHON_VERSION}") + endforeach() + set (${_PYTHON_PGF_FRAMEWORK_PATHS} ${_PYTHON_FRAMEWORK_PATHS} PARENT_SCOPE) +endfunction() + + +function (_PYTHON_FIND_RUNTIME_LIBRARY _PYTHON_LIB) + string (REPLACE "_RUNTIME" "" _PYTHON_LIB "${_PYTHON_LIB}") + # look at runtime part on systems supporting it + if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR + (CMAKE_SYSTEM_NAME MATCHES "MSYS|CYGWIN" + AND ${_PYTHON_LIB} MATCHES "${CMAKE_IMPORT_LIBRARY_SUFFIX}$")) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) + # MSYS has a special syntax for runtime libraries + if (CMAKE_SYSTEM_NAME MATCHES "MSYS") + list (APPEND CMAKE_FIND_LIBRARY_PREFIXES "msys-") + endif() + find_library (${ARGV}) + endif() +endfunction() + + +function (_PYTHON_SET_LIBRARY_DIRS _PYTHON_SLD_RESULT) + unset (_PYTHON_DIRS) + set (_PYTHON_LIBS ${ARGV}) + list (REMOVE_AT _PYTHON_LIBS 0) + foreach (_PYTHON_LIB IN LISTS _PYTHON_LIBS) + if (${_PYTHON_LIB}) + get_filename_component (_PYTHON_DIR "${${_PYTHON_LIB}}" DIRECTORY) + list (APPEND _PYTHON_DIRS "${_PYTHON_DIR}") + endif() + endforeach() + if (_PYTHON_DIRS) + list (REMOVE_DUPLICATES _PYTHON_DIRS) + endif() + set (${_PYTHON_SLD_RESULT} ${_PYTHON_DIRS} PARENT_SCOPE) +endfunction() + + +# If major version is specified, it must be the same as internal major version +if (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR + AND NOT ${_PYTHON_PREFIX}_FIND_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Wrong major version specified is \"${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}\", but expected major version is \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"") +endif() + + +# handle components +if (NOT ${_PYTHON_PREFIX}_FIND_COMPONENTS) + set (${_PYTHON_PREFIX}_FIND_COMPONENTS Interpreter) + set (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter TRUE) +endif() +foreach (_${_PYTHON_PREFIX}_COMPONENT IN LISTS ${_PYTHON_PREFIX}_FIND_COMPONENTS) + set (${_PYTHON_PREFIX}_${_${_PYTHON_PREFIX}_COMPONENT}_FOUND FALSE) +endforeach() +unset (_${_PYTHON_PREFIX}_FIND_VERSIONS) + +# Set versions to search +## default: search any version +set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSIONS}) + +if (${_PYTHON_PREFIX}_FIND_VERSION_COUNT GREATER 1) + if (${_PYTHON_PREFIX}_FIND_VERSION_EXACT) + set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_FIND_VERSION_MAJOR}.${${_PYTHON_PREFIX}_FIND_VERSION_MINOR}) + else() + unset (_${_PYTHON_PREFIX}_FIND_VERSIONS) + # add all compatible versions + foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_VERSIONS) + if (_${_PYTHON_PREFIX}_VERSION VERSION_GREATER_EQUAL ${_PYTHON_PREFIX}_FIND_VERSION) + list (APPEND _${_PYTHON_PREFIX}_FIND_VERSIONS ${_${_PYTHON_PREFIX}_VERSION}) + endif() + endforeach() + endif() +endif() + +# Anaconda distribution: define which architectures can be used +if (CMAKE_SIZEOF_VOID_P) + # In this case, search only for 64bit or 32bit + math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8") + set (_${_PYTHON_PREFIX}_ARCH2 ${_${_PYTHON_PREFIX}_ARCH}) +else() + # architecture unknown, search for both 64bit and 32bit + set (_${_PYTHON_PREFIX}_ARCH 64) + set (_${_PYTHON_PREFIX}_ARCH2 32) +endif() + +# IronPython support +if (CMAKE_SIZEOF_VOID_P) + # In this case, search only for 64bit or 32bit + math (EXPR _${_PYTHON_PREFIX}_ARCH "${CMAKE_SIZEOF_VOID_P} * 8") + set (_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES ipy${_${_PYTHON_PREFIX}_ARCH} ipy) +else() + # architecture unknown, search for natural interpreter + set (_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES ipy) +endif() + +# Apple frameworks handling +include (${CMAKE_CURRENT_LIST_DIR}/../CMakeFindFrameworks.cmake) +cmake_find_frameworks (Python) + +# Save CMAKE_FIND_FRAMEWORK +if (DEFINED CMAKE_FIND_FRAMEWORK) + set (_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) +else() + unset (_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK) +endif() +# To avoid picking up the system elements pre-maturely. +set (CMAKE_FIND_FRAMEWORK LAST) + + +unset (${_PYTHON_PREFIX}_VERSION_MAJOR) +unset (${_PYTHON_PREFIX}_VERSION_MINOR) +unset (${_PYTHON_PREFIX}_VERSION_PATCH) + +unset (_${_PYTHON_PREFIX}_REQUIRED_VARS) + + +# first step, search for the interpreter +if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE) + endif() + + set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) + + # look-up for various versions and locations + foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS) + string (REPLACE "." "" _${_PYTHON_PREFIX}_VERSION_NO_DOTS ${_${_PYTHON_PREFIX}_VERSION}) + + _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION}) + + # try using HINTS + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION} + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS} + PATH_SUFFIXES bin + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + # try using registry + if (WIN32) + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION} python + ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH2}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + PATH_SUFFIXES bin + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + endif() + # try in standard paths + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${_${_PYTHON_PREFIX}_VERSION}) + + if (${_PYTHON_PREFIX}_EXECUTABLE) + break() + endif() + endforeach() + + # try more generic names + find_program (${_PYTHON_PREFIX}_EXECUTABLE + NAMES python${${_PYTHON_PREFIX}_VERSION_MAJOR} python + ${_${_PYTHON_PREFIX}_IRON_PYTHON_NAMES} + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATH_SUFFIXES bin) + + # retrieve exact version of executable found + if (${_PYTHON_PREFIX}_EXECUTABLE) + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE ${_PYTHON_PREFIX}_VERSION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${${_PYTHON_PREFIX}_VERSION}") + list (GET _${_PYTHON_PREFIX}_VERSIONS 0 ${_PYTHON_PREFIX}_VERSION_MAJOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 1 ${_PYTHON_PREFIX}_VERSION_MINOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 2 ${_PYTHON_PREFIX}_VERSION_PATCH) + else() + # Interpreter is not usable + set (${_PYTHON_PREFIX}_EXECUTABLE ${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND CACHE INTERNAL "" FORCE) + unset (${_PYTHON_PREFIX}_VERSION) + endif() + endif() + + if (${_PYTHON_PREFIX}_EXECUTABLE + AND ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + set (${_PYTHON_PREFIX}_Interpreter_FOUND TRUE) + # Use interpreter version for future searchs to ensure consistency + set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}) + endif() + + if (${_PYTHON_PREFIX}_Interpreter_FOUND) + # retrieve interpreter identity + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -V + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID + ERROR_VARIABLE ${_PYTHON_PREFIX}_INTERPRETER_ID) + if (NOT _${_PYTHON_PREFIX}_RESULT) + if (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Anaconda") + set (${_PYTHON_PREFIX}_INTERPRETER_ID "Anaconda") + elseif (${_PYTHON_PREFIX}_INTERPRETER_ID MATCHES "Enthought") + set (${_PYTHON_PREFIX}_INTERPRETER_ID "Canopy") + else() + string (REGEX REPLACE "^([^ ]+).*" "\\1" ${_PYTHON_PREFIX}_INTERPRETER_ID "${${_PYTHON_PREFIX}_INTERPRETER_ID}") + if (${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "Python") + # try to get a more precise ID + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; print(sys.copyright)" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE ${_PYTHON_PREFIX}_COPYRIGHT + ERROR_QUIET) + if (${_PYTHON_PREFIX}_COPYRIGHT MATCHES "ActiveState") + set (${_PYTHON_PREFIX}_INTERPRETER_ID "ActivePython") + endif() + endif() + endif() + else() + set (${_PYTHON_PREFIX}_INTERPRETER_ID Python) + endif() + else() + unset (${_PYTHON_PREFIX}_INTERPRETER_ID) + endif() + + # retrieve various package installation directories + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c "import sys; from distutils import sysconfig;sys.stdout.write(';'.join([sysconfig.get_python_lib(plat_specific=False,standard_lib=True),sysconfig.get_python_lib(plat_specific=True,standard_lib=True),sysconfig.get_python_lib(plat_specific=False,standard_lib=False),sysconfig.get_python_lib(plat_specific=True,standard_lib=False)]))" + + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_LIBPATHS + ERROR_QUIET) + if (NOT _${_PYTHON_PREFIX}_RESULT) + list (GET _${_PYTHON_PREFIX}_LIBPATHS 0 ${_PYTHON_PREFIX}_STDLIB) + list (GET _${_PYTHON_PREFIX}_LIBPATHS 1 ${_PYTHON_PREFIX}_STDARCH) + list (GET _${_PYTHON_PREFIX}_LIBPATHS 2 ${_PYTHON_PREFIX}_SITELIB) + list (GET _${_PYTHON_PREFIX}_LIBPATHS 3 ${_PYTHON_PREFIX}_SITEARCH) + else() + unset (${_PYTHON_PREFIX}_STDLIB) + unset (${_PYTHON_PREFIX}_STDARCH) + unset (${_PYTHON_PREFIX}_SITELIB) + unset (${_PYTHON_PREFIX}_SITEARCH) + endif() + + mark_as_advanced (${_PYTHON_PREFIX}_EXECUTABLE) +endif() + + +# second step, search for compiler (IronPython) +if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) + if (${_PYTHON_PREFIX}_FIND_REQUIRED_Compiler) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_COMPILER) + endif() + + # IronPython specific artifacts + # If IronPython interpreter is found, use its path + unset (_${_PYTHON_PREFIX}_IRON_ROOT) + if (${_PYTHON_PREFIX}_Interpreter_FOUND AND ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython") + get_filename_component (_${_PYTHON_PREFIX}_IRON_ROOT "${${_PYTHON_PREFIX}_EXECUTABLE}" DIRECTORY) + endif() + + # try using root dir and registry + foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS) + find_program (${_PYTHON_PREFIX}_COMPILER + NAMES ipyc + HINTS ${_${_PYTHON_PREFIX}_IRON_ROOT} ${_${_PYTHON_PREFIX}_HINTS} + PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\IronPython\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + if (${_PYTHON_PREFIX}_COMPILER) + break() + endif() + endforeach() + # try in standard paths + find_program (${_PYTHON_PREFIX}_COMPILER + NAMES ipyc) + + if (${_PYTHON_PREFIX}_COMPILER) + # retrieve python environment version from compiler + set (_${_PYTHON_PREFIX}_VERSION_DIR "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PythonCompilerVersion.dir") + file (WRITE "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:3]]))\n") + execute_process (COMMAND "${${_PYTHON_PREFIX}_COMPILER}" /target:exe /embed "${_${_PYTHON_PREFIX}_VERSION_DIR}/version.py" + WORKING_DIRECTORY "${_${_PYTHON_PREFIX}_VERSION_DIR}" + OUTPUT_QUIET + ERROR_QUIET) + execute_process (COMMAND "${_${_PYTHON_PREFIX}_VERSION_DIR}/version" + WORKING_DIRECTORY "${_${_PYTHON_PREFIX}_VERSION_DIR}" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_VERSION + ERROR_QUIET) + if (NOT _${_PYTHON_PREFIX}_RESULT) + string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${_${_PYTHON_PREFIX}_VERSION}") + list (GET _${_PYTHON_PREFIX}_VERSIONS 0 _${_PYTHON_PREFIX}_VERSION_MAJOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 1 _${_PYTHON_PREFIX}_VERSION_MINOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 2 _${_PYTHON_PREFIX}_VERSION_PATCH) + + if (NOT ${_PYTHON_PREFIX}_Interpreter_FOUND) + # set public version information + set (${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_VERSION}) + set (${_PYTHON_PREFIX}_VERSION_MAJOR ${_${_PYTHON_PREFIX}_VERSION_MAJOR}) + set (${_PYTHON_PREFIX}_VERSION_MINOR ${_${_PYTHON_PREFIX}_VERSION_MINOR}) + set (${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_VERSION_PATCH}) + endif() + else() + # compiler not usable + set (${_PYTHON_PREFIX}_COMPILER ${_PYTHON_PREFIX}_COMPILER-NOTFOUND CACHE INTERNAL "" FORCE) + endif() + file (REMOVE_RECURSE "${_${_PYTHON_PREFIX}_VERSION_DIR}") + endif() + + if (${_PYTHON_PREFIX}_COMPILER) + if (${_PYTHON_PREFIX}_Interpreter_FOUND) + # Compiler must be compatible with interpreter + if (${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR} VERSION_EQUAL ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}) + set (${_PYTHON_PREFIX}_Compiler_FOUND TRUE) + endif() + elseif (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + set (${_PYTHON_PREFIX}_Compiler_FOUND TRUE) + # Use compiler version for future searchs to ensure consistency + set (_${_PYTHON_PREFIX}_FIND_VERSIONS ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}) + endif() + endif() + + if (${_PYTHON_PREFIX}_Compiler_FOUND) + set (${_PYTHON_PREFIX}_COMPILER_ID IronPython) + else() + unset (${_PYTHON_PREFIX}_COMPILER_ID) + endif() + + mark_as_advanced (${_PYTHON_PREFIX}_COMPILER) +endif() + + +# third step, search for the development artifacts +## Development environment is not compatible with IronPython interpreter +if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND NOT ${_PYTHON_PREFIX}_INTERPRETER_ID STREQUAL "IronPython") + if (${_PYTHON_PREFIX}_FIND_REQUIRED_Development) + list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_LIBRARY + ${_PYTHON_PREFIX}_INCLUDE_DIR) + endif() + + # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES + unset (_${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES) + if (DEFINED ${_PYTHON_PREFIX}_USE_STATIC_LIBS AND NOT WIN32) + set(_${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(${_PYTHON_PREFIX}_USE_STATIC_LIBS) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) + else() + list (REMOVE_ITEM CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + else() + endif() + + # if python interpreter is found, use its location and version to ensure consistency + # between interpreter and development environment + unset (_${_PYTHON_PREFIX}_PREFIX) + if (${_PYTHON_PREFIX}_Interpreter_FOUND) + execute_process (COMMAND "${${_PYTHON_PREFIX}_EXECUTABLE}" -c + "import sys; from distutils import sysconfig; sys.stdout.write(sysconfig.PREFIX)" + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_PREFIX + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_${_PYTHON_PREFIX}_RESULT) + unset (_${_PYTHON_PREFIX}_PREFIX) + endif() + endif() + set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_PREFIX}" "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) + + foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS) + string (REPLACE "." "" _${_PYTHON_PREFIX}_VERSION_NO_DOTS ${_${_PYTHON_PREFIX}_VERSION}) + + # try to use pythonX.Y-config tool + find_program (_${_PYTHON_PREFIX}_CONFIG + NAMES python${_${_PYTHON_PREFIX}_VERSION}-config + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATH_SUFFIXES bin) + + if (NOT _${_PYTHON_PREFIX}_CONFIG) + continue() + endif() + + # retrieve root install directory + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --prefix + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_PREFIX + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (_${_PYTHON_PREFIX}_RESULT) + # python-config is not usable + unset (_${_PYTHON_PREFIX}_CONFIG CACHE) + continue() + endif() + set (_${_PYTHON_PREFIX}_HINTS "${_${_PYTHON_PREFIX}_PREFIX}" "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR) + + # retrieve library + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + # retrieve library directory + string (REGEX MATCHALL "-L[^ ]+" _${_PYTHON_PREFIX}_LIB_DIRS "${_${_PYTHON_PREFIX}_FLAGS}") + string (REPLACE "-L" "" _${_PYTHON_PREFIX}_LIB_DIRS "${_${_PYTHON_PREFIX}_LIB_DIRS}") + list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_LIB_DIRS) + # retrieve library name + string (REGEX MATCHALL "-lpython[^ ]+" _${_PYTHON_PREFIX}_LIB_NAMES "${_${_PYTHON_PREFIX}_FLAGS}") + string (REPLACE "-l" "" _${_PYTHON_PREFIX}_LIB_NAMES "${_${_PYTHON_PREFIX}_LIB_NAMES}") + list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_LIB_NAMES) + + find_library (${_PYTHON_PREFIX}_LIBRARY_RELEASE + NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES} + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} ${_${_PYTHON_PREFIX}_LIB_DIRS} + PATH_SUFFIXES lib + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + # retrieve runtime library + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE) + get_filename_component (_${_PYTHON_PREFIX}_PATH "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY) + _python_find_runtime_library (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE + NAMES ${_${_PYTHON_PREFIX}_LIB_NAMES} + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_PATH} ${_${_PYTHON_PREFIX}_HINTS} + PATH_SUFFIXES bin + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + endif() + endif() + + # retrieve include directory + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --includes + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + # retrieve include directory + string (REGEX MATCHALL "-I[^ ]+" _${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_FLAGS}") + string (REPLACE "-I" "" _${_PYTHON_PREFIX}_INCLUDE_DIRS "${_${_PYTHON_PREFIX}_INCLUDE_DIRS}") + list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_INCLUDE_DIRS) + + find_path (${_PYTHON_PREFIX}_INCLUDE_DIR + NAMES Python.h + HINTS ${_${_PYTHON_PREFIX}_INCLUDE_DIRS} + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + endif() + + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_INCLUDE_DIR) + break() + endif() + endforeach() + + # Rely on HINTS and standard paths if config tool failed to locate artifacts + if (NOT (${_PYTHON_PREFIX}_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG) OR NOT ${_PYTHON_PREFIX}_INCLUDE_DIR) + foreach (_${_PYTHON_PREFIX}_VERSION IN LISTS _${_PYTHON_PREFIX}_FIND_VERSIONS) + string (REPLACE "." "" _${_PYTHON_PREFIX}_VERSION_NO_DOTS ${_${_PYTHON_PREFIX}_VERSION}) + + _python_get_frameworks (_${_PYTHON_PREFIX}_FRAMEWORK_PATHS ${_${_PYTHON_PREFIX}_VERSION}) + + find_library (${_PYTHON_PREFIX}_LIBRARY_RELEASE + NAMES python${_${_PYTHON_PREFIX}_VERSION_NO_DOTS} + python${_${_PYTHON_PREFIX}_VERSION}mu + python${_${_PYTHON_PREFIX}_VERSION}m + python${_${_PYTHON_PREFIX}_VERSION}u + python${_${_PYTHON_PREFIX}_VERSION} + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS} + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + PATH_SUFFIXES lib libs + lib/python${_${_PYTHON_PREFIX}_VERSION}/config-${_${_PYTHON_PREFIX}_VERSION}mu + lib/python${_${_PYTHON_PREFIX}_VERSION}/config-${_${_PYTHON_PREFIX}_VERSION}m + lib/python${_${_PYTHON_PREFIX}_VERSION}/config-${_${_PYTHON_PREFIX}_VERSION}u + lib/python${_${_PYTHON_PREFIX}_VERSION}/config-${_${_PYTHON_PREFIX}_VERSION} + lib/python${_${_PYTHON_PREFIX}_VERSION}/config) + # retrieve runtime library + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE) + get_filename_component (_${_PYTHON_PREFIX}_PATH "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY) + _python_find_runtime_library (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE + NAMES python${_${_PYTHON_PREFIX}_VERSION_NO_DOTS} + python${_${_PYTHON_PREFIX}_VERSION}mu + python${_${_PYTHON_PREFIX}_VERSION}m + python${_${_PYTHON_PREFIX}_VERSION}u + python${_${_PYTHON_PREFIX}_VERSION} + NAMES_PER_DIR + HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS} + PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS} + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + PATH_SUFFIXES bin) + endif() + + if (WIN32) + # search for debug library + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE) + # use library location as a hint + get_filename_component (_${_PYTHON_PREFIX}_PATH "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" DIRECTORY) + find_library (${_PYTHON_PREFIX}_LIBRARY_DEBUG + NAMES python${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}_d + NAMES_PER_DIR + HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS} + NO_DEFAULT_PATH) + else() + find_library (${_PYTHON_PREFIX}_LIBRARY_DEBUG + NAMES python${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}_d + NAMES_PER_DIR + HINTS ${_${_PYTHON_PREFIX}_HINTS} + PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + PATH_SUFFIXES lib libs) + endif() + if (${_PYTHON_PREFIX}_LIBRARY_DEBUG) + get_filename_component (_${_PYTHON_PREFIX}_PATH "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}" DIRECTORY) + _python_find_runtime_library (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG + NAMES python${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}_d + NAMES_PER_DIR + HINTS "${_${_PYTHON_PREFIX}_PATH}" ${_${_PYTHON_PREFIX}_HINTS} + PATHS [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + PATH_SUFFIXES bin) + endif() + endif() + + # Don't search for include dir until library location is known + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + unset (_${_PYTHON_PREFIX}_INCLUDE_HINTS) + foreach (_${_PYTHON_PREFIX}_LIB IN ITEMS ${_PYTHON_PREFIX}_LIBRARY_RELEASE ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + if (${_${_PYTHON_PREFIX}_LIB}) + # Use the library's install prefix as a hint + if (${_${_PYTHON_PREFIX}_LIB} MATCHES "^(.+/Frameworks/Python.framework/Versions/[0-9.]+)") + list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}") + elseif (${_${_PYTHON_PREFIX}_LIB} MATCHES "^(.+)/lib(64|32)?/python[0-9.]+/config") + list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${CMAKE_MATCH_1}") + else() + # assume library is in a directory under root + get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${${_${_PYTHON_PREFIX}_LIB}}" DIRECTORY) + get_filename_component (_${_PYTHON_PREFIX}_PREFIX "${_${_PYTHON_PREFIX}_PREFIX}" DIRECTORY) + list (APPEND _${_PYTHON_PREFIX}_INCLUDE_HINTS "${_${_PYTHON_PREFIX}_PREFIX}") + endif() + endif() + endforeach() + list (REMOVE_DUPLICATES _${_PYTHON_PREFIX}_INCLUDE_HINTS) + + find_path (${_PYTHON_PREFIX}_INCLUDE_DIR + NAMES Python.h + HINTS ${_${_PYTHON_PREFIX}_INCLUDE_HINTS} ${_${_PYTHON_PREFIX}_HINTS} + PATHS ${_${_PYTHON_PREFIX}_FRAMEWORK_PATHS} + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_CURRENT_USER\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_${_PYTHON_PREFIX}_VERSION}\\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\ContinuumAnalytics\\Anaconda${_${_PYTHON_PREFIX}_VERSION_NO_DOTS}-${_${_PYTHON_PREFIX}_ARCH}\\InstallPath] + PATH_SUFFIXES include/python${_${_PYTHON_PREFIX}_VERSION}mu + include/python${_${_PYTHON_PREFIX}_VERSION}m + include/python${_${_PYTHON_PREFIX}_VERSION}u + include/python${_${_PYTHON_PREFIX}_VERSION} + include + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH) + endif() + + if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG) AND ${_PYTHON_PREFIX}_INCLUDE_DIR) + break() + endif() + endforeach() + + # search header file in standard locations + find_path (${_PYTHON_PREFIX}_INCLUDE_DIR + NAMES Python.h) + endif() + + if (${_PYTHON_PREFIX}_INCLUDE_DIR) + # retrieve version from header file + file (STRINGS "${${_PYTHON_PREFIX}_INCLUDE_DIR}/patchlevel.h" _${_PYTHON_PREFIX}_VERSION + REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") + string (REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" + _${_PYTHON_PREFIX}_VERSION "${_${_PYTHON_PREFIX}_VERSION}") + string (REGEX MATCHALL "[0-9]+" _${_PYTHON_PREFIX}_VERSIONS "${_${_PYTHON_PREFIX}_VERSION}") + list (GET _${_PYTHON_PREFIX}_VERSIONS 0 _${_PYTHON_PREFIX}_VERSION_MAJOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 1 _${_PYTHON_PREFIX}_VERSION_MINOR) + list (GET _${_PYTHON_PREFIX}_VERSIONS 2 _${_PYTHON_PREFIX}_VERSION_PATCH) + + if (NOT ${_PYTHON_PREFIX}_Interpreter_FOUND AND NOT ${_PYTHON_PREFIX}_Compiler_FOUND) + # set public version information + set (${_PYTHON_PREFIX}_VERSION ${_${_PYTHON_PREFIX}_VERSION}) + set (${_PYTHON_PREFIX}_VERSION_MAJOR ${_${_PYTHON_PREFIX}_VERSION_MAJOR}) + set (${_PYTHON_PREFIX}_VERSION_MINOR ${_${_PYTHON_PREFIX}_VERSION_MINOR}) + set (${_PYTHON_PREFIX}_VERSION_PATCH ${_${_PYTHON_PREFIX}_VERSION_PATCH}) + endif() + endif() + + # define public variables + include (${CMAKE_CURRENT_LIST_DIR}/../SelectLibraryConfigurations.cmake) + select_library_configurations (${_PYTHON_PREFIX}) + if (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE) + set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}") + elseif (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}") + else() + set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY "$${_PYTHON_PREFIX}_RUNTIME_LIBRARY-NOTFOUND") + endif() + + _python_set_library_dirs (${_PYTHON_PREFIX}_LIBRARY_DIRS + ${_PYTHON_PREFIX}_LIBRARY_RELEASE ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + if (UNIX) + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" + OR ${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$") + set (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS ${${_PYTHON_PREFIX}_LIBRARY_DIRS}) + endif() + else() + _python_set_library_dirs (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DIRS + ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + endif() + + set (${_PYTHON_PREFIX}_INCLUDE_DIRS "${${_PYTHON_PREFIX}_INCLUDE_DIR}") + + mark_as_advanced (${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE + ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG + ${_PYTHON_PREFIX}_INCLUDE_DIR) + + if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + AND ${_PYTHON_PREFIX}_INCLUDE_DIR) + if (${_PYTHON_PREFIX}_Interpreter_FOUND OR ${_PYTHON_PREFIX}_Compiler_FOUND) + # devlopment environment must be compatible with interpreter/compiler + if (${_${_PYTHON_PREFIX}_VERSION_MAJOR}.${_${_PYTHON_PREFIX}_VERSION_MINOR} VERSION_EQUAL ${${_PYTHON_PREFIX}_VERSION_MAJOR}.${${_PYTHON_PREFIX}_VERSION_MINOR}) + set (${_PYTHON_PREFIX}_Development_FOUND TRUE) + endif() + elseif (${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + set (${_PYTHON_PREFIX}_Development_FOUND TRUE) + endif() + endif() + + # Restore the original find library ordering + if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES) + set (CMAKE_FIND_LIBRARY_SUFFIXES ${_${_PYTHON_PREFIX}_CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +endif() + +# final validation +if (${_PYTHON_PREFIX}_VERSION_MAJOR AND + NOT ${_PYTHON_PREFIX}_VERSION_MAJOR VERSION_EQUAL _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR) + _python_display_failure ("Could NOT find ${_PYTHON_PREFIX}: Found unsuitable major version \"${${_PYTHON_PREFIX}_VERSION_MAJOR}\", but required major version is exact version \"${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}\"") +endif() + +include (${CMAKE_CURRENT_LIST_DIR}/../FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args (${_PYTHON_PREFIX} + REQUIRED_VARS ${_${_PYTHON_PREFIX}_REQUIRED_VARS} + VERSION_VAR ${_PYTHON_PREFIX}_VERSION + HANDLE_COMPONENTS) + +# Create imported targets and helper functions +if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Interpreter_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter) + add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::Interpreter + PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}") +endif() + +if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Compiler_FOUND + AND NOT TARGET ${_PYTHON_PREFIX}::Compiler) + add_executable (${_PYTHON_PREFIX}::Compiler IMPORTED) + set_property (TARGET ${_PYTHON_PREFIX}::Compiler + PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_COMPILER}") +endif() + +if ("Development" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS + AND ${_PYTHON_PREFIX}_Development_FOUND AND NOT TARGET ${_PYTHON_PREFIX}::Python) + + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" + OR ${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "${CMAKE_SHARED_LIBRARY_SUFFIX}$" + OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE OR ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG) + set (_${_PYTHON_PREFIX}_LIBRARY_TYPE SHARED) + else() + set (_${_PYTHON_PREFIX}_LIBRARY_TYPE STATIC) + endif() + + add_library (${_PYTHON_PREFIX}::Python ${_${_PYTHON_PREFIX}_LIBRARY_TYPE} IMPORTED) + + set_property (TARGET ${_PYTHON_PREFIX}::Python + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${_PYTHON_PREFIX}_INCLUDE_DIR}") + + if ((${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE) + OR (${_PYTHON_PREFIX}_LIBRARY_DEBUG AND ${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG)) + # System manage shared libraries in two parts: import and runtime + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_IMPLIB_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}" + IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_RELEASE}") + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_IMPLIB_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}" + IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY_DEBUG}") + else() + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_IMPLIB "${${_PYTHON_PREFIX}_LIBRARY}" + IMPORTED_LOCATION "${${_PYTHON_PREFIX}_RUNTIME_LIBRARY}") + endif() + else() + if (${_PYTHON_PREFIX}_LIBRARY_RELEASE AND ${_PYTHON_PREFIX}_LIBRARY_DEBUG) + set_property (TARGET ${_PYTHON_PREFIX}::Python PROPERTY IMPORTED_CONFIGURATIONS RELEASE DEBUG) + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + IMPORTED_LOCATION_RELEASE "${${_PYTHON_PREFIX}_LIBRARY_RELEASE}") + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_LIBRARY_DEBUG}") + else() + set_target_properties (${_PYTHON_PREFIX}::Python + PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${${_PYTHON_PREFIX}_LIBRARY}") + endif() + endif() + + if (_${_PYTHON_PREFIX}_CONFIG AND _${_PYTHON_PREFIX}_LIBRARY_TYPE STREQUAL "STATIC") + # extend link information with dependent libraries + execute_process (COMMAND "${_${_PYTHON_PREFIX}_CONFIG}" --ldflags + RESULT_VARIABLE _${_PYTHON_PREFIX}_RESULT + OUTPUT_VARIABLE _${_PYTHON_PREFIX}_FLAGS + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (NOT _${_PYTHON_PREFIX}_RESULT) + string (REGEX MATCHALL "-[Ll][^ ]+" _${_PYTHON_PREFIX}_LINK_LIBRARIES "${_${_PYTHON_PREFIX}_FLAGS}") + # remove elements relative to python library itself + list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-lpython") + foreach (_${_PYTHON_PREFIX}_DIR IN LISTS ${_PYTHON_PREFIX}_LIBRARY_DIRS) + list (FILTER _${_PYTHON_PREFIX}_LINK_LIBRARIES EXCLUDE REGEX "-L${${_PYTHON_PREFIX}_DIR}") + endforeach() + set_property (TARGET ${_PYTHON_PREFIX}::Python + PROPERTY INTERFACE_LINK_LIBRARIES ${_${_PYTHON_PREFIX}_LINK_LIBRARIES}) + endif() + endif() + + # + # PYTHON_ADD_LIBRARY ( [STATIC|SHARED|MODULE] src1 src2 ... srcN) + # It is used to build modules for python. + # + function (__${_PYTHON_PREFIX}_ADD_LIBRARY prefix name) + cmake_parse_arguments (PARSE_ARGV 2 PYTHON_ADD_LIBRARY + "STATIC;SHARED;MODULE" "" "") + + unset (type) + if (NOT (PYTHON_ADD_LIBRARY_STATIC + OR PYTHON_ADD_LIBRARY_SHARED + OR PYTHON_ADD_LIBRARY_MODULE)) + set (type MODULE) + endif() + add_library (${name} ${type} ${ARGN}) + target_link_libraries (${name} PRIVATE ${prefix}::Python) + + # customize library name to follow module name rules + get_property (type TARGET ${name} PROPERTY TYPE) + if (type STREQUAL "MODULE_LIBRARY") + set_property (TARGET ${name} PROPERTY PREFIX "") + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set_property (TARGET ${name} PROPERTY SUFFIX ".pyd") + endif() + endif() + endfunction() +endif() + +# final clean-up + +# Restore CMAKE_FIND_FRAMEWORK +if (DEFINED _${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK) + set (CMAKE_FIND_FRAMEWORK ${_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK}) + unset (_${_PYTHON_PREFIX}_CMAKE_FIND_FRAMEWORK) +else() + unset (CMAKE_FIND_FRAMEWORK) +endif() + +unset (_${_PYTHON_PREFIX}_CONFIG CACHE) diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake new file mode 100644 index 0000000..22e9a8f --- /dev/null +++ b/Modules/FindPython2.cmake @@ -0,0 +1,146 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPython2 +----------- + +Find Python 2 interpreter, compiler and development environment (include +directories and libraries). + +Three components are supported: + +* ``Interpreter``: search for Python 2 interpreter +* ``Compiler``: search for Python 2 compiler. Only offered by IronPython. +* ``Development``: search for development artifacts (include directories and + libraries) + +If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. + +To ensure consistent versions between components ``Interpreter``, ``Compiler`` +and ``Development``, specify all components at the same time:: + + find_package (Python2 COMPONENTS Interpreter Development) + +This module looks only for version 2 of Python. This module can be used +concurrently with :module:`FindPython3` module to use both Python versions. + +The :module:`FindPython` module can be used if Python version does not matter +for you. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines the following :ref:`Imported Targets `: + +``Python2::Interpreter`` + Python 2 interpreter. Target defined if component ``Interpreter`` is found. +``Python2::Compiler`` + Python 2 compiler. Target defined if component ``Compiler`` is found. +``Python2::Python`` + Python 2 library. Target defined if component ``Development`` is found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project +(see :ref:`Standard Variable Names `): + +``Python2_FOUND`` + System has the Python 2 requested components. +``Python2_Interpreter_FOUND`` + System has the Python 2 interpreter. +``Python2_EXECUTABLE`` + Path to the Python 2 interpreter. +``Python2_INTERPRETER_ID`` + A short string unique to the interpreter. Possible values include: + * Python + * ActivePython + * Anaconda + * Canopy + * IronPython +``Python2_STDLIB`` + Standard platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. +``Python2_STDARCH`` + Standard platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. +``Python2_SITELIB`` + Third-party platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. +``Python2_SITEARCH`` + Third-party platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. +``Python2_Compiler_FOUND`` + System has the Python 2 compiler. +``Python2_COMPILER`` + Path to the Python 2 compiler. Only offered by IronPython. +``Python2_COMPILER_ID`` + A short string unique to the compiler. Possible values include: + * IronPython +``Python2_Development_FOUND`` + System has the Python 2 development artifacts. +``Python2_INCLUDE_DIRS`` + The Python 2 include directories. +``Python2_LIBRARIES`` + The Python 2 libraries. +``Python2_LIBRARY_DIRS`` + The Python 2 library directories. +``Python2_RUNTIME_LIBRARY_DIRS`` + The Python 2 runtime library directories. +``Python2_VERSION`` + Python 2 version. +``Python2_VERSION_MAJOR`` + Python 2 major version. +``Python2_VERSION_MINOR`` + Python 2 minor version. +``Python2_VERSION_PATCH`` + Python 2 patch version. + +Hints +^^^^^ + +``Python2_ROOT_DIR`` + Define the root directory of a Python 2 installation. + +``Python2_USE_STATIC_LIBS`` + * If not defined, search for shared libraries and static libraries in that + order. + * If set to TRUE, search **only** for static libraries. + * If set to FALSE, search **only** for shared libraries. + +Commands +^^^^^^^^ + +This module defines the command ``Python2_add_library`` which have the same +semantic as :command:`add_library` but take care of Python module naming rules +(only applied if library is of type ``MODULE``) and add dependency to target +``Python2::Python``:: + + Python2_add_library (my_module MODULE src1.cpp) + +If library type is not specified, ``MODULE`` is assumed. +#]=======================================================================] + + +set (_PYTHON_PREFIX Python2) + +set (_Python2_REQUIRED_VERSION_MAJOR 2) + +include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) + +if (COMMAND __Python2_add_library) + macro (Python2_add_library) + __Python2_add_library (Python2 ${ARGV}) + endmacro() +endif() + +unset (_PYTHON_PREFIX) diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake new file mode 100644 index 0000000..99c159b --- /dev/null +++ b/Modules/FindPython3.cmake @@ -0,0 +1,146 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPython3 +----------- + +Find Python 3 interpreter, compiler and development environment (include +directories and libraries). + +Three components are supported: + +* ``Interpreter``: search for Python 3 interpreter +* ``Compiler``: search for Python 3 compiler. Only offered by IronPython. +* ``Development``: search for development artifacts (include directories and + libraries) + +If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. + +To ensure consistent versions between components ``Interpreter``, ``Compiler`` +and ``Development``, specify all components at the same time:: + + find_package (Python3 COMPONENTS Interpreter Development) + +This module looks only for version 3 of Python. This module can be used +concurrently with :module:`FindPython2` module to use both Python versions. + +The :module:`FindPython` module can be used if Python version does not matter +for you. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines the following :ref:`Imported Targets `: + +``Python3::Interpreter`` + Python 3 interpreter. Target defined if component ``Interpreter`` is found. +``Python3::Compiler`` + Python 3 compiler. Target defined if component ``Compiler`` is found. +``Python3::Python`` + Python 3 library. Target defined if component ``Development`` is found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project +(see :ref:`Standard Variable Names `): + +``Python3_FOUND`` + System has the Python 3 requested components. +``Python3_Interpreter_FOUND`` + System has the Python 3 interpreter. +``Python3_EXECUTABLE`` + Path to the Python 3 interpreter. +``Python3_INTERPRETER_ID`` + A short string unique to the interpreter. Possible values include: + * Python + * ActivePython + * Anaconda + * Canopy + * IronPython +``Python3_STDLIB`` + Standard platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. +``Python3_STDARCH`` + Standard platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. +``Python3_SITELIB`` + Third-party platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. +``Python3_SITEARCH`` + Third-party platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. +``Python3_Compiler_FOUND`` + System has the Python 3 compiler. +``Python3_COMPILER`` + Path to the Python 3 compiler. Only offered by IronPython. +``Python3_COMPILER_ID`` + A short string unique to the compiler. Possible values include: + * IronPython +``Python3_Development_FOUND`` + System has the Python 3 development artifacts. +``Python3_INCLUDE_DIRS`` + The Python 3 include directories. +``Python3_LIBRARIES`` + The Python 3 libraries. +``Python3_LIBRARY_DIRS`` + The Python 3 library directories. +``Python3_RUNTIME_LIBRARY_DIRS`` + The Python 3 runtime library directories. +``Python3_VERSION`` + Python 3 version. +``Python3_VERSION_MAJOR`` + Python 3 major version. +``Python3_VERSION_MINOR`` + Python 3 minor version. +``Python3_VERSION_PATCH`` + Python 3 patch version. + +Hints +^^^^^ + +``Python3_ROOT_DIR`` + Define the root directory of a Python 3 installation. + +``Python3_USE_STATIC_LIBS`` + * If not defined, search for shared libraries and static libraries in that + order. + * If set to TRUE, search **only** for static libraries. + * If set to FALSE, search **only** for shared libraries. + +Commands +^^^^^^^^ + +This module defines the command ``Python3_add_library`` which have the same +semantic as :command:`add_library` but take care of Python module naming rules +(only applied if library is of type ``MODULE``) and add dependency to target +``Python3::Python``:: + + Python3_add_library (my_module MODULE src1.cpp) + +If library type is not specified, ``MODULE`` is assumed. +#]=======================================================================] + + +set (_PYTHON_PREFIX Python3) + +set (_Python3_REQUIRED_VERSION_MAJOR 3) + +include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) + +if (COMMAND __Python3_add_library) + macro (Python3_add_library) + __Python3_add_library (Python3 ${ARGV}) + endmacro() +endif() + +unset (_PYTHON_PREFIX) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 3ef8e9f..bd64762 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -7,6 +7,10 @@ # # Find python interpreter # +# .. deprecated:: 3.12 +# +# Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. +# # This module finds if Python interpreter is installed and determines # where the executables are. This code sets the following variables: # diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 341d5d9..1a0cc2e 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -7,6 +7,10 @@ # # Find python libraries # +# .. deprecated:: 3.12 +# +# Use :module:`FindPython3`, :module:`FindPython2` or :module:`FindPython` instead. +# # This module finds if Python is installed and determines where the # include files and libraries are. It also determines what the name of # the library is. This code sets the following variables: diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 101502f..cdea217 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1427,6 +1427,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindXercesC) endif() + if(CMake_TEST_FindPython) + add_subdirectory(FindPython) + endif() + add_subdirectory(FindThreads) # Matlab module diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt new file mode 100644 index 0000000..639d29c --- /dev/null +++ b/Tests/FindPython/CMakeLists.txt @@ -0,0 +1,69 @@ +add_test(NAME FindPython.Python2 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2" + ${build_generator_args} + --build-project TestPython2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + +add_test(NAME FindPython.Python2Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2Fail" + ${build_generator_args} + --build-project TestPython2Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +set_tests_properties(FindPython.Python2Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)") + +add_test(NAME FindPython.Python3 COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3" + ${build_generator_args} + --build-project TestPython3 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + +add_test(NAME FindPython.Python3Fail COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Fail" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3Fail" + ${build_generator_args} + --build-project TestPython3Fail + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) +set_tests_properties(FindPython.Python3Fail PROPERTIES + PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)") + +add_test(NAME FindPython.Python COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/Python" + "${CMake_BINARY_DIR}/Tests/FindPython/Python" + ${build_generator_args} + --build-project TestPython + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) + +add_test(NAME FindPython.MultiplePackages COMMAND + ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages" + "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages" + ${build_generator_args} + --build-project TestMultiplePackages + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $ + ) diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt new file mode 100644 index 0000000..5c85155 --- /dev/null +++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestMultiplePackages C) + +find_package (Python2 REQUIRED COMPONENTS Interpreter Development) +find_package (Python3 REQUIRED COMPONENTS Interpreter Development) + +# Must find Python 3 +find_package (Python REQUIRED) + +if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE) + message (FATAL_ERROR + "Python interpreters do not match:\n" + " Python_EXECUTABLE='${Python_EXECUTABLE}'\n" + " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n" + ) +endif() + + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt new file mode 100644 index 0000000..bebd23f --- /dev/null +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython C) + +include(CTest) + +find_package(Python 3 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() + +Python_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt new file mode 100644 index 0000000..9622b6f --- /dev/null +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2 C) + +include(CTest) + +find_package(Python2 3 QUIET) +if (Python2_FOUND) + message (FATAL_ERROR "Wrong python version found: ${Python2_VERSION}") +endif() + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python2_FOUND) + message (FATAL_ERROR "Fail to found Python 2") +endif() + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") diff --git a/Tests/FindPython/Python2Fail/CMakeLists.txt b/Tests/FindPython/Python2Fail/CMakeLists.txt new file mode 100644 index 0000000..989688f --- /dev/null +++ b/Tests/FindPython/Python2Fail/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython2Fail C) + +include(CTest) + +find_package(Python2 REQUIRED COMPONENTS Interpreter Development foobar) + +Python2_add_library (spam2 MODULE ../spam.c) +target_compile_definitions (spam2 PRIVATE PYTHON2) + +add_test (NAME python2_spam2 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")") diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt new file mode 100644 index 0000000..cb86eae --- /dev/null +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3 C) + +include(CTest) + +find_package(Python3 2 QUIET) +if (Python3_FOUND) + message (FATAL_ERROR "Wrong python version found: ${Python3_VERSION}") +endif() + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +if (NOT Python3_FOUND) + message (FATAL_ERROR "Fail to found Python 3") +endif() + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/Python3Fail/CMakeLists.txt b/Tests/FindPython/Python3Fail/CMakeLists.txt new file mode 100644 index 0000000..cd46c88 --- /dev/null +++ b/Tests/FindPython/Python3Fail/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestPython3Fail C) + +include(CTest) + +find_package(Python3 REQUIRED COMPONENTS Interpreter Development foobar) + +Python3_add_library (spam3 MODULE ../spam.c) +target_compile_definitions (spam3 PRIVATE PYTHON3) + +add_test (NAME python3_spam3 + COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$" + "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")") diff --git a/Tests/FindPython/spam.c b/Tests/FindPython/spam.c new file mode 100644 index 0000000..1c65d54 --- /dev/null +++ b/Tests/FindPython/spam.c @@ -0,0 +1,41 @@ + +#include + +static PyObject* spam_system(PyObject* self, PyObject* args) +{ + const char* command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + /* return PyLong_FromLong(sts); */ + return Py_BuildValue("i", sts); +} + +static PyMethodDef SpamMethods[] = { + { "system", spam_system, METH_VARARGS, "Execute a shell command." }, + { NULL, NULL, 0, NULL } /* Sentinel */ +}; + +#if defined(PYTHON2) +PyMODINIT_FUNC initspam2(void) +{ + (void)Py_InitModule("spam2", SpamMethods); +} +#endif + +#if defined(PYTHON3) +static struct PyModuleDef spammodule = { + PyModuleDef_HEAD_INIT, "spam3", /* name of module */ + NULL, /* module documentation, may be NULL */ + -1, /* size of per-interpreter state of the module, + or -1 if the module keeps state in global variables. */ + SpamMethods +}; + +PyMODINIT_FUNC PyInit_spam3(void) +{ + return PyModule_Create(&spammodule); +} +#endif diff --git a/Tests/RunCMake/UseSWIG/CMakeLists.txt b/Tests/RunCMake/UseSWIG/CMakeLists.txt index f452db1..2d75985 100644 --- a/Tests/RunCMake/UseSWIG/CMakeLists.txt +++ b/Tests/RunCMake/UseSWIG/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.4) +cmake_minimum_required(VERSION 3.1) project(${RunCMake_TEST} CXX) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/UseSWIG/MultiplePython.cmake b/Tests/RunCMake/UseSWIG/MultiplePython.cmake new file mode 100644 index 0000000..3804bdd --- /dev/null +++ b/Tests/RunCMake/UseSWIG/MultiplePython.cmake @@ -0,0 +1,26 @@ + +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +find_package(Python2 REQUIRED COMPONENTS Development) +find_package(Python3 REQUIRED COMPONENTS Development) + +unset(CMAKE_SWIG_FLAGS) + +set (CMAKE_INCLUDE_CURRENT_DIR ON) + +set_property(SOURCE example.i PROPERTY CPLUSPLUS ON) +set_property(SOURCE example.i PROPERTY COMPILE_OPTIONS -includeall) + +swig_add_library(example1 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python2" + SOURCES example.i example.cxx) +target_link_libraries(example1 PRIVATE Python2::Python) + +# re-use sample interface file for another plugin +swig_add_library(example2 + LANGUAGE python + OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python3" + SOURCES example.i example.cxx) +target_link_libraries(example2 PRIVATE Python3::Python) diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake index c63ff2e..cded22f 100644 --- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake @@ -10,8 +10,11 @@ function(run_SWIG test) set(RunCMake_TEST_NO_CLEAN 1) file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG) + set (RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Release) + endif() run_cmake(${test}) - run_cmake_command(${test}-test ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} ${_SWIG_TEST_TARGET}) + run_cmake_command(${test}-test ${CMAKE_COMMAND} --build ${RunCMake_TEST_BINARY_DIR} --config Release ${_SWIG_TEST_TARGET}) endfunction() run_SWIG(LegacyPython TARGET RunTest) @@ -21,3 +24,4 @@ run_SWIG(BasicPython TARGET RunTest) run_SWIG(BasicPerl TARGET RunTest) run_SWIG(MultipleModules) +run_SWIG(MultiplePython) ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-developer.7.rst | 2 + Help/manual/cmake-modules.7.rst | 3 + Help/module/FindPython.rst | 1 + Help/module/FindPython2.rst | 1 + Help/module/FindPython3.rst | 1 + Help/release/dev/FindPython-new-implementation.rst | 5 + Modules/FindCxxTest.cmake | 8 +- Modules/FindPython.cmake | 180 +++++ Modules/FindPython/Support.cmake | 843 ++++++++++++++++++++ Modules/FindPython2.cmake | 146 ++++ Modules/FindPython3.cmake | 146 ++++ Modules/FindPythonInterp.cmake | 4 + Modules/FindPythonLibs.cmake | 4 + Tests/CMakeLists.txt | 4 + Tests/FindPython/CMakeLists.txt | 69 ++ Tests/FindPython/MultiplePackages/CMakeLists.txt | 33 + Tests/FindPython/Python/CMakeLists.txt | 17 + Tests/FindPython/Python2/CMakeLists.txt | 22 + Tests/FindPython/Python2Fail/CMakeLists.txt | 14 + Tests/FindPython/Python3/CMakeLists.txt | 22 + Tests/FindPython/Python3Fail/CMakeLists.txt | 14 + Tests/FindPython/spam.c | 41 + Tests/RunCMake/UseSWIG/BasicConfiguration.cmake | 7 +- Tests/RunCMake/UseSWIG/BasicPython.cmake | 2 +- Tests/RunCMake/UseSWIG/CMakeLists.txt | 2 +- Tests/RunCMake/UseSWIG/MultiplePython.cmake | 26 + Tests/RunCMake/UseSWIG/RunCMakeTest.cmake | 6 +- Tests/Server/CMakeLists.txt | 4 +- 28 files changed, 1614 insertions(+), 13 deletions(-) create mode 100644 Help/module/FindPython.rst create mode 100644 Help/module/FindPython2.rst create mode 100644 Help/module/FindPython3.rst create mode 100644 Help/release/dev/FindPython-new-implementation.rst create mode 100644 Modules/FindPython.cmake create mode 100644 Modules/FindPython/Support.cmake create mode 100644 Modules/FindPython2.cmake create mode 100644 Modules/FindPython3.cmake create mode 100644 Tests/FindPython/CMakeLists.txt create mode 100644 Tests/FindPython/MultiplePackages/CMakeLists.txt create mode 100644 Tests/FindPython/Python/CMakeLists.txt create mode 100644 Tests/FindPython/Python2/CMakeLists.txt create mode 100644 Tests/FindPython/Python2Fail/CMakeLists.txt create mode 100644 Tests/FindPython/Python3/CMakeLists.txt create mode 100644 Tests/FindPython/Python3Fail/CMakeLists.txt create mode 100644 Tests/FindPython/spam.c create mode 100644 Tests/RunCMake/UseSWIG/MultiplePython.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 22 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 22 Mar 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-295-g9b3d395 Message-ID: <20180322040504.B984C10AE14@public.kitware.com> 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, master has been updated via 9b3d3952a8a0371504d120ed73444bfc52ae7f79 (commit) from a13cfa246fee1ba99eeecda8b8e8d158d29841df (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9b3d3952a8a0371504d120ed73444bfc52ae7f79 commit 9b3d3952a8a0371504d120ed73444bfc52ae7f79 Author: Kitware Robot AuthorDate: Thu Mar 22 00:01:06 2018 -0400 Commit: Kitware Robot CommitDate: Thu Mar 22 00:01:06 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 61d69bc..7402526 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180321) +set(CMake_VERSION_PATCH 20180322) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 22 08:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 22 Mar 2018 08:35:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-300-gd78d750 Message-ID: <20180322123505.97A4C10AF05@public.kitware.com> 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, master has been updated via d78d750c04f9d928afd7f29dcb66f854dc3bbe2b (commit) via a7ac0224250850e0e0f6ed3eff1bbbbabcd5d740 (commit) via 3f479a3ca30543a0d61ebf28d4934c401ffdaa55 (commit) via ff6234509e34269767b4f7d97a824e5899d0ba2a (commit) via 9cc97ab4dc647b1ca9b67bb7300453c8341607a7 (commit) from 9b3d3952a8a0371504d120ed73444bfc52ae7f79 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d78d750c04f9d928afd7f29dcb66f854dc3bbe2b commit d78d750c04f9d928afd7f29dcb66f854dc3bbe2b Merge: a7ac022 ff62345 Author: Brad King AuthorDate: Thu Mar 22 12:33:25 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 08:33:53 2018 -0400 Merge topic 'clarify_inherited_properties' ff6234509e Help: Clarify behavior of INHERITED properties 9cc97ab4dc Tests: Add tests for INHERITED property chaining Acked-by: Kitware Robot Merge-request: !1879 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7ac0224250850e0e0f6ed3eff1bbbbabcd5d740 commit a7ac0224250850e0e0f6ed3eff1bbbbabcd5d740 Merge: 9b3d395 3f479a3 Author: Brad King AuthorDate: Thu Mar 22 12:32:45 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 08:32:54 2018 -0400 Merge topic 'find-package_root-revise' 3f479a3ca3 find_package: Improve CMP0074 warning messages Acked-by: Kitware Robot Merge-request: !1880 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f479a3ca30543a0d61ebf28d4934c401ffdaa55 commit 3f479a3ca30543a0d61ebf28d4934c401ffdaa55 Author: Brad King AuthorDate: Wed Mar 21 07:44:18 2018 -0400 Commit: Brad King CommitDate: Wed Mar 21 07:51:20 2018 -0400 find_package: Improve CMP0074 warning messages Policy `CMP0074` was added by commit eb35d8884b (find_package: Use PackageName_ROOT variables as search prefixes, 2018-03-15). Revise the logic to avoid warning when a `PackageName_ROOT` variable is set to empty since that won't change the search behavior. Also, when we do warn include the variable value(s) for reference. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 1191490..5850f94 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -162,16 +162,22 @@ void cmMakefile::MaybeWarnCMP0074(std::string const& pkg) { // Warn if a _ROOT variable we may use is set. std::string const varName = pkg + "_ROOT"; - bool const haveVar = this->GetDefinition(varName) != nullptr; - bool const haveEnv = cmSystemTools::HasEnv(varName); + const char* var = this->GetDefinition(varName); + std::string env; + cmSystemTools::GetEnv(varName, env); + + bool const haveVar = var && *var; + bool const haveEnv = !env.empty(); if ((haveVar || haveEnv) && this->WarnedCMP0074.insert(varName).second) { std::ostringstream w; w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0074) << "\n"; if (haveVar) { - w << "CMake variable " << varName << " is set.\n"; + w << "CMake variable " << varName << " is set to:\n" + << " " << var << "\n"; } if (haveEnv) { - w << "Environment variable " << varName << " is set.\n"; + w << "Environment variable " << varName << " is set to:\n" + << " " << env << "\n"; } w << "For compatibility, CMake is ignoring the variable."; this->IssueMessage(cmake::AUTHOR_WARNING, w.str()); diff --git a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt index c762d92..27fbb86 100644 --- a/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt +++ b/Tests/RunCMake/find_package/CMP0074-WARN-stderr.txt @@ -7,9 +7,13 @@ CMake Warning \(dev\) at CMP0074-common.cmake:[0-9]+ \(find_package\): Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning. - CMake variable Foo_ROOT is set. + CMake variable Foo_ROOT is set to: - Environment variable Foo_ROOT is set. + .*/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root + + Environment variable Foo_ROOT is set to: + + .*/Tests/RunCMake/find_package/PackageRoot/foo/env_root For compatibility, CMake is ignoring the variable. Call Stack \(most recent call first\): https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ff6234509e34269767b4f7d97a824e5899d0ba2a commit ff6234509e34269767b4f7d97a824e5899d0ba2a Author: Craig Scott AuthorDate: Wed Mar 21 21:32:21 2018 +1100 Commit: Craig Scott CommitDate: Wed Mar 21 21:39:54 2018 +1100 Help: Clarify behavior of INHERITED properties Fixes: #17839 diff --git a/Help/command/define_property.rst b/Help/command/define_property.rst index 873c6ca..da2631c 100644 --- a/Help/command/define_property.rst +++ b/Help/command/define_property.rst @@ -34,10 +34,24 @@ actual scope needs to be given; only the kind of scope is important. The required ``PROPERTY`` option is immediately followed by the name of the property being defined. -If the ``INHERITED`` option then the :command:`get_property` command will -chain up to the next higher scope when the requested property is not set -in the scope given to the command. ``DIRECTORY`` scope chains to -``GLOBAL``. ``TARGET``, ``SOURCE``, and ``TEST`` chain to ``DIRECTORY``. +If the ``INHERITED`` option is given, then the :command:`get_property` command +will chain up to the next higher scope when the requested property is not set +in the scope given to the command. + +* ``DIRECTORY`` scope chains to its parent directory's scope, continuing the + walk up parent directories until a directory has the property set or there + are no more parents. If still not found at the top level directory, it + chains to the ``GLOBAL`` scope. +* ``TARGET``, ``SOURCE`` and ``TEST`` properties chain to ``DIRECTORY`` scope, + including further chaining up the directories, etc. as needed. + +Note that this scope chaining behavior only applies to calls to +:command:`get_property`, :command:`get_directory_property`, +:command:`get_target_property`, :command:`get_source_file_property` and +:command:`get_test_property`. There is no inheriting behavior when *setting* +properties, so using ``APPEND`` or ``APPEND_STRING`` with the +:command:`set_property` command will not consider inherited values when working +out the contents to append to. The ``BRIEF_DOCS`` and ``FULL_DOCS`` options are followed by strings to be associated with the property as its brief and full documentation. diff --git a/Help/command/get_directory_property.rst b/Help/command/get_directory_property.rst index e50abe0..bf8349c 100644 --- a/Help/command/get_directory_property.rst +++ b/Help/command/get_directory_property.rst @@ -7,11 +7,16 @@ Get a property of ``DIRECTORY`` scope. get_directory_property( [DIRECTORY ] ) -Store a property of directory scope in the named variable. If the -property is not defined the empty-string is returned. The ``DIRECTORY`` -argument specifies another directory from which to retrieve the -property value. The specified directory must have already been -traversed by CMake. +Store a property of directory scope in the named ````. +The ``DIRECTORY`` argument specifies another directory from which +to retrieve the property value instead of the current directory. +The specified directory must have already been traversed by CMake. + +If the property is not defined for the nominated directory scope, +an empty string is returned. In the case of ``INHERITED`` properties, +if the property is not found for the nominated directory scope, +the search will chain to a parent scope as described for the +:command:`define_property` command. :: diff --git a/Help/command/get_property.rst b/Help/command/get_property.rst index 632ece6..8b85f7d 100644 --- a/Help/command/get_property.rst +++ b/Help/command/get_property.rst @@ -50,7 +50,10 @@ be one of the following: The required ``PROPERTY`` option is immediately followed by the name of the property to get. If the property is not set an empty value is -returned. If the ``SET`` option is given the variable is set to a boolean +returned, although some properties support inheriting from a parent scope +if defined to behave that way (see :command:`define_property`). + +If the ``SET`` option is given the variable is set to a boolean value indicating whether the property has been set. If the ``DEFINED`` option is given the variable is set to a boolean value indicating whether the property has been defined such as with the diff --git a/Help/command/get_source_file_property.rst b/Help/command/get_source_file_property.rst index 3e975c2..648ecbd 100644 --- a/Help/command/get_source_file_property.rst +++ b/Help/command/get_source_file_property.rst @@ -8,9 +8,15 @@ Get a property for a source file. get_source_file_property(VAR file property) Get a property from a source file. The value of the property is -stored in the variable ``VAR``. If the property is not found, ``VAR`` -will be set to "NOTFOUND". Use :command:`set_source_files_properties` -to set property values. Source file properties usually control how the -file is built. One property that is always there is :prop_sf:`LOCATION` +stored in the variable ``VAR``. If the source property is not found, the +behavior depends on whether it has been defined to be an ``INHERITED`` property +or not (see :command:`define_property`). Non-inherited properties will set +``VAR`` to "NOTFOUND", whereas inheritied properties will search the relevent +parent scope as described for the :command:`define_property` command and +if still unable to find the property, ``VAR`` will be set to an empty string. + +Use :command:`set_source_files_properties` to set property values. Source +file properties usually control how the file is built. One property that is +always there is :prop_sf:`LOCATION`. See also the more general :command:`get_property` command. diff --git a/Help/command/get_target_property.rst b/Help/command/get_target_property.rst index 2a72c3a..3d159dc 100644 --- a/Help/command/get_target_property.rst +++ b/Help/command/get_target_property.rst @@ -8,8 +8,15 @@ Get a property from a target. get_target_property(VAR target property) Get a property from a target. The value of the property is stored in -the variable ``VAR``. If the property is not found, ``VAR`` will be set to -"NOTFOUND". Use :command:`set_target_properties` to set property values. +the variable ``VAR``. If the target property is not found, the behavior +depends on whether it has been defined to be an ``INHERITED`` property +or not (see :command:`define_property`). Non-inherited properties will +set ``VAR`` to "NOTFOUND", whereas inheritied properties will search the +relevent parent scope as described for the :command:`define_property` +command and if still unable to find the property, ``VAR`` will be set to +an empty string. + +Use :command:`set_target_properties` to set target property values. Properties are usually used to control how a target is built, but some query the target instead. This command can get properties for any target so far created. The targets do not need to be in the current diff --git a/Help/command/get_test_property.rst b/Help/command/get_test_property.rst index e359f4b..703efdc 100644 --- a/Help/command/get_test_property.rst +++ b/Help/command/get_test_property.rst @@ -8,8 +8,14 @@ Get a property of the test. get_test_property(test property VAR) Get a property from the test. The value of the property is stored in -the variable ``VAR``. If the test or property is not found, ``VAR`` will -be set to "NOTFOUND". For a list of standard properties you can type -``cmake --help-property-list``. +the variable ``VAR``. If the test property is not found, the behavior +depends on whether it has been defined to be an ``INHERITED`` property +or not (see :command:`define_property`). Non-inherited properties will +set ``VAR`` to "NOTFOUND", whereas inheritied properties will search the +relevent parent scope as described for the :command:`define_property` +command and if still unable to find the property, ``VAR`` will be set to +an empty string. + +For a list of standard properties you can type ``cmake --help-property-list``. See also the more general :command:`get_property` command. diff --git a/Help/command/set_property.rst b/Help/command/set_property.rst index 5ed788e..c89e1ce 100644 --- a/Help/command/set_property.rst +++ b/Help/command/set_property.rst @@ -59,11 +59,17 @@ be one of the following: The required ``PROPERTY`` option is immediately followed by the name of the property to set. Remaining arguments are used to compose the -property value in the form of a semicolon-separated list. If the -``APPEND`` option is given the list is appended to any existing property -value. If the ``APPEND_STRING`` option is given the string is append to any -existing property value as string, i.e. it results in a longer string -and not a list of strings. +property value in the form of a semicolon-separated list. + +If the ``APPEND`` option is given the list is appended to any existing +property value. If the ``APPEND_STRING`` option is given the string is +appended to any existing property value as string, i.e. it results in a +longer string and not a list of strings. When using ``APPEND`` or +``APPEND_STRING`` with a property defined to support ``INHERITED`` +behavior (see :command:`define_property`), no inheriting occurs when +finding the initial value to append to. If the property is not already +directly set in the nominated scope, the command will behave as though +``APPEND`` or ``APPEND_STRING`` had not been given. See the :manual:`cmake-properties(7)` manual for a list of properties in each scope. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9cc97ab4dc647b1ca9b67bb7300453c8341607a7 commit 9cc97ab4dc647b1ca9b67bb7300453c8341607a7 Author: Craig Scott AuthorDate: Wed Mar 21 20:35:38 2018 +1100 Commit: Craig Scott CommitDate: Wed Mar 21 21:38:47 2018 +1100 Tests: Add tests for INHERITED property chaining diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 5b5327d..b966e89 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -9,3 +9,4 @@ run_cmake(LINK_LIBRARIES) run_cmake(SOURCES) run_cmake(TYPE) run_cmake(USER_PROP) +run_cmake(USER_PROP_INHERITED) diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt b/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt new file mode 100644 index 0000000..dcb0f87 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt @@ -0,0 +1,29 @@ +-- TopDir-to-nothing chaining: '' +-- TopDir-to-global chaining: 'vGlobal' +-- TopDir no chaining required: 'vTopDir' +-- TopDir unset append chaining: 'aTopDir' +-- TopDir preset append chaining: 'vTopDir;aTopDir' +-- Subdir-to-parent chaining: 'vTopDir' +-- Subdir-to-global chaining: 'vGlobal' +-- Subdir no chaining required: 'vSubdir' +-- Subdir preset append chaining: 'vSubdir;aSubdir' +-- Subdir unset append chaining: 'aSubdir' +-- Subdir undefined append chaining: 'aSubdir' +-- Target-to-directory chaining: 'vTopDir' +-- Target unset append chaining: 'aTarget' +-- Target no chaining required: 'vTarget' +-- Target preset append chaining: 'vTarget;aTarget' +-- Target undefined get chaining: '' +-- Target undefined append chaining: 'aTarget' +-- Source-to-directory chaining: 'vTopDir' +-- Source unset append chaining: 'aSource' +-- Source no chaining required: 'vSource' +-- Source preset append chaining: 'vSource;aSource' +-- Source undefined get chaining: '' +-- Source undefined append chaining: 'aSource' +-- Test-to-directory chaining: 'vTopDir' +-- Test unset append chaining: 'aTest' +-- Test no chaining required: 'vTest' +-- Test preset append chaining: 'vTest;aTest' +-- Test undefined get chaining: '' +-- Test undefined append chaining: 'aTest' diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake b/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake new file mode 100644 index 0000000..2429866 --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake @@ -0,0 +1,83 @@ +# Needed for source property tests +enable_language(C) + +#================================================= +# Directory property chaining +#================================================= + +foreach(i RANGE 1 5) + foreach(propType DIRECTORY TARGET SOURCE TEST) + define_property(${propType} PROPERTY USER_PROP${i} INHERITED + BRIEF_DOCS "Brief" FULL_DOCS "Full" + ) + endforeach() +endforeach() + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "TopDir-to-nothing chaining: '${val}'") + +set_property(GLOBAL PROPERTY USER_PROP1 vGlobal) +set_property(GLOBAL PROPERTY USER_PROP2 vGlobal) +set_property(DIRECTORY PROPERTY USER_PROP2 vTopDir) +set_property(GLOBAL PROPERTY USER_PROP3 vGlobal) +set_property(DIRECTORY PROPERTY USER_PROP4 vTopDir) + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "TopDir-to-global chaining: '${val}'") + +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "TopDir no chaining required: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP3 aTopDir) +get_property(val DIRECTORY PROPERTY USER_PROP3) +message(STATUS "TopDir unset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP4 aTopDir) +get_property(val DIRECTORY PROPERTY USER_PROP4) +message(STATUS "TopDir preset append chaining: '${val}'") + +add_subdirectory(USER_PROP_INHERITED) + +#================================================= +# The other property types all chain the same way +#================================================= +macro(__chainToDirTests propType) + string(TOUPPER ${propType} propTypeUpper) + + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP2) + message(STATUS "${propType}-to-directory chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}1 APPEND PROPERTY USER_PROP2 a${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP2) + message(STATUS "${propType} unset append chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}1 PROPERTY USER_PROP1 v${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP1) + message(STATUS "${propType} no chaining required: '${val}'") + + set_property(${propTypeUpper} ${propType}1 APPEND PROPERTY USER_PROP1 a${propType}) + get_property(val ${propTypeUpper} ${propType}1 PROPERTY USER_PROP1) + message(STATUS "${propType} preset append chaining: '${val}'") + + get_property(val ${propTypeUpper} ${propType}2 PROPERTY USER_PROP5) + message(STATUS "${propType} undefined get chaining: '${val}'") + + set_property(${propTypeUpper} ${propType}2 APPEND PROPERTY USER_PROP5 a${propType}) + get_property(val ${propTypeUpper} ${propType}2 PROPERTY USER_PROP5) + message(STATUS "${propType} undefined append chaining: '${val}'") +endmacro() + +add_custom_target(Target1) +add_custom_target(Target2) +__chainToDirTests(Target) + +foreach(i RANGE 1 2) + set(Source${i} "${CMAKE_CURRENT_BINARY_DIR}/src${i}.c") + file(WRITE ${Source${i}} "int foo${i}() { return ${i}; }") +endforeach() +add_library(srcProps OBJECT ${Source1} ${Source2}) +__chainToDirTests(Source) + +add_test(NAME Test1 COMMAND ${CMAKE_COMMAND} -E touch_nocreate iDoNotExist) +add_test(NAME Test2 COMMAND ${CMAKE_COMMAND} -E touch_nocreate iDoNotExist) +__chainToDirTests(Test) diff --git a/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt b/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt new file mode 100644 index 0000000..234f4ee --- /dev/null +++ b/Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt @@ -0,0 +1,21 @@ +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "Subdir-to-parent chaining: '${val}'") + +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir-to-global chaining: '${val}'") + +set_property(DIRECTORY PROPERTY USER_PROP1 vSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir no chaining required: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP1 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP1) +message(STATUS "Subdir preset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP2 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP2) +message(STATUS "Subdir unset append chaining: '${val}'") + +set_property(DIRECTORY APPEND PROPERTY USER_PROP5 aSubdir) +get_property(val DIRECTORY PROPERTY USER_PROP5) +message(STATUS "Subdir undefined append chaining: '${val}'") ----------------------------------------------------------------------- Summary of changes: Help/command/define_property.rst | 22 +++++- Help/command/get_directory_property.rst | 15 ++-- Help/command/get_property.rst | 5 +- Help/command/get_source_file_property.rst | 14 +++- Help/command/get_target_property.rst | 11 ++- Help/command/get_test_property.rst | 12 ++- Help/command/set_property.rst | 16 ++-- Source/cmMakefile.cxx | 14 +++- .../RunCMake/find_package/CMP0074-WARN-stderr.txt | 8 +- Tests/RunCMake/set_property/RunCMakeTest.cmake | 1 + .../set_property/USER_PROP_INHERITED-stdout.txt | 29 +++++++ .../set_property/USER_PROP_INHERITED.cmake | 83 ++++++++++++++++++++ .../USER_PROP_INHERITED/CMakeLists.txt | 21 +++++ 13 files changed, 221 insertions(+), 30 deletions(-) create mode 100644 Tests/RunCMake/set_property/USER_PROP_INHERITED-stdout.txt create mode 100644 Tests/RunCMake/set_property/USER_PROP_INHERITED.cmake create mode 100644 Tests/RunCMake/set_property/USER_PROP_INHERITED/CMakeLists.txt hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 22 08:45:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 22 Mar 2018 08:45:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-306-g8aec07e Message-ID: <20180322124504.E25ED10A589@public.kitware.com> 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, master has been updated via 8aec07e0576a6121174a210dd3e3440a9f7105aa (commit) via 45ffb4ac79f9109ebf93980b091af839b7083b3c (commit) via a5eb7d1c11c9b50e2bad40d6fe58569d95f171ca (commit) via 99bf77f49c18f9947b2386c4f5b6308da793de9f (commit) via 1673923c303c6a4184904c4c5849911feddb87e7 (commit) via 5697c6ae03a32205ccbff7885c61a6f925513999 (commit) from d78d750c04f9d928afd7f29dcb66f854dc3bbe2b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8aec07e0576a6121174a210dd3e3440a9f7105aa commit 8aec07e0576a6121174a210dd3e3440a9f7105aa Merge: 45ffb4a 1673923 Author: Brad King AuthorDate: Thu Mar 22 12:40:35 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 08:40:42 2018 -0400 Merge topic 'boost-1.67' 1673923c30 FindBoost: Add support for Boost 1.67 with Python version suffixes Acked-by: Kitware Robot Merge-request: !1865 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45ffb4ac79f9109ebf93980b091af839b7083b3c commit 45ffb4ac79f9109ebf93980b091af839b7083b3c Merge: a5eb7d1 99bf77f Author: Brad King AuthorDate: Thu Mar 22 12:39:21 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 08:39:26 2018 -0400 Merge topic 'ccmake-revise-default' 99bf77f49c ccmake: Check for curses more robustly before enabling Acked-by: Kitware Robot Merge-request: !1881 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a5eb7d1c11c9b50e2bad40d6fe58569d95f171ca commit a5eb7d1c11c9b50e2bad40d6fe58569d95f171ca Merge: d78d750 5697c6a Author: Brad King AuthorDate: Thu Mar 22 12:35:11 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 08:35:17 2018 -0400 Merge topic 'vs-flags-improvement' 5697c6ae03 cmVisualStudioGeneratorOptions: Factor out an OutputFlag helper Acked-by: Kitware Robot Merge-request: !1862 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99bf77f49c18f9947b2386c4f5b6308da793de9f commit 99bf77f49c18f9947b2386c4f5b6308da793de9f Author: Brad King AuthorDate: Wed Mar 21 13:37:20 2018 -0400 Commit: Brad King CommitDate: Wed Mar 21 13:57:45 2018 -0400 ccmake: Check for curses more robustly before enabling Compute a default for `BUILD_CursesDialog` by building a small test project that uses curses. Disable `ccmake` by default if it fails, and do not search for Curses as part of the main build. This avoids creating FindCurses cache entries when we are not considering ccmake. If `BUILD_CursesDialog` is enabled (e.g. by the user) then warn if curses cannot be found. diff --git a/CMakeLists.txt b/CMakeLists.txt index 6623959..a27c662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,23 +573,25 @@ macro (CMAKE_BUILD_UTILITIES) #--------------------------------------------------------------------- # Use curses? if (UNIX) - # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex - if(NOT CMAKE_SYSTEM_NAME MATCHES syllable) - set(CURSES_NEED_NCURSES TRUE) - find_package(Curses QUIET) - if (CURSES_LIBRARY) - option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" ON) - else () - message("Curses libraries were not found. Curses GUI for CMake will not be built.") - set(BUILD_CursesDialog 0) - endif () - else() - set(BUILD_CursesDialog 0) + if(NOT DEFINED BUILD_CursesDialog) + include(${CMake_SOURCE_DIR}/Source/Checks/Curses.cmake) + option(BUILD_CursesDialog "Build the CMake Curses Dialog ccmake" "${CMakeCheckCurses_COMPILED}") endif() else () set(BUILD_CursesDialog 0) endif () if(BUILD_CursesDialog) + set(CURSES_NEED_NCURSES TRUE) + find_package(Curses) + if(NOT CURSES_FOUND) + message(WARNING + "'ccmake' will not be built because Curses was not found.\n" + "Turn off BUILD_CursesDialog to suppress this message." + ) + set(BUILD_CursesDialog 0) + endif() + endif() + if(BUILD_CursesDialog) if(NOT CMAKE_USE_SYSTEM_FORM) add_subdirectory(Source/CursesDialog/form) elseif(NOT CURSES_FORM_LIBRARY) diff --git a/Source/Checks/Curses.cmake b/Source/Checks/Curses.cmake new file mode 100644 index 0000000..46dc770 --- /dev/null +++ b/Source/Checks/Curses.cmake @@ -0,0 +1,41 @@ +message(STATUS "Checking for curses support") + +# Try compiling a simple project using curses. +# Pass in any cache entries that the user may have set. +set(CMakeCheckCurses_ARGS "") +foreach(v + CURSES_INCLUDE_PATH + CURSES_CURSES_LIBRARY + CURSES_NCURSES_LIBRARY + CURSES_EXTRA_LIBRARY + CURSES_FORM_LIBRARY + ) + if(${v}) + list(APPEND CMakeCheckCurses_ARGS -D${v}=${${v}}) + endif() +endforeach() +file(REMOVE_RECURSE "${CMake_BINARY_DIR}/Source/Checks/Curses-build") +try_compile(CMakeCheckCurses_COMPILED + ${CMake_BINARY_DIR}/Source/Checks/Curses-build + ${CMake_SOURCE_DIR}/Source/Checks/Curses + CheckCurses # project name + CheckCurses # target name + CMAKE_FLAGS + "-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}" + ${CMakeCheckCurses_ARGS} + OUTPUT_VARIABLE CMakeCheckCurses_OUTPUT + ) + +# Covnert result from cache entry to normal variable. +set(CMakeCheckCurses_COMPILED "${CMakeCheckCurses_COMPILED}") +unset(CMakeCheckCurses_COMPILED CACHE) + +if(CMakeCheckCurses_COMPILED) + message(STATUS "Checking for curses support - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking for curses support passed with the following output:\n${CMakeCheckCurses_OUTPUT}\n\n") +else() + message(STATUS "Checking for curses support - Failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking for curses support failed with the following output:\n${CMakeCheckCurses_OUTPUT}\n\n") +endif() diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt new file mode 100644 index 0000000..17318a3 --- /dev/null +++ b/Source/Checks/Curses/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.1) +if(POLICY CMP0060) + cmake_policy(SET CMP0060 NEW) +endif() +project(CheckCurses C) + +set(CURSES_NEED_NCURSES TRUE) +find_package(Curses) +if(NOT CURSES_FOUND) + return() +endif() +include_directories(${CURSES_INCLUDE_DIRS}) +add_executable(CheckCurses CheckCurses.c) +target_link_libraries(CheckCurses ${CURSES_LIBRARIES}) + +foreach(h + CURSES_HAVE_CURSES_H + CURSES_HAVE_NCURSES_H + CURSES_HAVE_NCURSES_NCURSES_H + CURSES_HAVE_NCURSES_CURSES_H + ) + if(${h}) + target_compile_definitions(CheckCurses PRIVATE ${h}) + endif() +endforeach() diff --git a/Source/Checks/Curses/CheckCurses.c b/Source/Checks/Curses/CheckCurses.c new file mode 100644 index 0000000..857ae28 --- /dev/null +++ b/Source/Checks/Curses/CheckCurses.c @@ -0,0 +1,15 @@ +#if defined(CURSES_HAVE_NCURSES_H) +#include +#elif defined(CURSES_HAVE_NCURSES_NCURSES_H) +#include +#elif defined(CURSES_HAVE_NCURSES_CURSES_H) +#include +#else +#include +#endif + +int main() +{ + curses_version(); + return 0; +} https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1673923c303c6a4184904c4c5849911feddb87e7 commit 1673923c303c6a4184904c4c5849911feddb87e7 Author: Roger Leigh AuthorDate: Sun Mar 18 13:05:35 2018 +0000 Commit: Brad King CommitDate: Wed Mar 21 13:34:17 2018 -0400 FindBoost: Add support for Boost 1.67 with Python version suffixes Fixes: #16612, #16335, #16391, #12955 diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 4a55588..8d44aee 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -10,7 +10,7 @@ # Use this module by invoking find_package with the form:: # # find_package(Boost -# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 +# [version] [EXACT] # Minimum or EXACT version e.g. 1.67.0 # [REQUIRED] # Fail with error if Boost is not found # [COMPONENTS ...] # Boost libraries by their canonical name # # e.g. "date_time" for "libboost_date_time" @@ -40,6 +40,15 @@ # information about Boost's automatic linking # displayed during compilation # +# Note that Boost Python components require a Python version suffix +# (Boost 1.67 and later), e.g. ``python36`` or ``python27`` for the +# versions built against Python 3.6 and 2.7, respectively. This also +# applies to additional components using Python including +# ``mpi_python`` and ``numpy``. Earlier Boost releases may use +# distribution-specific suffixes such as ``2``, ``3`` or ``2.7``. +# These may also be used as suffixes, but note that they are not +# portable. +# # This module reads hints about search locations from variables:: # # BOOST_ROOT - Preferred installation prefix @@ -156,7 +165,7 @@ # Boost_REALPATH - Set to ON to resolve symlinks for discovered # libraries to assist with packaging. For example, # the "system" component library may be resolved to -# "/usr/lib/libboost_system.so.1.42.0" instead of +# "/usr/lib/libboost_system.so.1.67.0" instead of # "/usr/lib/libboost_system.so". This does not # affect linking and should not be enabled unless # the user needs this information. @@ -190,6 +199,13 @@ # target_link_libraries(foo Boost::date_time Boost::filesystem # Boost::iostreams) # +# Example to find Boost Python 3.6 libraries and use imported targets:: +# +# find_package(Boost 1.67 REQUIRED COMPONENTS +# python36 numpy36) +# add_executable(foo foo.cc) +# target_link_libraries(foo Boost::python36 Boost::numpy36) +# # Example to find Boost headers and some *static* (release only) libraries:: # # set(Boost_USE_STATIC_LIBS ON) # only find static libs @@ -197,7 +213,7 @@ # set(Boost_USE_RELEASE_LIBS ON) # only find release libs # set(Boost_USE_MULTITHREADED ON) # set(Boost_USE_STATIC_RUNTIME OFF) -# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) +# find_package(Boost 1.66.0 COMPONENTS date_time filesystem system ...) # if(Boost_FOUND) # include_directories(${Boost_INCLUDE_DIRS}) # add_executable(foo foo.cc) @@ -559,6 +575,13 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) # required only if the BoostScanDeps.cmake script logic is changed. # The addition of a new release should only require it to be run # against the new release. + + # Handle Python version suffixes + if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") + set(component "${CMAKE_MATCH_1}") + set(component_python_version "${CMAKE_MATCH_2}") + endif() + set(_Boost_IMPORTED_TARGETS TRUE) if(Boost_VERSION VERSION_LESS 103300) message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)") @@ -776,8 +799,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - else() - if(NOT Boost_VERSION VERSION_LESS 106500) + elseif(NOT Boost_VERSION VERSION_LESS 106500 AND Boost_VERSION VERSION_LESS 106700) set(_Boost_CHRONO_DEPENDENCIES system) set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) set(_Boost_COROUTINE_DEPENDENCIES context system) @@ -791,10 +813,29 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_NUMPY_DEPENDENCIES python) set(_Boost_RANDOM_DEPENDENCIES system) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - endif() + else() if(NOT Boost_VERSION VERSION_LESS 106700) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono system) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + endif() + if(NOT Boost_VERSION VERSION_LESS 106800) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -820,6 +861,12 @@ endfunction() # _hdrs # function(_Boost_COMPONENT_HEADERS component _hdrs) + # Handle Python version suffixes + if(component MATCHES "^(python|mpi_python|numpy)([0-9][0-9]?|[0-9]\\.[0-9])\$") + set(component "${CMAKE_MATCH_1}") + set(component_python_version "${CMAKE_MATCH_2}") + endif() + # Note: new boost components will require adding here. The header # must be present in all versions of Boost providing a library. set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") @@ -1034,7 +1081,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" + "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" @@ -1613,7 +1660,44 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) endforeach() endif() + # Handle Python version suffixes + unset(COMPONENT_PYTHON_VERSION_MAJOR) + unset(COMPONENT_PYTHON_VERSION_MINOR) + if(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\$") + set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") + set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") + elseif(${COMPONENT} MATCHES "^(python|mpi_python|numpy)([0-9])\\.?([0-9])\$") + set(COMPONENT_UNVERSIONED "${CMAKE_MATCH_1}") + set(COMPONENT_PYTHON_VERSION_MAJOR "${CMAKE_MATCH_2}") + set(COMPONENT_PYTHON_VERSION_MINOR "${CMAKE_MATCH_3}") + endif() + + unset(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + if (COMPONENT_PYTHON_VERSION_MINOR) + # Boost >= 1.67 + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # Debian/Ubuntu (Some versions omit the 2 and/or 3 from the suffix) + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-py${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # Gentoo + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + # RPMs + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}-${COMPONENT_PYTHON_VERSION_MAJOR}${COMPONENT_PYTHON_VERSION_MINOR}") + endif() + if (COMPONENT_PYTHON_VERSION_MAJOR AND NOT COMPONENT_PYTHON_VERSION_MINOR) + # Boost < 1.67 + list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME "${COMPONENT_UNVERSIONED}${COMPONENT_PYTHON_VERSION_MAJOR}") + endif() + # Consolidate and report component-specific hints. + if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME) + if(Boost_DEBUG) + message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "Component-specific library search names for ${COMPONENT_NAME}: " + "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME}") + endif() + endif() if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) if(Boost_DEBUG) @@ -1643,28 +1727,30 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) # Find RELEASE libraries # unset(_boost_RELEASE_NAMES) - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) - endforeach() - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) endforeach() list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) - endif() + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endforeach() + list(APPEND _boost_RELEASE_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) + endif() + endforeach() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) + _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) endif() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " @@ -1693,27 +1779,29 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) # Find DEBUG libraries # unset(_boost_DEBUG_NAMES) - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) - endforeach() - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + foreach(component IN LISTS _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT_NAME COMPONENT) foreach(compiler IN LISTS _boost_COMPILER) list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) endforeach() list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) - endif() + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component} ) + if(_boost_STATIC_RUNTIME_WORKAROUND) + set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") + foreach(compiler IN LISTS _boost_COMPILER) + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endforeach() + list(APPEND _boost_DEBUG_NAMES + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}${_boost_ARCHITECTURE_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${component}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) + endif() + endforeach() if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5697c6ae03a32205ccbff7885c61a6f925513999 commit 5697c6ae03a32205ccbff7885c61a6f925513999 Author: Vitaly Stakhovsky AuthorDate: Fri Mar 16 11:20:08 2018 -0400 Commit: Brad King CommitDate: Tue Mar 20 14:10:04 2018 -0400 cmVisualStudioGeneratorOptions: Factor out an OutputFlag helper diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 2095d23..7d7000b 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -6,10 +6,14 @@ #include "cmSystemTools.h" #include "cmVisualStudio10TargetGenerator.h" +static void cmVS10EscapeForMSBuild(std::string& ret) +{ + cmSystemTools::ReplaceString(ret, ";", "%3B"); +} + static std::string cmVisualStudio10GeneratorOptionsEscapeForXML( std::string ret) { - cmSystemTools::ReplaceString(ret, ";", "%3B"); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "<", "<"); cmSystemTools::ReplaceString(ret, ">", ">"); @@ -440,6 +444,30 @@ void cmVisualStudioGeneratorOptions::SetConfiguration( this->Configuration = config; } +void cmVisualStudioGeneratorOptions::OutputFlag(std::ostream& fout, + const char* indent, + const char* tag, + const std::string& content) +{ + if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + if (!this->Configuration.empty()) { + // if there are configuration specific flags, then + // use the configuration specific tag for PreprocessorDefinitions + fout << indent; + this->TargetGenerator->WritePlatformConfigTag(tag, this->Configuration, + 0, 0, 0, &fout); + } else { + fout << indent << "<" << tag << ">"; + } + fout << cmVisualStudio10GeneratorOptionsEscapeForXML(content); + fout << ""; + } else { + fout << indent << tag << "=\""; + fout << cmVisualStudioGeneratorOptionsEscapeForXML(content); + fout << "\""; + } +} + void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( std::ostream& fout, const char* prefix, const char* suffix, const std::string& lang) @@ -451,19 +479,8 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( if (lang == "CUDA") { tag = "Defines"; } - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - // if there are configuration specific flags, then - // use the configuration specific tag for PreprocessorDefinitions - if (!this->Configuration.empty()) { - fout << prefix; - this->TargetGenerator->WritePlatformConfigTag( - tag, this->Configuration.c_str(), 0, 0, 0, &fout); - } else { - fout << prefix << "<" << tag << ">"; - } - } else { - fout << prefix << tag << "=\""; - } + + std::ostringstream oss; const char* sep = ""; std::vector::const_iterator de = cmRemoveDuplicates(this->Defines); @@ -472,29 +489,27 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( // Escape the definition for the compiler. std::string define; if (this->Version < cmGlobalVisualStudioGenerator::VS10) { - define = this->LocalGenerator->EscapeForShell(di->c_str(), true); + define = this->LocalGenerator->EscapeForShell(*di, true); } else { define = *di; } - // Escape this flag for the IDE. + // Escape this flag for the MSBuild. if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - define = cmVisualStudio10GeneratorOptionsEscapeForXML(define); - + cmVS10EscapeForMSBuild(define); if (lang == "RC") { cmSystemTools::ReplaceString(define, "\"", "\\\""); } - } else { - define = cmVisualStudioGeneratorOptionsEscapeForXML(define); } // Store the flag in the project file. - fout << sep << define; + oss << sep << define; sep = ";"; } if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - fout << ";%(" << tag << ")" << suffix; - } else { - fout << "\"" << suffix; + oss << ";%(" << tag << ")"; } + + this->OutputFlag(fout, prefix, tag, oss.str()); + fout << suffix; } void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( @@ -512,20 +527,7 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( tag = "IncludePaths"; } - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - // if there are configuration specific flags, then - // use the configuration specific tag for PreprocessorDefinitions - if (!this->Configuration.empty()) { - fout << prefix; - this->TargetGenerator->WritePlatformConfigTag( - tag, this->Configuration.c_str(), 0, 0, 0, &fout); - } else { - fout << prefix << "<" << tag << ">"; - } - } else { - fout << prefix << tag << "=\""; - } - + std::ostringstream oss; const char* sep = ""; for (std::string include : this->Includes) { // first convert all of the slashes @@ -539,55 +541,42 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( include += "\\"; } - // Escape this include for the IDE. - fout << sep << (this->Version >= cmGlobalVisualStudioGenerator::VS10 - ? cmVisualStudio10GeneratorOptionsEscapeForXML(include) - : cmVisualStudioGeneratorOptionsEscapeForXML(include)); + // Escape this include for the MSBuild. + if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + cmVS10EscapeForMSBuild(include); + } + oss << sep << include; sep = ";"; if (lang == "Fortran") { include += "/$(ConfigurationName)"; - fout << sep << (this->Version >= cmGlobalVisualStudioGenerator::VS10 - ? cmVisualStudio10GeneratorOptionsEscapeForXML(include) - : cmVisualStudioGeneratorOptionsEscapeForXML(include)); + oss << sep << include; } } if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - fout << sep << "%(" << tag << ")" << suffix; - } else { - fout << "\"" << suffix; + oss << sep << "%(" << tag << ")"; } + + this->OutputFlag(fout, prefix, tag, oss.str()); + fout << suffix; } void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, const char* indent) { - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - for (auto const& m : this->FlagMap) { - fout << indent; - if (!this->Configuration.empty()) { - this->TargetGenerator->WritePlatformConfigTag( - m.first.c_str(), this->Configuration.c_str(), 0, 0, 0, &fout); - } else { - fout << "<" << m.first << ">"; + for (auto const& m : this->FlagMap) { + std::ostringstream oss; + const char* sep = ""; + for (std::string i : m.second) { + if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { + cmVS10EscapeForMSBuild(i); } - const char* sep = ""; - for (std::string const& i : m.second) { - fout << sep << cmVisualStudio10GeneratorOptionsEscapeForXML(i); - sep = ";"; - } - fout << "\n"; - } - } else { - for (auto const& m : this->FlagMap) { - fout << indent << m.first << "=\""; - const char* sep = ""; - for (std::string const& i : m.second) { - fout << sep << cmVisualStudioGeneratorOptionsEscapeForXML(i); - sep = ";"; - } - fout << "\"\n"; + oss << sep << i; + sep = ";"; } + + this->OutputFlag(fout, indent, m.first.c_str(), oss.str()); + fout << "\n"; } } diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 5c3e415..517760a 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -94,6 +94,10 @@ public: void SetConfiguration(const std::string& config); private: + void OutputFlag(std::ostream& fout, const char* indent, const char* tag, + const std::string& content); + +private: cmLocalVisualStudioGenerator* LocalGenerator; cmGlobalVisualStudioGenerator::VSVersion Version; ----------------------------------------------------------------------- Summary of changes: CMakeLists.txt | 26 +++-- Modules/FindBoost.cmake | 170 ++++++++++++++++++++++------- Source/Checks/Curses.cmake | 41 +++++++ Source/Checks/Curses/CMakeLists.txt | 25 +++++ Source/Checks/Curses/CheckCurses.c | 15 +++ Source/cmVisualStudioGeneratorOptions.cxx | 133 +++++++++++----------- Source/cmVisualStudioGeneratorOptions.h | 4 + 7 files changed, 289 insertions(+), 125 deletions(-) create mode 100644 Source/Checks/Curses.cmake create mode 100644 Source/Checks/Curses/CMakeLists.txt create mode 100644 Source/Checks/Curses/CheckCurses.c hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 22 15:25:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 22 Mar 2018 15:25:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-311-g82df2fe Message-ID: <20180322192508.F3CBB10AE16@public.kitware.com> 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, master has been updated via 82df2fe17e81fa4efa9717ec9d83d2915d56aa33 (commit) via 45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9 (commit) via 6a41aa2abd75ceaa9081edc1c7f8510d2c17dd7e (commit) via 1d00ed7cf7ffd5c51dfcf77075589ab0e30d29a3 (commit) via 0df559832bdc629df333b57c798d42e77716a94b (commit) from 8aec07e0576a6121174a210dd3e3440a9f7105aa (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82df2fe17e81fa4efa9717ec9d83d2915d56aa33 commit 82df2fe17e81fa4efa9717ec9d83d2915d56aa33 Merge: 8aec07e 45408b5 Author: Craig Scott AuthorDate: Thu Mar 22 19:24:41 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 15:24:49 2018 -0400 Merge topic 'policy-version-range' 45408b5ea1 cmake_minimum_required: Optionally set policies with version range 6a41aa2abd cmPolicies: Split parsing and impl of ApplyPolicyVersion 1d00ed7cf7 cmPolicies: Drop unnecessary check from ApplyPolicyVersion 0df559832b cmPolicies: Pass policy version as std::string Acked-by: Kitware Robot Merge-request: !1864 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9 commit 45408b5ea1e3654b5d4f6289ca1a0b5c0f1ac4e9 Author: Brad King AuthorDate: Fri Mar 16 12:42:36 2018 -0400 Commit: Brad King CommitDate: Wed Mar 21 08:00:28 2018 -0400 cmake_minimum_required: Optionally set policies with version range Teach `cmake_minimum_required` and `cmake_policy(VERSION)` to support a version range of the form `[...]`. Define this to mean that version `` is required, but known policies up to those introduced by `` will be set to `NEW`. This will allow projects to easily specify a range of versions for which they have been updated. diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst index 9535bf3..7c02190 100644 --- a/Help/command/cmake_minimum_required.rst +++ b/Help/command/cmake_minimum_required.rst @@ -4,11 +4,15 @@ cmake_minimum_required Set the minimum required version of cmake for a project and update `Policy Settings`_ to match the version given:: - cmake_minimum_required(VERSION major.minor[.patch[.tweak]] - [FATAL_ERROR]) + cmake_minimum_required(VERSION [...] [FATAL_ERROR]) -If the current version of CMake is lower than that required it will -stop processing the project and report an error. +```` and the optional ```` are each CMake versions of the form +``major.minor[.patch[.tweak]]``, and the ``...`` is literal. + +If the running version of CMake is lower than the ```` required +version it will stop processing the project and report an error. +The optional ```` version, if specified, must be at least the +```` version and affects policy settings as described below. The ``FATAL_ERROR`` option is accepted but ignored by CMake 2.6 and higher. It should be specified so CMake versions 2.4 and lower fail @@ -30,21 +34,23 @@ Policy Settings The ``cmake_minimum_required(VERSION)`` command implicitly invokes the :command:`cmake_policy(VERSION)` command to specify that the current -project code is written for the given version of CMake. -All policies introduced in the specified version or earlier will be -set to use NEW behavior. All policies introduced after the specified -version will be unset. This effectively requests behavior preferred +project code is written for the given range of CMake versions. +All policies known to the running version of CMake and introduced +in the ```` (or ````, if specified) version or earlier will +be set to use ``NEW`` behavior. All policies introduced in later +versions will be unset. This effectively requests behavior preferred as of a given CMake version and tells newer CMake versions to warn about their new policies. -When a version higher than 2.4 is specified the command implicitly -invokes:: +When a ```` version higher than 2.4 is specified the command +implicitly invokes:: - cmake_policy(VERSION major[.minor[.patch[.tweak]]]) + cmake_policy(VERSION [...]) -which sets the cmake policy version level to the version specified. -When version 2.4 or lower is given the command implicitly invokes:: +which sets CMake policies based on the range of versions specified. +When a ```` version 2.4 or lower is given the command implicitly +invokes:: - cmake_policy(VERSION 2.4) + cmake_policy(VERSION 2.4[...]) which enables compatibility features for CMake 2.4 and lower. diff --git a/Help/command/cmake_policy.rst b/Help/command/cmake_policy.rst index b51b951..6a8dd62 100644 --- a/Help/command/cmake_policy.rst +++ b/Help/command/cmake_policy.rst @@ -24,17 +24,22 @@ The ``cmake_policy`` command is used to set policies to ``OLD`` or ``NEW`` behavior. While setting policies individually is supported, we encourage projects to set policies based on CMake versions:: - cmake_policy(VERSION major.minor[.patch[.tweak]]) - -Specify that the current CMake code is written for the given -version of CMake. All policies introduced in the specified version or -earlier will be set to use ``NEW`` behavior. All policies introduced -after the specified version will be unset (unless the + cmake_policy(VERSION [...]) + +```` and the optional ```` are each CMake versions of the form +``major.minor[.patch[.tweak]]``, and the ``...`` is literal. The ```` +version must be at least ``2.4`` and at most the running version of CMake. +The ```` version, if specified, must be at least the ```` version +but may exceed the running version of CMake. + +This specifies that the current CMake code is written for the given +range of CMake versions. All policies known to the running version of CMake +and introduced in the ```` (or ````, if specified) version +or earlier will be set to use ``NEW`` behavior. All policies +introduced in later versions will be unset (unless the :variable:`CMAKE_POLICY_DEFAULT_CMP` variable sets a default). This effectively requests behavior preferred as of a given CMake version and tells newer CMake versions to warn about their new policies. -The policy version specified must be at least 2.4 or the command will -report an error. Note that the :command:`cmake_minimum_required(VERSION)` command implicitly calls ``cmake_policy(VERSION)`` too. diff --git a/Help/release/dev/policy-version-range.rst b/Help/release/dev/policy-version-range.rst new file mode 100644 index 0000000..b2d1f17 --- /dev/null +++ b/Help/release/dev/policy-version-range.rst @@ -0,0 +1,8 @@ +policy-version-range +-------------------- + +* The :command:`cmake_minimum_required` and :command:`cmake_policy(VERSION)` + commands now accept a version range using the form ``[...]``. + The ```` version is required but policies are set based on the + ```` version. This allows projects to specify a range of versions + for which they have been updated and avoid explicit policy settings. diff --git a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst index 5a51634..f466468 100644 --- a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst +++ b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst @@ -1,7 +1,5 @@ CMAKE_MINIMUM_REQUIRED_VERSION ------------------------------ -Version specified to :command:`cmake_minimum_required` command - -Variable containing the ``VERSION`` component specified in the -:command:`cmake_minimum_required` command. +The ```` version of CMake given to the most recent call to the +:command:`cmake_minimum_required(VERSION)` command. diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index d41a9e5..64aba10 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1002,7 +1002,8 @@ int cmCPackGenerator::DoPackage() { // scope that enables package generators to run internal scripts with // latest CMake policies enabled cmMakefile::ScopePushPop pp{ this->MakefileMap }; - this->MakefileMap->SetPolicyVersion(cmVersion::GetCMakeVersion()); + this->MakefileMap->SetPolicyVersion(cmVersion::GetCMakeVersion(), + std::string()); if (!this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory" diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index bcc41fc..c4834a8 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -45,9 +45,24 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, return this->EnforceUnknownArguments(); } + // Separate the version and any trailing ... component. + std::string::size_type const dd = version_string.find("..."); + std::string const version_min = version_string.substr(0, dd); + std::string const version_max = dd != std::string::npos + ? version_string.substr(dd + 3, std::string::npos) + : std::string(); + if (dd != std::string::npos && + (version_min.empty() || version_max.empty())) { + std::ostringstream e; + e << "VERSION \"" << version_string + << "\" does not have a version on both sides of \"...\"."; + this->SetError(e.str()); + return false; + } + // Save the required version string. this->Makefile->AddDefinition("CMAKE_MINIMUM_REQUIRED_VERSION", - version_string.c_str()); + version_min.c_str()); // Get the current version number. unsigned int current_major = cmVersion::GetMajorVersion(); @@ -61,10 +76,10 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, unsigned int required_minor = 0; unsigned int required_patch = 0; unsigned int required_tweak = 0; - if (sscanf(version_string.c_str(), "%u.%u.%u.%u", &required_major, + if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &required_major, &required_minor, &required_patch, &required_tweak) < 2) { std::ostringstream e; - e << "could not parse VERSION \"" << version_string << "\"."; + e << "could not parse VERSION \"" << version_min << "\"."; this->SetError(e.str()); return false; } @@ -78,7 +93,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, current_patch == required_patch && current_tweak < required_tweak)) { // The current version is too low. std::ostringstream e; - e << "CMake " << version_string + e << "CMake " << version_min << " or higher is required. You are running version " << cmVersion::GetCMakeVersion(); this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); @@ -95,9 +110,9 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, this->Makefile->IssueMessage( cmake::AUTHOR_WARNING, "Compatibility with CMake < 2.4 is not supported by CMake >= 3.0."); - this->Makefile->SetPolicyVersion("2.4"); + this->Makefile->SetPolicyVersion("2.4", version_max); } else { - this->Makefile->SetPolicyVersion(version_string.c_str()); + this->Makefile->SetPolicyVersion(version_min, version_max); } return true; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 3ccc815..7ca1cbc 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -156,6 +156,23 @@ bool cmCMakePolicyCommand::HandleVersionMode( this->SetError("VERSION given too many arguments"); return false; } - this->Makefile->SetPolicyVersion(args[1].c_str()); + std::string const& version_string = args[1]; + + // Separate the version and any trailing ... component. + std::string::size_type const dd = version_string.find("..."); + std::string const version_min = version_string.substr(0, dd); + std::string const version_max = dd != std::string::npos + ? version_string.substr(dd + 3, std::string::npos) + : std::string(); + if (dd != std::string::npos && + (version_min.empty() || version_max.empty())) { + std::ostringstream e; + e << "VERSION \"" << version_string + << "\" does not have a version on both sides of \"...\"."; + this->SetError(e.str()); + return false; + } + + this->Makefile->SetPolicyVersion(version_min, version_max); return true; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 23883f7..92d7681 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1464,7 +1464,7 @@ void cmMakefile::Configure() this->SetCheckCMP0000(true); // Implicitly set the version for the user. - this->SetPolicyVersion("2.4"); + this->SetPolicyVersion("2.4", std::string()); } } bool hasProject = false; @@ -4149,9 +4149,10 @@ void cmMakefile::PopSnapshot(bool reportError) assert(this->StateSnapshot.IsValid()); } -bool cmMakefile::SetPolicyVersion(std::string const& version_min) +bool cmMakefile::SetPolicyVersion(std::string const& version_min, + std::string const& version_max) { - return cmPolicies::ApplyPolicyVersion(this, version_min); + return cmPolicies::ApplyPolicyVersion(this, version_min, version_max); } bool cmMakefile::HasCMP0054AlreadyBeenReported( diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e90cf2f..414c08c 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -285,7 +285,8 @@ public: bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); bool SetPolicy(const char* id, cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const; - bool SetPolicyVersion(std::string const& version_min); + bool SetPolicyVersion(std::string const& version_min, + std::string const& version_max); void RecordPolicies(cmPolicies::PolicyMap& pm); //@} diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index cf61edd..dba22b3 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -154,7 +154,8 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, } bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, - std::string const& version_min) + std::string const& version_min, + std::string const& version_max) { // Parse components of the minimum version. unsigned int minMajor = 2; @@ -205,6 +206,42 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int polMajor = minMajor; unsigned int polMinor = minMinor; unsigned int polPatch = minPatch; + + if (!version_max.empty()) { + // Parse components of the maximum version. + unsigned int maxMajor = 0; + unsigned int maxMinor = 0; + unsigned int maxPatch = 0; + unsigned int maxTweak = 0; + if (sscanf(version_max.c_str(), "%u.%u.%u.%u", &maxMajor, &maxMinor, + &maxPatch, &maxTweak) < 2) { + std::ostringstream e; + e << "Invalid policy max version value \"" << version_max << "\". " + << "A numeric major.minor[.patch[.tweak]] must be given."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + + // It is an error if the min version is greater than the max version. + if (minMajor > maxMajor || (minMajor == maxMajor && minMinor > maxMinor) || + (minMajor == maxMajor && minMinor == maxMinor && + minPatch > maxPatch) || + (minMajor == maxMajor && minMinor == maxMinor && + minPatch == maxPatch && minTweak > maxTweak)) { + std::ostringstream e; + e << "Policy VERSION range \"" << version_min << "..." << version_max + << "\"" + << " specifies a larger minimum than maximum."; + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + return false; + } + + // Use the max version as the policy version. + polMajor = maxMajor; + polMinor = maxMinor; + polPatch = maxPatch; + } + return cmPolicies::ApplyPolicyVersion(mf, polMajor, polMinor, polPatch); } diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 00f3fd0..33896fe 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -289,7 +289,8 @@ public: ///! Set a policy level for this listfile static bool ApplyPolicyVersion(cmMakefile* mf, - std::string const& version_min); + std::string const& version_min, + std::string const& version_max); static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, unsigned int minorVer, unsigned int patchVer); diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 1939bd4..5c35d76 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -612,7 +612,7 @@ bool cmQtAutoGenerator::Run(std::string const& infoFile, auto makefile = cm::make_unique(&gg, snapshot); // The OLD/WARN behavior for policy CMP0053 caused a speed regression. // https://gitlab.kitware.com/cmake/cmake/issues/17570 - makefile->SetPolicyVersion("3.9"); + makefile->SetPolicyVersion("3.9", std::string()); gg.SetCurrentMakefile(makefile.get()); success = this->Init(makefile.get()); } diff --git a/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt new file mode 100644 index 0000000..7d2bdae --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Range-stderr.txt @@ -0,0 +1,4 @@ +^CMAKE_MINIMUM_REQUIRED_VERSION='3\.10' +CMP0071='NEW' +CMP0072='NEW' +CMP0073=''$ diff --git a/Tests/RunCMake/cmake_minimum_required/Range.cmake b/Tests/RunCMake/cmake_minimum_required/Range.cmake new file mode 100644 index 0000000..0080092 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Range.cmake @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10...3.11) +message("CMAKE_MINIMUM_REQUIRED_VERSION='${CMAKE_MINIMUM_REQUIRED_VERSION}'") +foreach(policy CMP0071 CMP0072 CMP0073) + cmake_policy(GET ${policy} status) + message("${policy}='${status}'") +endforeach() diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt b/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt b/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt new file mode 100644 index 0000000..b2c62fb --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt @@ -0,0 +1,56 @@ +^CMake Error at RangeBad.cmake:1 \(cmake_minimum_required\): + cmake_minimum_required VERSION "3.11..." does not have a version on both + sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:2 \(cmake_minimum_required\): + cmake_minimum_required VERSION "...3.11" does not have a version on both + sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:3 \(cmake_minimum_required\): + cmake_minimum_required VERSION "..." does not have a version on both sides + of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:4 \(cmake_minimum_required\): + Invalid policy max version value "4". A numeric + major.minor\[.patch\[.tweak\]\] must be given. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:5 \(cmake_minimum_required\): + Policy VERSION range "3.11...3.10" specifies a larger minimum than maximum. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:6 \(cmake_policy\): + cmake_policy VERSION "3.11..." does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:7 \(cmake_policy\): + cmake_policy VERSION "...3.11" does not have a version on both sides of + "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:8 \(cmake_policy\): + cmake_policy VERSION "..." does not have a version on both sides of "...". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:9 \(cmake_policy\): + Invalid policy max version value "4". A numeric + major.minor\[.patch\[.tweak\]\] must be given. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at RangeBad.cmake:10 \(cmake_policy\): + Policy VERSION range "3.11...3.10" specifies a larger minimum than maximum. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake b/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake new file mode 100644 index 0000000..2a2dade --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/RangeBad.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.11...) +cmake_minimum_required(VERSION ...3.11) +cmake_minimum_required(VERSION ...) +cmake_minimum_required(VERSION 3.11...4) +cmake_minimum_required(VERSION 3.11...3.10) +cmake_policy(VERSION 3.11...) +cmake_policy(VERSION ...3.11) +cmake_policy(VERSION ...) +cmake_policy(VERSION 3.11...4) +cmake_policy(VERSION 3.11...3.10) diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake index e4c65e3..22aa5b7 100644 --- a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -3,3 +3,5 @@ include(RunCMake) run_cmake(Before24) run_cmake(CompatBefore24) run_cmake(PolicyBefore24) +run_cmake(Range) +run_cmake(RangeBad) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6a41aa2abd75ceaa9081edc1c7f8510d2c17dd7e commit 6a41aa2abd75ceaa9081edc1c7f8510d2c17dd7e Author: Brad King AuthorDate: Fri Mar 16 12:23:53 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 12:37:14 2018 -0400 cmPolicies: Split parsing and impl of ApplyPolicyVersion Also rename local variables to clarify their role during parsing. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index adb6e78..cf61edd 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -156,14 +156,13 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min) { - unsigned int majorVer = 2; - unsigned int minorVer = 0; - unsigned int patchVer = 0; - unsigned int tweakVer = 0; - - // parse the string - if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &majorVer, &minorVer, - &patchVer, &tweakVer) < 2) { + // Parse components of the minimum version. + unsigned int minMajor = 2; + unsigned int minMinor = 0; + unsigned int minPatch = 0; + unsigned int minTweak = 0; + if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &minMajor, &minMinor, + &minPatch, &minTweak) < 2) { std::ostringstream e; e << "Invalid policy version value \"" << version_min << "\". " << "A numeric major.minor[.patch[.tweak]] must be given."; @@ -172,7 +171,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, } // it is an error if the policy version is less than 2.4 - if (majorVer < 2 || (majorVer == 2 && minorVer < 4)) { + if (minMajor < 2 || (minMajor == 2 && minMinor < 4)) { mf->IssueMessage( cmake::FATAL_ERROR, "Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. " @@ -183,16 +182,16 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, // It is an error if the policy version is greater than the running // CMake. - if (majorVer > cmVersion::GetMajorVersion() || - (majorVer == cmVersion::GetMajorVersion() && - minorVer > cmVersion::GetMinorVersion()) || - (majorVer == cmVersion::GetMajorVersion() && - minorVer == cmVersion::GetMinorVersion() && - patchVer > cmVersion::GetPatchVersion()) || - (majorVer == cmVersion::GetMajorVersion() && - minorVer == cmVersion::GetMinorVersion() && - patchVer == cmVersion::GetPatchVersion() && - tweakVer > cmVersion::GetTweakVersion())) { + if (minMajor > cmVersion::GetMajorVersion() || + (minMajor == cmVersion::GetMajorVersion() && + minMinor > cmVersion::GetMinorVersion()) || + (minMajor == cmVersion::GetMajorVersion() && + minMinor == cmVersion::GetMinorVersion() && + minPatch > cmVersion::GetPatchVersion()) || + (minMajor == cmVersion::GetMajorVersion() && + minMinor == cmVersion::GetMinorVersion() && + minPatch == cmVersion::GetPatchVersion() && + minTweak > cmVersion::GetTweakVersion())) { std::ostringstream e; e << "An attempt was made to set the policy version of CMake to \"" << version_min << "\" which is greater than this version of CMake. " @@ -203,6 +202,16 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, return false; } + unsigned int polMajor = minMajor; + unsigned int polMinor = minMinor; + unsigned int polPatch = minPatch; + return cmPolicies::ApplyPolicyVersion(mf, polMajor, polMinor, polPatch); +} + +bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, + unsigned int minorVer, + unsigned int patchVer) +{ // now loop over all the policies and set them as appropriate std::vector ancientPolicies; for (PolicyID pid = cmPolicies::CMP0000; pid != cmPolicies::CMPCOUNT; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 2198184..00f3fd0 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -290,6 +290,8 @@ public: ///! Set a policy level for this listfile static bool ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min); + static bool ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer, + unsigned int minorVer, unsigned int patchVer); ///! return a warning string for a given policy static std::string GetPolicyWarning(cmPolicies::PolicyID id); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d00ed7cf7ffd5c51dfcf77075589ab0e30d29a3 commit 1d00ed7cf7ffd5c51dfcf77075589ab0e30d29a3 Author: Brad King AuthorDate: Fri Mar 16 12:21:29 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 12:21:29 2018 -0400 cmPolicies: Drop unnecessary check from ApplyPolicyVersion This internal API is never called with `version_min` empty. diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 7e3bd78..adb6e78 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -156,22 +156,16 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, std::string const& version_min) { - std::string ver = "2.4.0"; - - if (!version_min.empty()) { - ver = version_min; - } - unsigned int majorVer = 2; unsigned int minorVer = 0; unsigned int patchVer = 0; unsigned int tweakVer = 0; // parse the string - if (sscanf(ver.c_str(), "%u.%u.%u.%u", &majorVer, &minorVer, &patchVer, - &tweakVer) < 2) { + if (sscanf(version_min.c_str(), "%u.%u.%u.%u", &majorVer, &minorVer, + &patchVer, &tweakVer) < 2) { std::ostringstream e; - e << "Invalid policy version value \"" << ver << "\". " + e << "Invalid policy version value \"" << version_min << "\". " << "A numeric major.minor[.patch[.tweak]] must be given."; mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0df559832bdc629df333b57c798d42e77716a94b commit 0df559832bdc629df333b57c798d42e77716a94b Author: Brad King AuthorDate: Fri Mar 16 11:56:54 2018 -0400 Commit: Brad King CommitDate: Fri Mar 16 12:06:04 2018 -0400 cmPolicies: Pass policy version as std::string diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9e53579..23883f7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4149,9 +4149,9 @@ void cmMakefile::PopSnapshot(bool reportError) assert(this->StateSnapshot.IsValid()); } -bool cmMakefile::SetPolicyVersion(const char* version) +bool cmMakefile::SetPolicyVersion(std::string const& version_min) { - return cmPolicies::ApplyPolicyVersion(this, version); + return cmPolicies::ApplyPolicyVersion(this, version_min); } bool cmMakefile::HasCMP0054AlreadyBeenReported( diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 95ba53a..e90cf2f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -285,7 +285,7 @@ public: bool SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); bool SetPolicy(const char* id, cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id) const; - bool SetPolicyVersion(const char* version); + bool SetPolicyVersion(std::string const& version_min); void RecordPolicies(cmPolicies::PolicyMap& pm); //@} diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index e7d1b72..7e3bd78 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -153,12 +153,13 @@ static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy, return true; } -bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version) +bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, + std::string const& version_min) { std::string ver = "2.4.0"; - if (version && strlen(version) > 0) { - ver = version; + if (!version_min.empty()) { + ver = version_min; } unsigned int majorVer = 2; @@ -200,7 +201,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version) tweakVer > cmVersion::GetTweakVersion())) { std::ostringstream e; e << "An attempt was made to set the policy version of CMake to \"" - << version << "\" which is greater than this version of CMake. " + << version_min << "\" which is greater than this version of CMake. " << "This is not allowed because the greater version may have new " << "policies not known to this CMake. " << "You may need a newer CMake version to build this project."; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a784f98..2198184 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -288,7 +288,8 @@ public: static cmPolicies::PolicyStatus GetPolicyStatus(cmPolicies::PolicyID id); ///! Set a policy level for this listfile - static bool ApplyPolicyVersion(cmMakefile* mf, const char* version); + static bool ApplyPolicyVersion(cmMakefile* mf, + std::string const& version_min); ///! return a warning string for a given policy static std::string GetPolicyWarning(cmPolicies::PolicyID id); ----------------------------------------------------------------------- Summary of changes: Help/command/cmake_minimum_required.rst | 34 ++++--- Help/command/cmake_policy.rst | 21 +++-- Help/release/dev/policy-version-range.rst | 8 ++ Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst | 6 +- Source/CPack/cmCPackGenerator.cxx | 3 +- Source/cmCMakeMinimumRequired.cxx | 27 ++++-- Source/cmCMakePolicyCommand.cxx | 19 +++- Source/cmMakefile.cxx | 7 +- Source/cmMakefile.h | 3 +- Source/cmPolicies.cxx | 97 ++++++++++++++------ Source/cmPolicies.h | 6 +- Source/cmQtAutoGenerator.cxx | 2 +- .../cmake_minimum_required/Range-stderr.txt | 4 + Tests/RunCMake/cmake_minimum_required/Range.cmake | 6 ++ .../RangeBad-result.txt} | 0 .../cmake_minimum_required/RangeBad-stderr.txt | 56 +++++++++++ .../RunCMake/cmake_minimum_required/RangeBad.cmake | 10 ++ .../cmake_minimum_required/RunCMakeTest.cmake | 2 + 18 files changed, 243 insertions(+), 68 deletions(-) create mode 100644 Help/release/dev/policy-version-range.rst create mode 100644 Tests/RunCMake/cmake_minimum_required/Range-stderr.txt create mode 100644 Tests/RunCMake/cmake_minimum_required/Range.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => cmake_minimum_required/RangeBad-result.txt} (100%) create mode 100644 Tests/RunCMake/cmake_minimum_required/RangeBad-stderr.txt create mode 100644 Tests/RunCMake/cmake_minimum_required/RangeBad.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 22 15:35:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 22 Mar 2018 15:35:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-313-g9f2ec9d Message-ID: <20180322193505.63BCA10B2BD@public.kitware.com> 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, master has been updated via 9f2ec9d241b58aa2184c11bd6d863885d1fcdec7 (commit) via 768225837db303e8b568e39ade730eea8ac6b573 (commit) from 82df2fe17e81fa4efa9717ec9d83d2915d56aa33 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9f2ec9d241b58aa2184c11bd6d863885d1fcdec7 commit 9f2ec9d241b58aa2184c11bd6d863885d1fcdec7 Merge: 82df2fe 7682258 Author: Craig Scott AuthorDate: Thu Mar 22 19:27:12 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 22 15:27:24 2018 -0400 Merge topic 'list-sublist' 768225837d list: Add SUBLIST sub-command Acked-by: Kitware Robot Merge-request: !1874 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=768225837db303e8b568e39ade730eea8ac6b573 commit 768225837db303e8b568e39ade730eea8ac6b573 Author: Marc Chevrier AuthorDate: Fri Mar 16 14:12:25 2018 +0100 Commit: Brad King CommitDate: Wed Mar 21 12:54:53 2018 -0400 list: Add SUBLIST sub-command Issue: #17823 diff --git a/Help/command/list.rst b/Help/command/list.rst index 3c092bd..6218a2a 100644 --- a/Help/command/list.rst +++ b/Help/command/list.rst @@ -65,6 +65,18 @@ Returns a string joining all list's elements using the glue string. To join multiple strings, which are not part of a list, use ``JOIN`` operator from :command:`string` command. +SUBLIST +""""""" + +:: + + list(SUBLIST ) + +Returns a sublist of the given list. +If ```` is 0, an empty list will be returned. +If ```` is -1 or the list is smaller than ``+`` then +the remaining elements of the list starting at ```` will be returned. + Search ^^^^^^ diff --git a/Help/release/dev/list-sublist.rst b/Help/release/dev/list-sublist.rst new file mode 100644 index 0000000..7ad225b --- /dev/null +++ b/Help/release/dev/list-sublist.rst @@ -0,0 +1,5 @@ +list-sublist +------------ + +* The :command:`list` command learned a ``SUBLIST`` sub-command + to get a sublist of the list. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 62d4ea7..821e6d1 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -57,6 +57,9 @@ bool cmListCommand::InitialPass(std::vector const& args, if (subCommand == "SORT") { return this->HandleSortCommand(args); } + if (subCommand == "SUBLIST") { + return this->HandleSublistCommand(args); + } if (subCommand == "REVERSE") { return this->HandleReverseCommand(args); } @@ -427,6 +430,55 @@ bool cmListCommand::HandleSortCommand(std::vector const& args) return true; } +bool cmListCommand::HandleSublistCommand(std::vector const& args) +{ + if (args.size() != 5) { + std::ostringstream error; + error << "sub-command SUBLIST requires four arguments (" << args.size() - 1 + << " found)."; + this->SetError(error.str()); + return false; + } + + const std::string& listName = args[1]; + const std::string& variableName = args[args.size() - 1]; + + // expand the variable + std::vector varArgsExpanded; + if (!this->GetList(varArgsExpanded, listName) || varArgsExpanded.empty()) { + this->Makefile->AddDefinition(variableName, ""); + return true; + } + + const int start = atoi(args[2].c_str()); + const int length = atoi(args[3].c_str()); + + using size_type = decltype(varArgsExpanded)::size_type; + + if (start < 0 || size_type(start) >= varArgsExpanded.size()) { + std::ostringstream error; + error << "begin index: " << start << " is out of range 0 - " + << varArgsExpanded.size() - 1; + this->SetError(error.str()); + return false; + } + if (length < -1) { + std::ostringstream error; + error << "length: " << length << " should be -1 or greater"; + this->SetError(error.str()); + return false; + } + + const size_type end = + (length == -1 || size_type(start + length) > varArgsExpanded.size()) + ? varArgsExpanded.size() + : size_type(start + length); + std::vector sublist(varArgsExpanded.begin() + start, + varArgsExpanded.begin() + end); + this->Makefile->AddDefinition(variableName, cmJoin(sublist, ";").c_str()); + return true; +} + bool cmListCommand::HandleRemoveAtCommand(std::vector const& args) { if (args.size() < 3) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index d6870e6..d69d8f9 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -42,6 +42,7 @@ protected: bool HandleRemoveItemCommand(std::vector const& args); bool HandleRemoveDuplicatesCommand(std::vector const& args); bool HandleSortCommand(std::vector const& args); + bool HandleSublistCommand(std::vector const& args); bool HandleReverseCommand(std::vector const& args); bool HandleFilterCommand(std::vector const& args); bool FilterRegex(std::vector const& args, bool includeMatches, diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 1be4f85..3913783 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -13,6 +13,7 @@ run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex) run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) +run_cmake(SUBLIST-InvalidIndex) run_cmake(FILTER-REGEX-TooManyArguments) run_cmake(JOIN-TooManyArguments) @@ -20,6 +21,7 @@ run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) run_cmake(SORT-TooManyArguments) +run_cmake(SUBLIST-TooManyArguments) run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) @@ -36,3 +38,8 @@ run_cmake(FILTER-REGEX-Valid1) run_cmake(JOIN-NoArguments) run_cmake(JOIN-NoVariable) run_cmake(JOIN) + +run_cmake(SUBLIST-NoArguments) +run_cmake(SUBLIST-NoVariable) +run_cmake(SUBLIST-InvalidLength) +run_cmake(SUBLIST) diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt b/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt b/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt new file mode 100644 index 0000000..5e67b27 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-InvalidIndex.cmake:2 \(list\): + list begin index: 3 is out of range 0 - 2 +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake b/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake new file mode 100644 index 0000000..565b9dc --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 3 -1 result) diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt b/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt b/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt new file mode 100644 index 0000000..16c6ecb --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-InvalidLength.cmake:2 \(list\): + list length: -2 should be -1 or greater +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake b/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake new file mode 100644 index 0000000..1dab83f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-InvalidLength.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 0 -2 result) diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt b/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt b/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt new file mode 100644 index 0000000..073173c --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-NoArguments.cmake:1 \(list\): + list sub-command SUBLIST requires four arguments \(1 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-NoArguments.cmake b/Tests/RunCMake/list/SUBLIST-NoArguments.cmake new file mode 100644 index 0000000..df38b87 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoArguments.cmake @@ -0,0 +1 @@ +list(SUBLIST mylist) diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt b/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt b/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt new file mode 100644 index 0000000..6f80c1a --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-NoVariable.cmake:2 \(list\): + list sub-command SUBLIST requires four arguments \(3 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-NoVariable.cmake b/Tests/RunCMake/list/SUBLIST-NoVariable.cmake new file mode 100644 index 0000000..83edae9 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-NoVariable.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(SUBLIST mylist 0 -1) diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt b/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt new file mode 100644 index 0000000..eb46844 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SUBLIST-TooManyArguments.cmake:1 \(list\): + list sub-command SUBLIST requires four arguments \(5 found\). +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake b/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake new file mode 100644 index 0000000..28f20c1 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake @@ -0,0 +1 @@ +list(SUBLIST mylist 0 -1 result one_too_many) diff --git a/Tests/RunCMake/list/SUBLIST.cmake b/Tests/RunCMake/list/SUBLIST.cmake new file mode 100644 index 0000000..fd15c28 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST.cmake @@ -0,0 +1,46 @@ +set(mylist alpha bravo charlie delta) +list(SUBLIST mylist 1 2 result) + +if (NOT result STREQUAL "bravo;charlie") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie\"") +endif() + + +unset(result) +list(SUBLIST mylist 0 2 result) + +if (NOT result STREQUAL "alpha;bravo") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"alpha;bravo\"") +endif() + + +unset(result) +list(SUBLIST mylist 3 2 result) + +if (NOT result STREQUAL "delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 2 0 result) +list(LENGTH result length) +if (NOT length EQUAL 0) + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is an empty list") +endif() + + +unset(result) +list(SUBLIST mylist 1 5 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 1 -1 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() ----------------------------------------------------------------------- Summary of changes: Help/command/list.rst | 12 +++++ Help/release/dev/list-sublist.rst | 5 ++ Source/cmListCommand.cxx | 52 ++++++++++++++++++++ Source/cmListCommand.h | 1 + Tests/RunCMake/list/RunCMakeTest.cmake | 7 +++ .../SUBLIST-InvalidIndex-result.txt} | 0 .../RunCMake/list/SUBLIST-InvalidIndex-stderr.txt | 4 ++ Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake | 2 + .../SUBLIST-InvalidLength-result.txt} | 0 .../RunCMake/list/SUBLIST-InvalidLength-stderr.txt | 4 ++ Tests/RunCMake/list/SUBLIST-InvalidLength.cmake | 2 + .../SUBLIST-NoArguments-result.txt} | 0 Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt | 4 ++ Tests/RunCMake/list/SUBLIST-NoArguments.cmake | 1 + .../SUBLIST-NoVariable-result.txt} | 0 Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt | 4 ++ ...InvalidIndex.cmake => SUBLIST-NoVariable.cmake} | 2 +- .../SUBLIST-TooManyArguments-result.txt} | 0 .../list/SUBLIST-TooManyArguments-stderr.txt | 4 ++ Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake | 1 + Tests/RunCMake/list/SUBLIST.cmake | 46 +++++++++++++++++ 21 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 Help/release/dev/list-sublist.rst copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/SUBLIST-InvalidIndex-result.txt} (100%) create mode 100644 Tests/RunCMake/list/SUBLIST-InvalidIndex-stderr.txt create mode 100644 Tests/RunCMake/list/SUBLIST-InvalidIndex.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/SUBLIST-InvalidLength-result.txt} (100%) create mode 100644 Tests/RunCMake/list/SUBLIST-InvalidLength-stderr.txt create mode 100644 Tests/RunCMake/list/SUBLIST-InvalidLength.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/SUBLIST-NoArguments-result.txt} (100%) create mode 100644 Tests/RunCMake/list/SUBLIST-NoArguments-stderr.txt create mode 100644 Tests/RunCMake/list/SUBLIST-NoArguments.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/SUBLIST-NoVariable-result.txt} (100%) create mode 100644 Tests/RunCMake/list/SUBLIST-NoVariable-stderr.txt copy Tests/RunCMake/list/{GET-InvalidIndex.cmake => SUBLIST-NoVariable.cmake} (55%) copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => list/SUBLIST-TooManyArguments-result.txt} (100%) create mode 100644 Tests/RunCMake/list/SUBLIST-TooManyArguments-stderr.txt create mode 100644 Tests/RunCMake/list/SUBLIST-TooManyArguments.cmake create mode 100644 Tests/RunCMake/list/SUBLIST.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 23 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 23 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-314-g2614335 Message-ID: <20180323040505.0C29E10B166@public.kitware.com> 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, master has been updated via 2614335a340f15ee5dd49625050e6f5bf25b9871 (commit) from 9f2ec9d241b58aa2184c11bd6d863885d1fcdec7 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2614335a340f15ee5dd49625050e6f5bf25b9871 commit 2614335a340f15ee5dd49625050e6f5bf25b9871 Author: Kitware Robot AuthorDate: Fri Mar 23 00:01:09 2018 -0400 Commit: Kitware Robot CommitDate: Fri Mar 23 00:01:09 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 7402526..76af31d 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180322) +set(CMake_VERSION_PATCH 20180323) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 23 05:15:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 23 Mar 2018 05:15:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-316-g23922f4 Message-ID: <20180323091505.DE02A1033BC@public.kitware.com> 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, master has been updated via 23922f48cc6a9cd209bbdfa6e6d16085b6278e3a (commit) via 4eb5d851d51bd69f69cde107cd8e06c7bec574b1 (commit) from 2614335a340f15ee5dd49625050e6f5bf25b9871 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23922f48cc6a9cd209bbdfa6e6d16085b6278e3a commit 23922f48cc6a9cd209bbdfa6e6d16085b6278e3a Merge: 2614335 4eb5d85 Author: Craig Scott AuthorDate: Fri Mar 23 09:10:45 2018 +0000 Commit: Kitware Robot CommitDate: Fri Mar 23 05:11:18 2018 -0400 Merge topic 'pr.find_package.prefixes' 4eb5d851d5 Help: Add 'lib32|libx32|lib64' paths to find_package prefixes Acked-by: Kitware Robot Merge-request: !1878 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4eb5d851d51bd69f69cde107cd8e06c7bec574b1 commit 4eb5d851d51bd69f69cde107cd8e06c7bec574b1 Author: Ruslan Baratov AuthorDate: Wed Mar 21 00:21:11 2018 +0300 Commit: Ruslan Baratov CommitDate: Wed Mar 21 20:59:09 2018 +0300 Help: Add 'lib32|libx32|lib64' paths to find_package prefixes Document the conditions when 'lib32|libx32|lib64' variants will be added to the list of possible installation prefixes. diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst index 89c5a7a..53f3819 100644 --- a/Help/command/find_package.rst +++ b/Help/command/find_package.rst @@ -209,12 +209,12 @@ Each entry is meant for installation trees following Windows (W), UNIX /(cmake|CMake)/ (W) /*/ (W) /*/(cmake|CMake)/ (W) - /(lib/|lib|share)/cmake/*/ (U) - /(lib/|lib|share)/*/ (U) - /(lib/|lib|share)/*/(cmake|CMake)/ (U) - /*/(lib/|lib|share)/cmake/*/ (W/U) - /*/(lib/|lib|share)/*/ (W/U) - /*/(lib/|lib|share)/*/(cmake|CMake)/ (W/U) + /(lib/|lib*|share)/cmake/*/ (U) + /(lib/|lib*|share)/*/ (U) + /(lib/|lib*|share)/*/(cmake|CMake)/ (U) + /*/(lib/|lib*|share)/cmake/*/ (W/U) + /*/(lib/|lib*|share)/*/ (W/U) + /*/(lib/|lib*|share)/*/(cmake|CMake)/ (W/U) On systems supporting OS X Frameworks and Application Bundles the following directories are searched for frameworks or bundles @@ -229,10 +229,22 @@ containing a configuration file:: In all cases the ```` is treated as case-insensitive and corresponds to any of the names specified (```` or names given by ``NAMES``). + Paths with ``lib/`` are enabled if the -:variable:`CMAKE_LIBRARY_ARCHITECTURE` variable is set. If ``PATH_SUFFIXES`` -is specified the suffixes are appended to each (W) or (U) directory entry -one-by-one. +:variable:`CMAKE_LIBRARY_ARCHITECTURE` variable is set. ``lib*`` includes one +or more of the values ``lib64``, ``lib32``, ``libx32`` or ``lib`` (searched in +that order). + +* Paths with ``lib64`` are searched on 64 bit platforms if the + :prop_gbl:`FIND_LIBRARY_USE_LIB64_PATHS` property is set to ``TRUE``. +* Paths with ``lib32`` are searched on 32 bit platforms if the + :prop_gbl:`FIND_LIBRARY_USE_LIB32_PATHS` property is set to ``TRUE``. +* Paths with ``libx32`` are searched on platforms using the x32 ABI + if the :prop_gbl:`FIND_LIBRARY_USE_LIBX32_PATHS` property is set to ``TRUE``. +* The ``lib`` path is always searched. + +If ``PATH_SUFFIXES`` is specified, the suffixes are appended to each +(W) or (U) directory entry one-by-one. This set of directories is intended to work in cooperation with projects that provide configuration files in their installation trees. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index e9ac4a7..46854f7 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -2065,7 +2065,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) common.push_back("lib"); common.push_back("share"); - // PREFIX/(lib/ARCH|lib|share)/cmake/(Foo|foo|FOO).*/ + // PREFIX/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / @@ -2078,7 +2078,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } - // PREFIX/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/ + // PREFIX/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / @@ -2090,7 +2090,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } - // PREFIX/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/(cmake|CMake)/ + // PREFIX/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/(cmake|CMake)/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / @@ -2103,7 +2103,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } - // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/cmake/(Foo|foo|FOO).*/ + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/cmake/(Foo|foo|FOO).*/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / @@ -2118,7 +2118,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } - // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/ + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / @@ -2132,7 +2132,7 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) } } - // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib|share)/(Foo|foo|FOO).*/(cmake|CMake)/ + // PREFIX/(Foo|foo|FOO).*/(lib/ARCH|lib*|share)/(Foo|foo|FOO).*/(cmake|CMake)/ { cmFindPackageFileList lister(this); lister / cmFileListGeneratorFixed(prefix) / ----------------------------------------------------------------------- Summary of changes: Help/command/find_package.rst | 30 +++++++++++++++++++++--------- Source/cmFindPackageCommand.cxx | 12 ++++++------ 2 files changed, 27 insertions(+), 15 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 24 00:05:08 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 24 Mar 2018 00:05:08 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-317-g3dec341 Message-ID: <20180324040509.1775910B264@public.kitware.com> 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, master has been updated via 3dec341fe7b2541d395a025a05ea0147ae4f49fb (commit) from 23922f48cc6a9cd209bbdfa6e6d16085b6278e3a (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3dec341fe7b2541d395a025a05ea0147ae4f49fb commit 3dec341fe7b2541d395a025a05ea0147ae4f49fb Author: Kitware Robot AuthorDate: Sat Mar 24 00:01:13 2018 -0400 Commit: Kitware Robot CommitDate: Sat Mar 24 00:01:13 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 76af31d..e036a91 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180323) +set(CMake_VERSION_PATCH 20180324) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sun Mar 25 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sun, 25 Mar 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-318-gb080ac4 Message-ID: <20180325040504.C53D910B1F7@public.kitware.com> 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, master has been updated via b080ac48c307b422ad6b4b5cdf9831ac6373cf71 (commit) from 3dec341fe7b2541d395a025a05ea0147ae4f49fb (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b080ac48c307b422ad6b4b5cdf9831ac6373cf71 commit b080ac48c307b422ad6b4b5cdf9831ac6373cf71 Author: Kitware Robot AuthorDate: Sun Mar 25 00:01:04 2018 -0400 Commit: Kitware Robot CommitDate: Sun Mar 25 00:01:04 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e036a91..6f068b5 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180324) +set(CMake_VERSION_PATCH 20180325) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 26 00:05:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 26 Mar 2018 00:05:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-319-g2fd00f7 Message-ID: <20180326040503.DDD2710B2ED@public.kitware.com> 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, master has been updated via 2fd00f7668760edd92167be13e909a32f2e1bc22 (commit) from b080ac48c307b422ad6b4b5cdf9831ac6373cf71 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fd00f7668760edd92167be13e909a32f2e1bc22 commit 2fd00f7668760edd92167be13e909a32f2e1bc22 Author: Kitware Robot AuthorDate: Mon Mar 26 00:01:10 2018 -0400 Commit: Kitware Robot CommitDate: Mon Mar 26 00:01:10 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 6f068b5..0686b72 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180325) +set(CMake_VERSION_PATCH 20180326) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 26 07:55:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 26 Mar 2018 07:55:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-321-g89fd296 Message-ID: <20180326115506.ED42C10AC43@public.kitware.com> 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, master has been updated via 89fd296ef25d359a1c7be42fe6ccfc4265821bb3 (commit) via 218471a35c59f134051058e0dc2e0947df0052b4 (commit) from 2fd00f7668760edd92167be13e909a32f2e1bc22 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89fd296ef25d359a1c7be42fe6ccfc4265821bb3 commit 89fd296ef25d359a1c7be42fe6ccfc4265821bb3 Merge: 2fd00f7 218471a Author: Brad King AuthorDate: Mon Mar 26 07:49:13 2018 -0400 Commit: Brad King CommitDate: Mon Mar 26 07:49:13 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 26 07:55:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 26 Mar 2018 07:55:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc4-4-g218471a Message-ID: <20180326115507.1C32C10ACAF@public.kitware.com> 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, release has been updated via 218471a35c59f134051058e0dc2e0947df0052b4 (commit) via 1673923c303c6a4184904c4c5849911feddb87e7 (commit) from 2006e981dab0ea228f611756cdefef8ccfa33a51 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Modules/FindBoost.cmake | 170 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 129 insertions(+), 41 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Mon Mar 26 08:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Mon, 26 Mar 2018 08:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-329-g6792c77 Message-ID: <20180326120504.8E41A10B241@public.kitware.com> 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, master has been updated via 6792c7787aedc0fb2a32b6ca563917f7447f2e80 (commit) via 0e323aad431044ccf60d72cb951563f78c688b66 (commit) via ee78f4e1daf72735d608e22f0c99c5e28a640601 (commit) via 911972903b7cfdb4a0ff356ae43352822b5bbd76 (commit) via 51b642679bc5dc675ab0e4e3fe7dc4c053ba60f4 (commit) via 850cfe3a3b58db3bf76e5d5d6a2583f3849ab3e8 (commit) via 20c204244b4000dc209da42a1b2a39c06c454419 (commit) via 53e3080be3a622bf4e720a03da2d3b34a4101be6 (commit) from 89fd296ef25d359a1c7be42fe6ccfc4265821bb3 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6792c7787aedc0fb2a32b6ca563917f7447f2e80 commit 6792c7787aedc0fb2a32b6ca563917f7447f2e80 Merge: 0e323aa 51b6426 Author: Brad King AuthorDate: Mon Mar 26 12:01:51 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 26 08:01:57 2018 -0400 Merge topic 'UseSWIG-fix-library-prefix' 51b642679b UseSWIG: fix prefix library for Java on Windows Acked-by: Kitware Robot Acked-by: Mathieu Malaterre Merge-request: !1871 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0e323aad431044ccf60d72cb951563f78c688b66 commit 0e323aad431044ccf60d72cb951563f78c688b66 Merge: ee78f4e 850cfe3 Author: Brad King AuthorDate: Mon Mar 26 12:00:34 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 26 08:01:00 2018 -0400 Merge topic 'bootstrap-var-options' 850cfe3a3b bootstrap: Add support for VAR=value options to specify tools and flags Acked-by: Kitware Robot Merge-request: !1859 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ee78f4e1daf72735d608e22f0c99c5e28a640601 commit ee78f4e1daf72735d608e22f0c99c5e28a640601 Merge: 9119729 20c2042 Author: Brad King AuthorDate: Mon Mar 26 12:00:15 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 26 08:00:21 2018 -0400 Merge topic 'pr.checksymbol' 20c204244b CheckSymbolExists: Fix CMP0054 warning Acked-by: Kitware Robot Merge-request: !1884 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=911972903b7cfdb4a0ff356ae43352822b5bbd76 commit 911972903b7cfdb4a0ff356ae43352822b5bbd76 Merge: 89fd296 53e3080 Author: Brad King AuthorDate: Mon Mar 26 11:58:12 2018 +0000 Commit: Kitware Robot CommitDate: Mon Mar 26 07:58:22 2018 -0400 Merge topic 'contract-plplot' 53e3080be3 Tests: Restore PLplot contract test repository https URL Acked-by: Kitware Robot Merge-request: !1883 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=51b642679bc5dc675ab0e4e3fe7dc4c053ba60f4 commit 51b642679bc5dc675ab0e4e3fe7dc4c053ba60f4 Author: Marc Chevrier AuthorDate: Tue Mar 20 10:56:28 2018 +0100 Commit: Brad King CommitDate: Thu Mar 22 11:18:17 2018 -0400 UseSWIG: fix prefix library for Java on Windows Fixes: #17836 diff --git a/Help/release/dev/UseSWIG-fix-library-prefix.rst b/Help/release/dev/UseSWIG-fix-library-prefix.rst new file mode 100644 index 0000000..7ff0f49 --- /dev/null +++ b/Help/release/dev/UseSWIG-fix-library-prefix.rst @@ -0,0 +1,6 @@ +UseSWIG-fix-library-prefix +-------------------------- + +* The :module:`UseSWIG` module :command:`swig_add_library` command + (and legacy ``swig_add_module`` command) now set the prefix of + Java modules to ``""`` for MINGW, MSYS, and CYGWIN environments. diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 6d35d1b..8e7ca41 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -507,15 +507,18 @@ function(SWIG_ADD_LIBRARY name) elseif (swig_lowercase_language STREQUAL "go") set_target_properties(${name} PROPERTIES PREFIX "") elseif (swig_lowercase_language STREQUAL "java") + # In java you want: + # System.loadLibrary("LIBRARY"); + # then JNI will look for a library whose name is platform dependent, namely + # MacOS : libLIBRARY.jnilib + # Windows: LIBRARY.dll + # Linux : libLIBRARY.so if (APPLE) - # In java you want: - # System.loadLibrary("LIBRARY"); - # then JNI will look for a library whose name is platform dependent, namely - # MacOS : libLIBRARY.jnilib - # Windows: LIBRARY.dll - # Linux : libLIBRARY.so - set_target_properties (${name} PROPERTIES SUFFIX ".jnilib") - endif () + set_target_properties (${name} PROPERTIES SUFFIX ".jnilib") + endif() + if ((WIN32 AND MINGW) OR CYGWIN OR CMAKE_SYSTEM_NAME STREQUAL MSYS) + set_target_properties(${name} PROPERTIES PREFIX "") + endif() elseif (swig_lowercase_language STREQUAL "lua") if(_SAM_TYPE STREQUAL "MODULE") set_target_properties(${name} PROPERTIES PREFIX "") @@ -560,11 +563,16 @@ function(SWIG_ADD_LIBRARY name) # target property SWIG_SUPPORT_FILES lists proxy support files if (NOT SWIG_MODULE_${name}_NOPROXY) string(TOUPPER "${_SAM_LANGUAGE}" swig_uppercase_language) + set(swig_all_support_files) foreach (swig_it IN LISTS SWIG_${swig_uppercase_language}_EXTRA_FILE_EXTENSIONS) set (swig_support_files ${swig_generated_sources}) list (FILTER swig_support_files INCLUDE REGEX ".*${swig_it}$") - set_property (TARGET ${name} APPEND PROPERTY SWIG_SUPPORT_FILES ${swig_support_files}) + list(APPEND swig_all_support_files ${swig_support_files}) endforeach() + if (swig_all_support_files) + list(REMOVE_DUPLICATES swig_all_support_files) + endif() + set_property (TARGET ${name} APPEND PROPERTY SWIG_SUPPORT_FILES ${swig_all_support_files}) endif() # to ensure legacy behavior, export some variables https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=850cfe3a3b58db3bf76e5d5d6a2583f3849ab3e8 commit 850cfe3a3b58db3bf76e5d5d6a2583f3849ab3e8 Author: James Lee AuthorDate: Tue Mar 20 13:34:42 2018 +0800 Commit: Brad King CommitDate: Thu Mar 22 10:52:16 2018 -0400 bootstrap: Add support for VAR=value options to specify tools and flags diff --git a/bootstrap b/bootstrap index d152c34..3d5b0d0 100755 --- a/bootstrap +++ b/bootstrap @@ -821,6 +821,11 @@ while test $# != 0; do --version) cmake_version_display ; exit 2 ;; --verbose) cmake_verbose=TRUE ;; --enable-ccache) cmake_ccache_enabled=TRUE ;; + CC=*) CC=`cmake_arg "$1"` ;; + CXX=*) CXX=`cmake_arg "$1"` ;; + CFLAGS=*) CFLAGS=`cmake_arg "$1"` ;; + CXXFLAGS=*) CXXFLAGS=`cmake_arg "$1"` ;; + LDFLAGS=*) LDFLAGS=`cmake_arg "$1"` ;; --) shift; break ;; *) die "Unknown option: $1" ;; esac @@ -1535,6 +1540,9 @@ MAKE="${cmake_make_processor}" export CC export CXX export MAKE +export CFLAGS +export CXXFLAGS +export LDFLAGS # Run bootstrap CMake to configure real CMake cmake_options="-DCMAKE_BOOTSTRAP=1" https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20c204244b4000dc209da42a1b2a39c06c454419 commit 20c204244b4000dc209da42a1b2a39c06c454419 Author: Ruslan Baratov AuthorDate: Thu Mar 22 15:32:43 2018 +0300 Commit: Ruslan Baratov CommitDate: Thu Mar 22 15:32:43 2018 +0300 CheckSymbolExists: Fix CMP0054 warning diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index d9c9ae4..3483121 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -45,6 +45,9 @@ the way the check is run: include_guard(GLOBAL) +cmake_policy(PUSH) +cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced + macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) if(CMAKE_C_COMPILER_LOADED) __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) @@ -116,3 +119,5 @@ macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE) endif() endif() endmacro() + +cmake_policy(POP) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=53e3080be3a622bf4e720a03da2d3b34a4101be6 commit 53e3080be3a622bf4e720a03da2d3b34a4101be6 Author: Brad King AuthorDate: Thu Mar 22 07:08:35 2018 -0400 Commit: Brad King CommitDate: Thu Mar 22 07:08:35 2018 -0400 Tests: Restore PLplot contract test repository https URL Switch back to the `https://` repository URL but without the `.git` extensions. It seems faster than the `git://` protocol for this server. diff --git a/Tests/Contracts/PLplot/CMakeLists.txt b/Tests/Contracts/PLplot/CMakeLists.txt index 7051d62..8e95ba3 100644 --- a/Tests/Contracts/PLplot/CMakeLists.txt +++ b/Tests/Contracts/PLplot/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT PLplot_GIT_TAG) set(PLplot_GIT_TAG "plplot-5.13.0") endif() ExternalProject_Add(PLplot - GIT_REPOSITORY "git://git.code.sf.net/p/plplot/plplot" + GIT_REPOSITORY "https://git.code.sf.net/p/plplot/plplot" GIT_TAG "${PLplot_GIT_TAG}" PREFIX "${PLplot_PREFIX}" CMAKE_ARGS ----------------------------------------------------------------------- Summary of changes: Help/release/dev/UseSWIG-fix-library-prefix.rst | 6 ++++++ Modules/CheckSymbolExists.cmake | 5 +++++ Modules/UseSWIG.cmake | 26 +++++++++++++++-------- Tests/Contracts/PLplot/CMakeLists.txt | 2 +- bootstrap | 8 +++++++ 5 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 Help/release/dev/UseSWIG-fix-library-prefix.rst hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 27 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 27 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-330-g82b0316 Message-ID: <20180327040505.62BBC10AB18@public.kitware.com> 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, master has been updated via 82b0316e0a4e5e724770574ae374a9b3df11bccc (commit) from 6792c7787aedc0fb2a32b6ca563917f7447f2e80 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=82b0316e0a4e5e724770574ae374a9b3df11bccc commit 82b0316e0a4e5e724770574ae374a9b3df11bccc Author: Kitware Robot AuthorDate: Tue Mar 27 00:01:05 2018 -0400 Commit: Kitware Robot CommitDate: Tue Mar 27 00:01:05 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0686b72..9cbe5f9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180326) +set(CMake_VERSION_PATCH 20180327) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 27 07:55:14 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 27 Mar 2018 07:55:14 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-336-g99f3f6d Message-ID: <20180327115514.E0788107DBC@public.kitware.com> 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, master has been updated via 99f3f6d528fb9e7e05c1618675d4c998fce3dd59 (commit) via df0cfdf60e9f090c1050e55643349fbb052a52c0 (commit) via b9788dc5a361ad2887b4e8433fdb04dc0aebdcd1 (commit) via a0d9429bd70426b6444d3987d7023fe40e203b88 (commit) via 70c50aa23cc993a502cd3c87be8afb79d973b50e (commit) via 85468e0754fb984aa5d042d07f8e52b67e969741 (commit) from 82b0316e0a4e5e724770574ae374a9b3df11bccc (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=99f3f6d528fb9e7e05c1618675d4c998fce3dd59 commit 99f3f6d528fb9e7e05c1618675d4c998fce3dd59 Merge: df0cfdf 85468e0 Author: Brad King AuthorDate: Tue Mar 27 11:49:27 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 27 07:51:34 2018 -0400 Merge topic 'const-members' 85468e0754 cmComputeLinkInformation: make some members const Acked-by: Kitware Robot Merge-request: !1886 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df0cfdf60e9f090c1050e55643349fbb052a52c0 commit df0cfdf60e9f090c1050e55643349fbb052a52c0 Merge: b9788dc a0d9429 Author: Brad King AuthorDate: Tue Mar 27 11:49:05 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 27 07:50:55 2018 -0400 Merge topic 'vs-options-movexml' a0d9429bd7 cmVisualStudioGeneratorOptions: Move XML code to subclasses Acked-by: Kitware Robot Merge-request: !1885 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b9788dc5a361ad2887b4e8433fdb04dc0aebdcd1 commit b9788dc5a361ad2887b4e8433fdb04dc0aebdcd1 Merge: 82b0316 70c50aa Author: Brad King AuthorDate: Tue Mar 27 11:48:39 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 27 07:49:28 2018 -0400 Merge topic 'revert-CTestTestfile-removal-again' 70c50aa23c Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF" Acked-by: Kitware Robot Merge-request: !1887 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a0d9429bd70426b6444d3987d7023fe40e203b88 commit a0d9429bd70426b6444d3987d7023fe40e203b88 Author: Vitaly Stakhovsky AuthorDate: Thu Mar 22 10:15:36 2018 -0400 Commit: Brad King CommitDate: Mon Mar 26 09:35:58 2018 -0400 cmVisualStudioGeneratorOptions: Move XML code to subclasses diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 500a0aa..c7bb38c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2065,6 +2065,15 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle( return ret; } +void cmVS7GeneratorOptions::OutputFlag(std::ostream& fout, const char* indent, + const char* tag, + const std::string& content) +{ + fout << indent << tag << "=\""; + fout << cmLocalVisualStudio7GeneratorEscapeForXML(content); + fout << "\""; +} + // This class is used to parse an existing vs 7 project // and extract the GUID class cmVS7XMLParser : public cmXMLParser diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 02e6931..22b4264 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -21,6 +21,19 @@ class cmMakefile; class cmSourceFile; class cmSourceGroup; +class cmVS7GeneratorOptions : public cmVisualStudioGeneratorOptions +{ +public: + cmVS7GeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, + cmVS7FlagTable const* table = nullptr, + cmVS7FlagTable const* extraTable = nullptr) + : cmVisualStudioGeneratorOptions(lg, tool, table, extraTable) + { + } + void OutputFlag(std::ostream& fout, const char* indent, const char* tag, + const std::string& content) override; +}; + /** \class cmLocalVisualStudio7Generator * \brief Write Visual Studio .NET project files. * @@ -70,7 +83,7 @@ protected: void CreateSingleVCProj(const std::string& lname, cmGeneratorTarget* tgt); private: - typedef cmVisualStudioGeneratorOptions Options; + typedef cmVS7GeneratorOptions Options; typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo; std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const std::string& configName); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7e6e803..f1aed88 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -18,6 +18,16 @@ #include #include // IWYU pragma: keep +static void ConvertToWindowsSlash(std::string& s); + +static std::string cmVS10EscapeXML(std::string arg) +{ + cmSystemTools::ReplaceString(arg, "&", "&"); + cmSystemTools::ReplaceString(arg, "<", "<"); + cmSystemTools::ReplaceString(arg, ">", ">"); + return arg; +} + struct cmVisualStudio10TargetGenerator::Elem { cmGeneratedFileStream& S; @@ -57,6 +67,37 @@ struct cmVisualStudio10TargetGenerator::Elem } }; +class cmVS10GeneratorOptions : public cmVisualStudioGeneratorOptions +{ +public: + cmVS10GeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, + cmVS7FlagTable const* table, + cmVisualStudio10TargetGenerator* g = nullptr) + : cmVisualStudioGeneratorOptions(lg, tool, table) + , TargetGenerator(g) + { + } + + void OutputFlag(std::ostream& fout, const char* indent, const char* tag, + const std::string& content) override + { + if (!this->GetConfiguration().empty()) { + // if there are configuration specific flags, then + // use the configuration specific tag for PreprocessorDefinitions + fout << indent; + this->TargetGenerator->WritePlatformConfigTag( + tag, this->GetConfiguration(), 0, 0, 0, &fout); + } else { + fout << indent << "<" << tag << ">"; + } + fout << cmVS10EscapeXML(content); + fout << ""; + } + +private: + cmVisualStudio10TargetGenerator* TargetGenerator; +}; + inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag, const char* val, int indentLevel) @@ -73,16 +114,6 @@ inline void cmVisualStudio10TargetGenerator::WriteElem(const char* tag, (*this->BuildFileStream) << tag << ">" << val << "\n"; } -static void ConvertToWindowsSlash(std::string& s); - -static std::string cmVS10EscapeXML(std::string arg) -{ - cmSystemTools::ReplaceString(arg, "&", "&"); - cmSystemTools::ReplaceString(arg, "<", "<"); - cmSystemTools::ReplaceString(arg, ">", ">"); - return arg; -} - inline void cmVisualStudio10TargetGenerator::WriteElemEscapeXML( const char* tag, std::string const& val, int indentLevel) { @@ -2048,9 +2079,9 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmGeneratorExpressionInterpreter genexInterpreter( this->LocalGenerator, this->GeneratorTarget, config, this->GeneratorTarget->GetName(), lang); - cmVisualStudioGeneratorOptions clOptions( + cmVS10GeneratorOptions clOptions( this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, - flagtable, 0, this); + flagtable, this); if (compileAs) { clOptions.AddFlag("CompileAs", compileAs); } @@ -2893,9 +2924,9 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( if (!libflags.empty()) { this->WriteString("\n", 2); cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; - cmVisualStudioGeneratorOptions libOptions( - this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - gg->GetLibFlagTable(), 0, this); + cmVS10GeneratorOptions libOptions(this->LocalGenerator, + cmVisualStudioGeneratorOptions::Linker, + gg->GetLibFlagTable(), this); libOptions.Parse(libflags.c_str()); libOptions.PrependInheritedString("AdditionalOptions"); libOptions.OutputFlagMap(*this->BuildFileStream, " "); @@ -3063,9 +3094,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string const& config) { cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; - auto pOptions = - cm::make_unique(this->LocalGenerator, Options::Linker, - gg->GetLinkFlagTable(), nullptr, this); + auto pOptions = cm::make_unique( + this->LocalGenerator, Options::Linker, gg->GetLinkFlagTable(), this); Options& linkOptions = *pOptions; cmGeneratorTarget::LinkClosure const* linkClosure = diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index d557255..87f735d 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -21,7 +21,7 @@ class cmLocalVisualStudio7Generator; class cmMakefile; class cmSourceFile; class cmSourceGroup; -class cmVisualStudioGeneratorOptions; +class cmVS10GeneratorOptions; class cmVisualStudio10TargetGenerator { @@ -176,7 +176,7 @@ private: void GetCSharpSourceLink(cmSourceFile const* sf, std::string& link); private: - typedef cmVisualStudioGeneratorOptions Options; + typedef cmVS10GeneratorOptions Options; typedef std::map> OptionsMap; OptionsMap ClOptions; OptionsMap RcOptions; diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 7d7000b..26fce4b 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -4,47 +4,19 @@ #include "cmLocalVisualStudioGenerator.h" #include "cmOutputConverter.h" #include "cmSystemTools.h" -#include "cmVisualStudio10TargetGenerator.h" static void cmVS10EscapeForMSBuild(std::string& ret) { cmSystemTools::ReplaceString(ret, ";", "%3B"); } -static std::string cmVisualStudio10GeneratorOptionsEscapeForXML( - std::string ret) -{ - cmSystemTools::ReplaceString(ret, "&", "&"); - cmSystemTools::ReplaceString(ret, "<", "<"); - cmSystemTools::ReplaceString(ret, ">", ">"); - return ret; -} - -static std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret) -{ - cmSystemTools::ReplaceString(ret, "&", "&"); - cmSystemTools::ReplaceString(ret, "\"", """); - cmSystemTools::ReplaceString(ret, "<", "<"); - cmSystemTools::ReplaceString(ret, ">", ">"); - cmSystemTools::ReplaceString(ret, "\n", " "); - return ret; -} - -cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions( - cmLocalVisualStudioGenerator* lg, Tool tool, - cmVisualStudio10TargetGenerator* g) - : cmVisualStudioGeneratorOptions(lg, tool, nullptr, nullptr, g) -{ -} - cmVisualStudioGeneratorOptions::cmVisualStudioGeneratorOptions( cmLocalVisualStudioGenerator* lg, Tool tool, cmVS7FlagTable const* table, - cmVS7FlagTable const* extraTable, cmVisualStudio10TargetGenerator* g) + cmVS7FlagTable const* extraTable) : cmIDEOptions() , LocalGenerator(lg) , Version(lg->GetVersion()) , CurrentTool(tool) - , TargetGenerator(g) { // Store the given flag tables. this->AddTable(table); @@ -444,28 +416,9 @@ void cmVisualStudioGeneratorOptions::SetConfiguration( this->Configuration = config; } -void cmVisualStudioGeneratorOptions::OutputFlag(std::ostream& fout, - const char* indent, - const char* tag, - const std::string& content) +const std::string& cmVisualStudioGeneratorOptions::GetConfiguration() const { - if (this->Version >= cmGlobalVisualStudioGenerator::VS10) { - if (!this->Configuration.empty()) { - // if there are configuration specific flags, then - // use the configuration specific tag for PreprocessorDefinitions - fout << indent; - this->TargetGenerator->WritePlatformConfigTag(tag, this->Configuration, - 0, 0, 0, &fout); - } else { - fout << indent << "<" << tag << ">"; - } - fout << cmVisualStudio10GeneratorOptionsEscapeForXML(content); - fout << ""; - } else { - fout << indent << tag << "=\""; - fout << cmVisualStudioGeneratorOptionsEscapeForXML(content); - fout << "\""; - } + return this->Configuration; } void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 517760a..40290d1 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -16,8 +16,6 @@ class cmLocalVisualStudioGenerator; typedef cmIDEFlagTable cmVS7FlagTable; -class cmVisualStudio10TargetGenerator; - class cmVisualStudioGeneratorOptions : public cmIDEOptions { public: @@ -34,12 +32,8 @@ public: CSharpCompiler }; cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, - cmVS7FlagTable const* table, - cmVS7FlagTable const* extraTable = 0, - cmVisualStudio10TargetGenerator* g = 0); - - cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg, Tool tool, - cmVisualStudio10TargetGenerator* g = 0); + cmVS7FlagTable const* table = nullptr, + cmVS7FlagTable const* extraTable = nullptr); // Add a table of flags. void AddTable(cmVS7FlagTable const* table); @@ -92,10 +86,11 @@ public: const std::string& lang); void OutputFlagMap(std::ostream& fout, const char* indent); void SetConfiguration(const std::string& config); + const std::string& GetConfiguration() const; -private: - void OutputFlag(std::ostream& fout, const char* indent, const char* tag, - const std::string& content); +protected: + virtual void OutputFlag(std::ostream& fout, const char* indent, + const char* tag, const std::string& content) = 0; private: cmLocalVisualStudioGenerator* LocalGenerator; @@ -103,7 +98,6 @@ private: std::string Configuration; Tool CurrentTool; - cmVisualStudio10TargetGenerator* TargetGenerator; bool FortranRuntimeDebug; bool FortranRuntimeDLL; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=70c50aa23cc993a502cd3c87be8afb79d973b50e commit 70c50aa23cc993a502cd3c87be8afb79d973b50e Author: Brad King AuthorDate: Mon Mar 26 07:29:48 2018 -0400 Commit: Brad King CommitDate: Mon Mar 26 07:44:22 2018 -0400 Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF" Revert commit v3.8.0-rc1~305^2 (Remove CTestTestfile.cmake when BUILD_TESTING is OFF, 2016-11-14) again. We reverted it once in commit v3.8.0-rc3~22^2 (Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF", 2017-03-06) but it was accidentally restored by commit v3.11.0-rc1~387^2 (server: add "ctestInfo" request to get test info, 2017-10-25), perhaps due to conflict resolution during rebase. We cannot remove `CTestTestfile.cmake` when testing is off because it breaks projects that never enable testing but create their own `CTestTestfile.cmake` manually instead. Revert the change again and add a test case. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cee540b..e942ff4 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -224,14 +224,7 @@ void cmLocalGenerator::TraceDependencies() void cmLocalGenerator::GenerateTestFiles() { - std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary(); - file += "/"; - file += "CTestTestfile.cmake"; - if (!this->Makefile->IsOn("CMAKE_TESTING_ENABLED")) { - if (cmSystemTools::FileExists(file)) { - cmSystemTools::RemoveFile(file); - } return; } @@ -240,6 +233,10 @@ void cmLocalGenerator::GenerateTestFiles() const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); + std::string file = this->StateSnapshot.GetDirectory().GetCurrentBinary(); + file += "/"; + file += "CTestTestfile.cmake"; + cmGeneratedFileStream fout(file.c_str()); fout.SetCopyIfDifferent(true); diff --git a/Tests/RunCMake/CTest/CTestTestfile.cmake.in b/Tests/RunCMake/CTest/CTestTestfile.cmake.in new file mode 100644 index 0000000..0763244 --- /dev/null +++ b/Tests/RunCMake/CTest/CTestTestfile.cmake.in @@ -0,0 +1 @@ +# Created manually diff --git a/Tests/RunCMake/CTest/NotOn-check.cmake b/Tests/RunCMake/CTest/NotOn-check.cmake new file mode 100644 index 0000000..b68218a --- /dev/null +++ b/Tests/RunCMake/CTest/NotOn-check.cmake @@ -0,0 +1,8 @@ +set(f "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake") +if(NOT EXISTS "${f}") + set(RunCMake_TEST_FAILED "File does not exist:\n ${f}") +endif() +file(READ ${f} content) +if(NOT "${content}" MATCHES "^# Created manually") + set(RunCMake_TEST_FAILED "File:\n ${f}\nhas unexpected content:\n ${content}") +endif() diff --git a/Tests/RunCMake/CTest/NotOn.cmake b/Tests/RunCMake/CTest/NotOn.cmake new file mode 100644 index 0000000..7fba019 --- /dev/null +++ b/Tests/RunCMake/CTest/NotOn.cmake @@ -0,0 +1,3 @@ +set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.") +include(CTest) +configure_file(CTestTestfile.cmake.in CTestTestfile.cmake) diff --git a/Tests/RunCMake/CTest/RunCMakeTest.cmake b/Tests/RunCMake/CTest/RunCMakeTest.cmake index a6f6842..1392240 100644 --- a/Tests/RunCMake/CTest/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTest/RunCMakeTest.cmake @@ -3,3 +3,5 @@ include(RunCMake) set(RunCMake_TEST_OPTIONS -DNoProject=1) run_cmake(BeforeProject) unset(RunCMake_TEST_OPTIONS) + +run_cmake(NotOn) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=85468e0754fb984aa5d042d07f8e52b67e969741 commit 85468e0754fb984aa5d042d07f8e52b67e969741 Author: Vitaly Stakhovsky AuthorDate: Thu Mar 22 18:31:29 2018 -0400 Commit: Vitaly Stakhovsky CommitDate: Thu Mar 22 18:31:29 2018 -0400 cmComputeLinkInformation: make some members const diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index b82fc43..6e6e0be 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -240,21 +240,19 @@ because this need be done only for shared libraries without soname-s. cmComputeLinkInformation::cmComputeLinkInformation( const cmGeneratorTarget* target, const std::string& config) -{ // Store context information. - this->Target = target; - this->Makefile = this->Target->Target->GetMakefile(); - this->GlobalGenerator = - this->Target->GetLocalGenerator()->GetGlobalGenerator(); - this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance(); - + : Target(target), + Makefile(target->Target->GetMakefile()), + GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator()), + CMakeInstance(this->GlobalGenerator->GetCMakeInstance()) + // The configuration being linked. + , + Config(config) +{ // Check whether to recognize OpenBSD-style library versioned names. this->OpenBSD = this->Makefile->GetState()->GetGlobalPropertyAsBool( "FIND_LIBRARY_USE_OPENBSD_VERSIONING"); - // The configuration being linked. - this->Config = config; - // Allocate internals. this->OrderLinkerSearchPath = new cmOrderDirectories( this->GlobalGenerator, target, "linker search path"); @@ -412,11 +410,12 @@ cmComputeLinkInformation::GetItems() const } std::vector const& cmComputeLinkInformation::GetDirectories() + const { return this->OrderLinkerSearchPath->GetOrderedDirectories(); } -std::string cmComputeLinkInformation::GetRPathLinkString() +std::string cmComputeLinkInformation::GetRPathLinkString() const { // If there is no separate linker runtime search flag (-rpath-link) // there is no reason to compute a string. @@ -428,18 +427,19 @@ std::string cmComputeLinkInformation::GetRPathLinkString() return cmJoin(this->OrderDependentRPath->GetOrderedDirectories(), ":"); } -std::vector const& cmComputeLinkInformation::GetDepends() +std::vector const& cmComputeLinkInformation::GetDepends() const { return this->Depends; } std::vector const& cmComputeLinkInformation::GetFrameworkPaths() + const { return this->FrameworkPaths; } const std::set& -cmComputeLinkInformation::GetSharedLibrariesLinked() +cmComputeLinkInformation::GetSharedLibrariesLinked() const { return this->SharedLibrariesLinked; } @@ -1026,7 +1026,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item) (generator.find("Visual Studio") != std::string::npos || generator.find("Xcode") != std::string::npos)) { std::string file = cmSystemTools::GetFilenameName(item); - if (!this->ExtractAnyLibraryName.find(file.c_str())) { + if (!this->ExtractAnyLibraryName.find(file)) { this->HandleBadFullItem(item, file); return; } @@ -1233,7 +1233,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item, void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) { // Try to separate the framework name and path. - if (!this->SplitFramework.find(item.c_str())) { + if (!this->SplitFramework.find(item)) { std::ostringstream e; e << "Could not parse framework path \"" << item << "\" " << "linked by target " << this->Target->GetName() << "."; @@ -1572,7 +1572,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() } std::vector const& -cmComputeLinkInformation::GetRuntimeSearchPath() +cmComputeLinkInformation::GetRuntimeSearchPath() const { return this->OrderRuntimeSearchPath->GetOrderedDirectories(); } @@ -1638,7 +1638,7 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo( if (!is_shared_library) { // On some platforms (AIX) a shared library may look static. if (this->ArchivesMayBeShared) { - if (this->ExtractStaticLibraryName.find(file.c_str())) { + if (this->ExtractStaticLibraryName.find(file)) { // This is the name of a shared library or archive. is_shared_library = true; } @@ -1683,7 +1683,7 @@ static void cmCLI_ExpandListUnique(const char* str, } void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, - bool for_install) + bool for_install) const { // Select whether to generate runtime search directories. bool outputRuntime = @@ -1797,7 +1797,7 @@ void cmComputeLinkInformation::GetRPath(std::vector& runtimeDirs, cmCLI_ExpandListUnique(this->RuntimeAlways.c_str(), runtimeDirs, emitted); } -std::string cmComputeLinkInformation::GetRPathString(bool for_install) +std::string cmComputeLinkInformation::GetRPathString(bool for_install) const { // Get the directories to use. std::vector runtimeDirs; @@ -1825,7 +1825,7 @@ std::string cmComputeLinkInformation::GetRPathString(bool for_install) return rpath; } -std::string cmComputeLinkInformation::GetChrpathString() +std::string cmComputeLinkInformation::GetChrpathString() const { if (!this->RuntimeUseChrpath) { return ""; diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 6c67fb4..65c12da 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -49,20 +49,20 @@ public: }; typedef std::vector ItemVector; ItemVector const& GetItems() const; - std::vector const& GetDirectories(); - std::vector const& GetDepends(); - std::vector const& GetFrameworkPaths(); + std::vector const& GetDirectories() const; + std::vector const& GetDepends() const; + std::vector const& GetFrameworkPaths() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } - std::vector const& GetRuntimeSearchPath(); + std::vector const& GetRuntimeSearchPath() const; std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } std::string const& GetRuntimeSep() const { return this->RuntimeSep; } - void GetRPath(std::vector& runtimeDirs, bool for_install); - std::string GetRPathString(bool for_install); - std::string GetChrpathString(); - std::set const& GetSharedLibrariesLinked(); + void GetRPath(std::vector& runtimeDirs, bool for_install) const; + std::string GetRPathString(bool for_install) const; + std::string GetChrpathString() const; + std::set const& GetSharedLibrariesLinked() const; std::string const& GetRPathLinkFlag() const { return this->RPathLinkFlag; } - std::string GetRPathLinkString(); + std::string GetRPathLinkString() const; std::string GetConfig() const { return this->Config; } private: @@ -78,13 +78,13 @@ private: std::set SharedLibrariesLinked; // Context information. - cmGeneratorTarget const* Target; - cmMakefile* Makefile; - cmGlobalGenerator* GlobalGenerator; - cmake* CMakeInstance; + cmGeneratorTarget const* const Target; + cmMakefile* const Makefile; + cmGlobalGenerator* const GlobalGenerator; + cmake* const CMakeInstance; // Configuration information. - std::string Config; + std::string const Config; std::string LinkLanguage; // Modes for dealing with dependent shared libraries. ----------------------------------------------------------------------- Summary of changes: Source/cmComputeLinkInformation.cxx | 40 ++++++++-------- Source/cmComputeLinkInformation.h | 28 ++++++------ Source/cmLocalGenerator.cxx | 11 ++--- Source/cmLocalVisualStudio7Generator.cxx | 9 ++++ Source/cmLocalVisualStudio7Generator.h | 15 +++++- Source/cmVisualStudio10TargetGenerator.cxx | 66 +++++++++++++++++++-------- Source/cmVisualStudio10TargetGenerator.h | 4 +- Source/cmVisualStudioGeneratorOptions.cxx | 53 ++------------------- Source/cmVisualStudioGeneratorOptions.h | 18 +++----- Tests/RunCMake/CTest/CTestTestfile.cmake.in | 1 + Tests/RunCMake/CTest/NotOn-check.cmake | 8 ++++ Tests/RunCMake/CTest/NotOn.cmake | 3 ++ Tests/RunCMake/CTest/RunCMakeTest.cmake | 2 + 13 files changed, 134 insertions(+), 124 deletions(-) create mode 100644 Tests/RunCMake/CTest/CTestTestfile.cmake.in create mode 100644 Tests/RunCMake/CTest/NotOn-check.cmake create mode 100644 Tests/RunCMake/CTest/NotOn.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 27 08:15:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 27 Mar 2018 08:15:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-338-g760f83d Message-ID: <20180327121503.2FAD310318E@public.kitware.com> 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, master has been updated via 760f83d5c0d97359d1686ea4b56dabf2ac051a6d (commit) via 188c5c2a46173b0bcff928098fb406ad925fb3db (commit) from 99f3f6d528fb9e7e05c1618675d4c998fce3dd59 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=760f83d5c0d97359d1686ea4b56dabf2ac051a6d commit 760f83d5c0d97359d1686ea4b56dabf2ac051a6d Merge: 99f3f6d 188c5c2 Author: Brad King AuthorDate: Tue Mar 27 08:11:01 2018 -0400 Commit: Brad King CommitDate: Tue Mar 27 08:11:01 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 27 08:15:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 27 Mar 2018 08:15:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc4-6-g188c5c2 Message-ID: <20180327121503.9FA4B103263@public.kitware.com> 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, release has been updated via 188c5c2a46173b0bcff928098fb406ad925fb3db (commit) via 70c50aa23cc993a502cd3c87be8afb79d973b50e (commit) from 218471a35c59f134051058e0dc2e0947df0052b4 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/cmLocalGenerator.cxx | 11 ++++------- Tests/RunCMake/CTest/CTestTestfile.cmake.in | 1 + Tests/RunCMake/CTest/NotOn-check.cmake | 8 ++++++++ Tests/RunCMake/CTest/NotOn.cmake | 3 +++ Tests/RunCMake/CTest/RunCMakeTest.cmake | 2 ++ 5 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 Tests/RunCMake/CTest/CTestTestfile.cmake.in create mode 100644 Tests/RunCMake/CTest/NotOn-check.cmake create mode 100644 Tests/RunCMake/CTest/NotOn.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Tue Mar 27 08:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Tue, 27 Mar 2018 08:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-340-gd5f0b2d Message-ID: <20180327122503.6651E10A81F@public.kitware.com> 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, master has been updated via d5f0b2df8eaa7d4d266ac43384e7aa91e19107e2 (commit) via 8dc97acb03db6d3d2f9effd84fd81432a68aa23c (commit) from 760f83d5c0d97359d1686ea4b56dabf2ac051a6d (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d5f0b2df8eaa7d4d266ac43384e7aa91e19107e2 commit d5f0b2df8eaa7d4d266ac43384e7aa91e19107e2 Merge: 760f83d 8dc97ac Author: Craig Scott AuthorDate: Tue Mar 27 12:16:35 2018 +0000 Commit: Kitware Robot CommitDate: Tue Mar 27 08:16:46 2018 -0400 Merge topic 'cmake_minimum_required-forward-compat' 8dc97acb03 cmake_minimum_required: Tolerate unknown future arguments Acked-by: Kitware Robot Merge-request: !1888 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8dc97acb03db6d3d2f9effd84fd81432a68aa23c commit 8dc97acb03db6d3d2f9effd84fd81432a68aa23c Author: Brad King AuthorDate: Mon Mar 26 11:12:50 2018 -0400 Commit: Brad King CommitDate: Mon Mar 26 11:31:08 2018 -0400 cmake_minimum_required: Tolerate unknown future arguments When a `...` version is given that is larger than the running version of CMake, assume that the project is aware of a newer version of CMake and that any unknown arguments are future arguments. This will allow future versions of CMake to add arguments to the command that projects can use without introducing errors in older versions of CMake (back to 3.12). diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index c4834a8..2b51976 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -42,7 +42,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, // Make sure there was a version to check. if (version_string.empty()) { - return this->EnforceUnknownArguments(); + return this->EnforceUnknownArguments(std::string()); } // Separate the version and any trailing ... component. @@ -102,7 +102,7 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, } // The version is not from the future, so enforce unknown arguments. - if (!this->EnforceUnknownArguments()) { + if (!this->EnforceUnknownArguments(version_max)) { return false; } @@ -118,14 +118,39 @@ bool cmCMakeMinimumRequired::InitialPass(std::vector const& args, return true; } -bool cmCMakeMinimumRequired::EnforceUnknownArguments() +bool cmCMakeMinimumRequired::EnforceUnknownArguments( + std::string const& version_max) { - if (!this->UnknownArguments.empty()) { - std::ostringstream e; - e << "called with unknown argument \"" << this->UnknownArguments[0] - << "\"."; - this->SetError(e.str()); - return false; + if (this->UnknownArguments.empty()) { + return true; } - return true; + + // Consider the max version if at least two components were given. + unsigned int max_major = 0; + unsigned int max_minor = 0; + unsigned int max_patch = 0; + unsigned int max_tweak = 0; + if (sscanf(version_max.c_str(), "%u.%u.%u.%u", &max_major, &max_minor, + &max_patch, &max_tweak) >= 2) { + unsigned int current_major = cmVersion::GetMajorVersion(); + unsigned int current_minor = cmVersion::GetMinorVersion(); + unsigned int current_patch = cmVersion::GetPatchVersion(); + unsigned int current_tweak = cmVersion::GetTweakVersion(); + + if ((current_major < max_major) || + (current_major == max_major && current_minor < max_minor) || + (current_major == max_major && current_minor == max_minor && + current_patch < max_patch) || + (current_major == max_major && current_minor == max_minor && + current_patch == max_patch && current_tweak < max_tweak)) { + // A ... version was given that is larger than the current + // version of CMake, so tolerate unknown arguments. + return true; + } + } + + std::ostringstream e; + e << "called with unknown argument \"" << this->UnknownArguments[0] << "\"."; + this->SetError(e.str()); + return false; } diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 18d9460..f9b61e1 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/Source/cmCMakeMinimumRequired.h @@ -34,7 +34,7 @@ public: private: std::vector UnknownArguments; - bool EnforceUnknownArguments(); + bool EnforceUnknownArguments(std::string const& version_max); }; #endif diff --git a/Tests/RunCMake/cmake_minimum_required/Future.cmake b/Tests/RunCMake/cmake_minimum_required/Future.cmake new file mode 100644 index 0000000..2b5c445 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Future.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 3.11...99.0 SOME_FUTURE_OPTION) diff --git a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake index 22aa5b7..1030211 100644 --- a/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake +++ b/Tests/RunCMake/cmake_minimum_required/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(Before24) run_cmake(CompatBefore24) +run_cmake(Future) run_cmake(PolicyBefore24) run_cmake(Range) run_cmake(RangeBad) +run_cmake(Unknown) diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt b/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt b/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt new file mode 100644 index 0000000..d698642 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at Unknown.cmake:1 \(cmake_minimum_required\): + cmake_minimum_required called with unknown argument "SOME_UNKNOWN_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/cmake_minimum_required/Unknown.cmake b/Tests/RunCMake/cmake_minimum_required/Unknown.cmake new file mode 100644 index 0000000..6c70f91 --- /dev/null +++ b/Tests/RunCMake/cmake_minimum_required/Unknown.cmake @@ -0,0 +1 @@ +cmake_minimum_required(VERSION 3.11 SOME_UNKNOWN_OPTION) ----------------------------------------------------------------------- Summary of changes: Source/cmCMakeMinimumRequired.cxx | 45 +++++++++++++++----- Source/cmCMakeMinimumRequired.h | 2 +- Tests/RunCMake/cmake_minimum_required/Future.cmake | 1 + .../cmake_minimum_required/RunCMakeTest.cmake | 2 + .../Unknown-result.txt} | 0 .../cmake_minimum_required/Unknown-stderr.txt | 4 ++ .../RunCMake/cmake_minimum_required/Unknown.cmake | 1 + 7 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 Tests/RunCMake/cmake_minimum_required/Future.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => cmake_minimum_required/Unknown-result.txt} (100%) create mode 100644 Tests/RunCMake/cmake_minimum_required/Unknown-stderr.txt create mode 100644 Tests/RunCMake/cmake_minimum_required/Unknown.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 00:05:05 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 00:05:05 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-341-gcf39c14 Message-ID: <20180328040505.12BA810AED9@public.kitware.com> 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, master has been updated via cf39c14f46d2e7fc1302a6ec026e3b0efafecf9b (commit) from d5f0b2df8eaa7d4d266ac43384e7aa91e19107e2 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cf39c14f46d2e7fc1302a6ec026e3b0efafecf9b commit cf39c14f46d2e7fc1302a6ec026e3b0efafecf9b Author: Kitware Robot AuthorDate: Wed Mar 28 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Wed Mar 28 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9cbe5f9..cfb3b73 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180327) +set(CMake_VERSION_PATCH 20180328) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 07:25:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 07:25:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-344-g9dd7776 Message-ID: <20180328112506.B363610B972@public.kitware.com> 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, master has been updated via 9dd7776cd9b34d2bcfa7740ebd4f23f09ed434ca (commit) via 27f033550a3693df67a30ce94f3c5e60a7a337ec (commit) via 75e8af3354c42ce42abb4bece351fe1a8b99d96a (commit) from cf39c14f46d2e7fc1302a6ec026e3b0efafecf9b (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9dd7776cd9b34d2bcfa7740ebd4f23f09ed434ca commit 9dd7776cd9b34d2bcfa7740ebd4f23f09ed434ca Merge: cf39c14 27f0335 Author: Brad King AuthorDate: Wed Mar 28 11:23:14 2018 +0000 Commit: Kitware Robot CommitDate: Wed Mar 28 07:23:47 2018 -0400 Merge topic 'ctest_update-memory-problems' 27f033550a ctest_update: Fix crash when handling svn externals 75e8af3354 cmSystemTools: Fix ParseArguments out-of-bounds read Acked-by: Kitware Robot Merge-request: !1893 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=27f033550a3693df67a30ce94f3c5e60a7a337ec commit 27f033550a3693df67a30ce94f3c5e60a7a337ec Author: Brad King AuthorDate: Tue Mar 27 08:41:09 2018 -0400 Commit: Brad King CommitDate: Tue Mar 27 08:46:20 2018 -0400 ctest_update: Fix crash when handling svn externals Refactoring in commit v3.9.0-rc1~156^2 (c++: prefer vectors over lists, 2017-05-04) switched `cmCTestSVN::Repositories` from `std::list` to `std::vector`. This can cause re-allocation when svn externals are processed and break the `RootInfo` pointer that is supposed to point at the first repository element. Switch back to `std::list` so that the address remains stable. Fixes: #17854 diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index dbc7fde..a467ede 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -8,6 +8,7 @@ #include "cmCTestGlobalVC.h" #include +#include #include #include @@ -70,7 +71,8 @@ private: friend struct Revision; // Info of all the repositories (root, externals and nested ones). - std::vector Repositories; + // Use std::list so the elements don't move in memory. + std::list Repositories; // Pointer to the infos of the root repository. SVNInfo* RootInfo; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75e8af3354c42ce42abb4bece351fe1a8b99d96a commit 75e8af3354c42ce42abb4bece351fe1a8b99d96a Author: Brad King AuthorDate: Tue Mar 27 08:18:47 2018 -0400 Commit: Brad King CommitDate: Tue Mar 27 08:46:20 2018 -0400 cmSystemTools: Fix ParseArguments out-of-bounds read When checking for a Windows-style leading path, do not read past the null terminator. Issue: #17854 diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 88cfe81..eeb73c3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -550,12 +550,13 @@ std::vector cmSystemTools::ParseArguments(const char* command) bool win_path = false; - if ((command[0] != '/' && command[1] == ':' && command[2] == '\\') || - (command[0] == '\"' && command[1] != '/' && command[2] == ':' && - command[3] == '\\') || - (command[0] == '\'' && command[1] != '/' && command[2] == ':' && - command[3] == '\\') || - (command[0] == '\\' && command[1] == '\\')) { + if (command[0] && command[1] && + ((command[0] != '/' && command[1] == ':' && command[2] == '\\') || + (command[0] == '\"' && command[1] != '/' && command[2] == ':' && + command[3] == '\\') || + (command[0] == '\'' && command[1] != '/' && command[2] == ':' && + command[3] == '\\') || + (command[0] == '\\' && command[1] == '\\'))) { win_path = true; } // Split the command into an argv array. ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestSVN.h | 4 +++- Source/cmSystemTools.cxx | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 07:35:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 07:35:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-346-g5ee25f0 Message-ID: <20180328113507.749EC10C064@public.kitware.com> 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, master has been updated via 5ee25f01aed903649116bf7c4c886ab9d7b893b2 (commit) via 36881ee4169112147f0ce1e6422c879ced86fec2 (commit) from 9dd7776cd9b34d2bcfa7740ebd4f23f09ed434ca (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5ee25f01aed903649116bf7c4c886ab9d7b893b2 commit 5ee25f01aed903649116bf7c4c886ab9d7b893b2 Merge: 9dd7776 36881ee Author: Brad King AuthorDate: Wed Mar 28 07:25:06 2018 -0400 Commit: Brad King CommitDate: Wed Mar 28 07:25:06 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 07:35:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 07:35:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc4-9-g36881ee Message-ID: <20180328113507.8E67F10C05D@public.kitware.com> 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, release has been updated via 36881ee4169112147f0ce1e6422c879ced86fec2 (commit) via 27f033550a3693df67a30ce94f3c5e60a7a337ec (commit) via 75e8af3354c42ce42abb4bece351fe1a8b99d96a (commit) from 188c5c2a46173b0bcff928098fb406ad925fb3db (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CTest/cmCTestSVN.h | 4 +++- Source/cmSystemTools.cxx | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 09:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 09:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-rc4-348-g98f23da Message-ID: <20180328130506.ECEBE10C0F1@public.kitware.com> 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, master has been updated via 98f23da8dfe4d6bb90225de83476b6a958c3e284 (commit) via 61fd4c742013a7f9139db190f936703b656540ff (commit) from 5ee25f01aed903649116bf7c4c886ab9d7b893b2 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98f23da8dfe4d6bb90225de83476b6a958c3e284 commit 98f23da8dfe4d6bb90225de83476b6a958c3e284 Merge: 5ee25f0 61fd4c7 Author: Brad King AuthorDate: Wed Mar 28 08:58:55 2018 -0400 Commit: Brad King CommitDate: Wed Mar 28 08:58:55 2018 -0400 Merge branch 'release-3.11' ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 09:05:07 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 09:05:07 -0400 (EDT) Subject: [Cmake-commits] CMake branch, release, updated. v3.11.0-rc4-10-g61fd4c7 Message-ID: <20180328130507.1674F10C0F2@public.kitware.com> 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, release has been updated via 61fd4c742013a7f9139db190f936703b656540ff (commit) from 36881ee4169112147f0ce1e6422c879ced86fec2 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Wed Mar 28 09:25:03 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Wed, 28 Mar 2018 09:25:03 -0400 (EDT) Subject: [Cmake-commits] CMake annotated tag, v3.11.0, created. v3.11.0 Message-ID: <20180328132503.B5A6010B618@public.kitware.com> 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 annotated tag, v3.11.0 has been created at 6fcd7af584670adc762fef0dc72bdb5648274e5d (tag) tagging 61fd4c742013a7f9139db190f936703b656540ff (commit) replaces v3.11.0-rc4 tagged by Brad King on Wed Mar 28 09:01:33 2018 -0400 - Log ----------------------------------------------------------------- CMake 3.11.0 -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEExsJlMku+vcNQtRPQLSzvEDSSFoQFAlq7ki0WHGJyYWQua2lu Z0BraXR3YXJlLmNvbQAKCRAtLO8QNJIWhN/gD/0dl2z8BzYKaEcjVjh+Gksh9152 v2n1MlqVtk83DoCyP9FbbmVJt27M8Nbp2hEdCslCMWKUQ2nIDgRpS7M+90TEwPfo Xb3qBQJmO0UrS3BAUNNVfAg4WFd7VnCAdXGMhWYs6ISYzs8veS6pNOQ/WptQRufD YLkLGgjx/s/qK0dDxv2k+NT+gnsSgPircDxu/ZsEmJCP6blUxOGhorOGFx8GGtew aGgZXnrtdUABBQ2KZ2pJgk2bWtvrJeXFU6OVHJb3fpP+/Kso7imoh0oPR4hrodxQ w2YptaVgjk7r+2iKYAapd9DYXfGpMa+WYHch9qF8vJ1XXv47Hv0oRnYZNxy57HYL j8w5BjjwXHuzUpGVzIQgDnxAdQDFNlZ5O9DfC/2XyvDUBbyOeEyIqyoyrqvcSWiZ YMO+YCHTvkqZW3Q9ncqQy4xTZABWW07vmJ0BOYeM+eYDr9I5IF+CloVSgmsQL1c4 fln0u5zFnAuhJu2GEHOQvdJ8iFtpG9ajkC+SBYomC1M7EPv4QIwwi77RHzqAi08p tQ6TNQ/2rWCXH/4N39f30IMKRc/62ThrdTGNGMxsLIKSB5zDg4vt5cuWLBom6bdQ E2kre5BzhhG25zNSGs36pVrzeKqV9YMRCW1waZP+7Lc6utE3lS7JV9jI2kc/HLcf OMCrLr3YDLB30gTB0g== =k97y -----END PGP SIGNATURE----- Brad King (9): Features: Record for SunPro 5.15 Merge branch 'sunpro-5.15' into release-3.11 Merge branch 'boost-1.67' into release-3.11 Revert "Remove CTestTestfile.cmake when BUILD_TESTING is OFF" Merge branch 'revert-CTestTestfile-removal-again' into release-3.11 cmSystemTools: Fix ParseArguments out-of-bounds read ctest_update: Fix crash when handling svn externals Merge branch 'ctest_update-memory-problems' into release-3.11 CMake 3.11.0 Roger Leigh (1): FindBoost: Add support for Boost 1.67 with Python version suffixes ----------------------------------------------------------------------- hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 29 00:05:04 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 29 Mar 2018 00:05:04 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-339-g08b49c2 Message-ID: <20180329040504.C785010B088@public.kitware.com> 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, master has been updated via 08b49c277daa5e833a2ff4673c8dd1ab003eb8d9 (commit) from 98f23da8dfe4d6bb90225de83476b6a958c3e284 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=08b49c277daa5e833a2ff4673c8dd1ab003eb8d9 commit 08b49c277daa5e833a2ff4673c8dd1ab003eb8d9 Author: Kitware Robot AuthorDate: Thu Mar 29 00:01:07 2018 -0400 Commit: Kitware Robot CommitDate: Thu Mar 29 00:01:07 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cfb3b73..99a1b56 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180328) +set(CMake_VERSION_PATCH 20180329) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Thu Mar 29 10:25:09 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Thu, 29 Mar 2018 10:25:09 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-347-g894a41f Message-ID: <20180329142509.B755A10AE35@public.kitware.com> 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, master has been updated via 894a41fc275b454e3d9da04b6e15244099269c74 (commit) via 3272677e634629628a6293614fd169ff66d72e0d (commit) via a03105ac8c821bd8a2fe269671b49862ae354db8 (commit) via cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7 (commit) via fd6c452986af2e85a259813aa01d90d454c28d4b (commit) via 7b173a29332af37eb285d8cf5924a44be3a944dd (commit) via ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268 (commit) via 80767dd50e9898002253f383e9029dcc9da9f4c4 (commit) from 08b49c277daa5e833a2ff4673c8dd1ab003eb8d9 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=894a41fc275b454e3d9da04b6e15244099269c74 commit 894a41fc275b454e3d9da04b6e15244099269c74 Merge: 3272677 80767dd Author: Brad King AuthorDate: Thu Mar 29 14:23:58 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 29 10:24:06 2018 -0400 Merge topic 'vs-simplify' 80767dd50e VS: Simplify XML code Acked-by: Kitware Robot Merge-request: !1895 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3272677e634629628a6293614fd169ff66d72e0d commit 3272677e634629628a6293614fd169ff66d72e0d Merge: a03105a 7b173a2 Author: Brad King AuthorDate: Thu Mar 29 14:21:36 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 29 10:21:48 2018 -0400 Merge topic 'genex-TARGET_NAME_IF_EXISTS' 7b173a2933 genex: Add TARGET_NAME_IF_EXISTS expression Acked-by: Kitware Robot Merge-request: !1890 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a03105ac8c821bd8a2fe269671b49862ae354db8 commit a03105ac8c821bd8a2fe269671b49862ae354db8 Merge: cdc6dd8 fd6c452 Author: Brad King AuthorDate: Thu Mar 29 14:16:55 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 29 10:17:18 2018 -0400 Merge topic 'remove-unused-variable' fd6c452986 cmTarget: Remove unused variable Acked-by: Kitware Robot Merge-request: !1898 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7 commit cdc6dd888e3ee70e79f9bdd0f518ce19772eaee7 Merge: 08b49c2 ae1cbff Author: Brad King AuthorDate: Thu Mar 29 14:16:04 2018 +0000 Commit: Kitware Robot CommitDate: Thu Mar 29 10:16:27 2018 -0400 Merge topic 'gcov-warning-message' ae1cbff07f CTest: The "Could not find gcov." message should not be a warning Acked-by: Kitware Robot Merge-request: !1894 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fd6c452986af2e85a259813aa01d90d454c28d4b commit fd6c452986af2e85a259813aa01d90d454c28d4b Author: Brad King AuthorDate: Wed Mar 28 11:09:01 2018 -0400 Commit: Brad King CommitDate: Wed Mar 28 11:09:56 2018 -0400 cmTarget: Remove unused variable Remove an unused variable and its containing local scope accidentally left by commit v3.11.0-rc1~44^2 (Reduce allocation of temporary values on heap, 2018-01-25). diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 6137223..231bd3b 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -721,12 +721,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, return; } - { - cmTarget::LibraryID tmp; - tmp.first = lib; - tmp.second = llt; - this->OriginalLinkLibraries.emplace_back(lib, llt); - } + this->OriginalLinkLibraries.emplace_back(lib, llt); // Add the explicit dependency information for libraries. This is // simply a set of libraries separated by ";". There should always https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7b173a29332af37eb285d8cf5924a44be3a944dd commit 7b173a29332af37eb285d8cf5924a44be3a944dd Author: Alex Turbov AuthorDate: Tue Mar 27 04:57:44 2018 +0300 Commit: Brad King CommitDate: Wed Mar 28 08:38:00 2018 -0400 genex: Add TARGET_NAME_IF_EXISTS expression Define `$` to mean `tgt` if the target exists and otherwise an empty string. diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst index d3514ab..0e73bd2 100644 --- a/Help/manual/cmake-generator-expressions.7.rst +++ b/Help/manual/cmake-generator-expressions.7.rst @@ -274,6 +274,9 @@ Available output expressions are: Marks ``...`` as being the name of a target. This is required if exporting targets to multiple dependent export sets. The ``...`` must be a literal name of a target- it may not contain generator expressions. +``$`` + Expands to the ``...`` if the given target exists, an empty string + otherwise. ``$`` Content of ``...`` except when evaluated in a link interface while propagating :ref:`Target Usage Requirements`, in which case it is the diff --git a/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst b/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst new file mode 100644 index 0000000..416e812 --- /dev/null +++ b/Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst @@ -0,0 +1,6 @@ +genex-TARGET_NAME_IF_EXISTS +--------------------------- + +* A new ``$`` + :manual:`generator expression ` + has been added. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index f444113..09b7faf 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -331,6 +331,40 @@ static const struct TargetExistsNode : public cmGeneratorExpressionNode } } targetExistsNode; +static const struct TargetNameIfExistsNode : public cmGeneratorExpressionNode +{ + TargetNameIfExistsNode() {} + + int NumExpectedParameters() const override { return 1; } + + std::string Evaluate( + const std::vector& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override + { + if (parameters.size() != 1) { + reportError(context, content->GetOriginalExpression(), + "$ expression requires one " + "parameter"); + return std::string(); + } + + std::string targetName = parameters.front(); + if (targetName.empty() || + !cmGeneratorExpression::IsValidTargetName(targetName)) { + reportError(context, content->GetOriginalExpression(), + "$ expression requires a " + "non-empty valid target name."); + return std::string(); + } + + return context->LG->GetMakefile()->FindTargetToUse(targetName) + ? targetName + : std::string(); + } +} targetNameIfExistsNode; + static const struct LowerCaseNode : public cmGeneratorExpressionNode { LowerCaseNode() {} @@ -1897,6 +1931,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode( nodeMap["TARGET_OBJECTS"] = &targetObjectsNode; nodeMap["TARGET_POLICY"] = &targetPolicyNode; nodeMap["TARGET_EXISTS"] = &targetExistsNode; + nodeMap["TARGET_NAME_IF_EXISTS"] = &targetNameIfExistsNode; nodeMap["BUILD_INTERFACE"] = &buildInterfaceNode; nodeMap["INSTALL_INTERFACE"] = &installInterfaceNode; nodeMap["INSTALL_PREFIX"] = &installPrefixNode; diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake index f9a5cae..5636d00 100644 --- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake @@ -38,6 +38,10 @@ run_cmake(TARGET_EXISTS-no-arg) run_cmake(TARGET_EXISTS-empty-arg) run_cmake(TARGET_EXISTS) run_cmake(TARGET_EXISTS-not-a-target) +run_cmake(TARGET_NAME_IF_EXISTS-no-arg) +run_cmake(TARGET_NAME_IF_EXISTS-empty-arg) +run_cmake(TARGET_NAME_IF_EXISTS) +run_cmake(TARGET_NAME_IF_EXISTS-not-a-target) run_cmake(ImportedTarget-TARGET_BUNDLE_DIR) run_cmake(ImportedTarget-TARGET_BUNDLE_CONTENT_DIR) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake new file mode 100644 index 0000000..2f57430 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-check.cmake @@ -0,0 +1,6 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-generated.txt" content) + +set(expected "foo") +if(NOT content STREQUAL expected) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected:\n [[${expected}]]") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt new file mode 100644 index 0000000..5ee13b7 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TARGET_NAME_IF_EXISTS-empty-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires a non-empty valid target + name. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake new file mode 100644 index 0000000..f5034f4 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt new file mode 100644 index 0000000..4122425 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TARGET_NAME_IF_EXISTS-no-arg.cmake:2 \(file\): + Error evaluating generator expression: + + \$ + + \$ expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake new file mode 100644 index 0000000..3293094 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake new file mode 100644 index 0000000..2085c16 --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake @@ -0,0 +1,5 @@ +file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_NAME_IF_EXISTS-not-a-target-generated.txt" content) + +if(content) + set(RunCMake_TEST_FAILED "actual content:\n [[${content}]]\nbut expected an empty string") +endif() diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake new file mode 100644 index 0000000..a054e6c --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0070 NEW) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-not-a-target-generated.txt CONTENT "$") diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake new file mode 100644 index 0000000..0ce3b1d --- /dev/null +++ b/Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0070 NEW) +add_custom_target(foo) +file(GENERATE OUTPUT TARGET_NAME_IF_EXISTS-generated.txt CONTENT "$") https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268 commit ae1cbff07fb2c7fbb973e30f8bc79c31df1bf268 Author: Betsy McPhail AuthorDate: Tue Mar 27 14:59:58 2018 -0400 Commit: Brad King CommitDate: Wed Mar 28 08:32:46 2018 -0400 CTest: The "Could not find gcov." message should not be a warning It now matches the log level of other coverage messages. diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 6cf0ac2..bafbe9a 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -928,7 +928,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage( std::string gcovCommand = this->CTest->GetCTestConfiguration("CoverageCommand"); if (gcovCommand.empty()) { - cmCTestLog(this->CTest, WARNING, "Could not find gcov." << std::endl); + cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Could not find gcov." << std::endl, this->Quiet); return 0; } std::string gcovExtraFlags = https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=80767dd50e9898002253f383e9029dcc9da9f4c4 commit 80767dd50e9898002253f383e9029dcc9da9f4c4 Author: Vitaly Stakhovsky AuthorDate: Tue Mar 27 17:39:19 2018 -0400 Commit: Vitaly Stakhovsky CommitDate: Tue Mar 27 17:39:19 2018 -0400 VS: Simplify XML code Get rid of suffix arguments diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index c7bb38c..91ee09f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -792,10 +792,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( << "\\$(ConfigurationName)\"\n"; } targetOptions.OutputAdditionalIncludeDirectories( - fout, "\t\t\t\t", "\n", - this->FortranProject ? "Fortran" : langForClCompile); + fout, "\t\t\t\t", this->FortranProject ? "Fortran" : langForClCompile); targetOptions.OutputFlagMap(fout, "\t\t\t\t"); - targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", + targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", langForClCompile); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) { @@ -815,11 +814,10 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( "\t\t\t\tName=\"MASM\"\n" ; /* clang-format on */ - targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "\n", + targetOptions.OutputAdditionalIncludeDirectories(fout, "\t\t\t\t", "ASM_MASM"); // Use same preprocessor definitions as VCCLCompilerTool. - targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", - "ASM_MASM"); + targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "ASM_MASM"); masmOptions.OutputFlagMap(fout, "\t\t\t\t"); /* clang-format off */ fout << @@ -837,18 +835,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( tool = "VFResourceCompilerTool"; } fout << "\t\t\t\n"; + targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "RC"); + fout << "\t\t\t/>\n"; tool = "VCMIDLTool"; if (this->FortranProject) { tool = "VFMIDLTool"; } fout << "\t\t\tGetPlatformName() == "x64") { fout << "\t\t\t\tTargetEnvironment=\"3\"\n"; @@ -1686,9 +1682,9 @@ bool cmLocalVisualStudio7Generator::WriteGroup( fileOptions.AddIncludes(includes); fileOptions.OutputFlagMap(fout, "\t\t\t\t\t"); fileOptions.OutputAdditionalIncludeDirectories( - fout, "\t\t\t\t\t", "\n", + fout, "\t\t\t\t\t", ppLang == "CXX" && this->FortranProject ? "Fortran" : ppLang); - fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", "\n", + fileOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t\t", ppLang); } if (!fc.AdditionalDeps.empty()) { @@ -2071,7 +2067,7 @@ void cmVS7GeneratorOptions::OutputFlag(std::ostream& fout, const char* indent, { fout << indent << tag << "=\""; fout << cmLocalVisualStudio7GeneratorEscapeForXML(content); - fout << "\""; + fout << "\"\n"; } // This class is used to parse an existing vs 7 project diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f1aed88..4bd07ef 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -86,12 +86,12 @@ public: // use the configuration specific tag for PreprocessorDefinitions fout << indent; this->TargetGenerator->WritePlatformConfigTag( - tag, this->GetConfiguration(), 0, 0, 0, &fout); + tag, this->GetConfiguration(), 0); } else { fout << indent << "<" << tag << ">"; } fout << cmVS10EscapeXML(content); - fout << ""; + fout << "\n"; } private: @@ -218,12 +218,10 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( const char* tag, const std::string& config, int indentLevel, - const char* attribute, const char* end, std::ostream* stream) + const char* attribute) { - if (!stream) { - stream = this->BuildFileStream; - } + std::ostream* stream = this->BuildFileStream; stream->fill(' '); stream->width(indentLevel * 2); (*stream) << ""; // applies indentation @@ -244,8 +242,8 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag( } // close the tag (*stream) << ">"; - if (end) { - (*stream) << end; + if (attribute) { + (*stream) << "\n"; } } @@ -972,7 +970,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { for (std::string const& c : this->Configurations) { this->WritePlatformConfigTag("PropertyGroup", c, 1, - " Label=\"Configuration\"", "\n"); + " Label=\"Configuration\""); if (this->ProjectType != csproj) { std::string configType = ""; @@ -1312,8 +1310,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRuleCSharp( attributes << "\n Name=\"" << name << "\""; attributes << "\n Inputs=\"" << inputs << "\""; attributes << "\n Outputs=\"" << outputs << "\""; - this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str(), - "\n"); + this->WritePlatformConfigTag("Target", config, 1, attributes.str().c_str()); if (!comment.empty()) { this->WriteString("BuildFileStream) << "echo " << cmVS10EscapeXML(comment) @@ -2127,10 +2124,10 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( clOptions.SetConfiguration(config); clOptions.PrependInheritedString("AdditionalOptions"); clOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, - " ", "\n", lang); + " ", lang); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", lang); + lang); } } if (this->IsXamlSource(source->GetFullPath())) { @@ -2486,10 +2483,10 @@ void cmVisualStudio10TargetGenerator::WriteClOptions( this->WriteString("\n", 2); clOptions.PrependInheritedString("AdditionalOptions"); clOptions.OutputAdditionalIncludeDirectories( - *this->BuildFileStream, " ", "\n", this->LangForClCompile); + *this->BuildFileStream, " ", this->LangForClCompile); clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", this->LangForClCompile); + this->LangForClCompile); if (this->NsightTegra) { if (const char* processMax = @@ -2575,9 +2572,9 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions( Options& rcOptions = *(this->RcOptions[configName]); rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "RC"); + "RC"); rcOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, - " ", "\n", "RC"); + " ", "RC"); rcOptions.PrependInheritedString("AdditionalOptions"); rcOptions.OutputFlagMap(*this->BuildFileStream, " "); @@ -2711,9 +2708,9 @@ void cmVisualStudio10TargetGenerator::WriteCudaOptions( Options& cudaOptions = *(this->CudaOptions[configName]); cudaOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, - " ", "\n", "CUDA"); + " ", "CUDA"); cudaOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "CUDA"); + "CUDA"); cudaOptions.PrependInheritedString("AdditionalOptions"); cudaOptions.OutputFlagMap(*this->BuildFileStream, " "); @@ -2836,11 +2833,11 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions( // Preprocessor definitions and includes are shared with clOptions. Options& clOptions = *(this->ClOptions[configName]); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "ASM_MASM"); + "ASM_MASM"); Options& masmOptions = *(this->MasmOptions[configName]); masmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, - " ", "\n", "ASM_MASM"); + " ", "ASM_MASM"); masmOptions.PrependInheritedString("AdditionalOptions"); masmOptions.OutputFlagMap(*this->BuildFileStream, " "); @@ -2897,16 +2894,16 @@ void cmVisualStudio10TargetGenerator::WriteNasmOptions( this->GetIncludes(configName, "ASM_NASM"); Options& nasmOptions = *(this->NasmOptions[configName]); nasmOptions.OutputAdditionalIncludeDirectories(*this->BuildFileStream, - " ", "\n", "ASM_NASM"); + " ", "ASM_NASM"); nasmOptions.OutputFlagMap(*this->BuildFileStream, " "); nasmOptions.PrependInheritedString("AdditionalOptions"); nasmOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "ASM_NASM"); + "ASM_NASM"); // Preprocessor definitions and includes are shared with clOptions. Options& clOptions = *(this->ClOptions[configName]); clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "ASM_NASM"); + "ASM_NASM"); this->WriteString("\n", 2); } diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 87f735d..7106737 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -34,8 +34,7 @@ public: void Generate(); // used by cmVisualStudioGeneratorOptions void WritePlatformConfigTag(const char* tag, const std::string& config, - int indentLevel, const char* attribute = 0, - const char* end = 0, std::ostream* strm = 0); + int indentLevel, const char* attribute = 0); private: struct ToolSource diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 26fce4b..8b6f057 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -422,8 +422,7 @@ const std::string& cmVisualStudioGeneratorOptions::GetConfiguration() const } void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( - std::ostream& fout, const char* prefix, const char* suffix, - const std::string& lang) + std::ostream& fout, const char* prefix, const std::string& lang) { if (this->Defines.empty()) { return; @@ -462,12 +461,10 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions( } this->OutputFlag(fout, prefix, tag, oss.str()); - fout << suffix; } void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( - std::ostream& fout, const char* prefix, const char* suffix, - const std::string& lang) + std::ostream& fout, const char* prefix, const std::string& lang) { if (this->Includes.empty()) { return; @@ -512,7 +509,6 @@ void cmVisualStudioGeneratorOptions::OutputAdditionalIncludeDirectories( } this->OutputFlag(fout, prefix, tag, oss.str()); - fout << suffix; } void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, @@ -530,6 +526,5 @@ void cmVisualStudioGeneratorOptions::OutputFlagMap(std::ostream& fout, } this->OutputFlag(fout, indent, m.first.c_str(), oss.str()); - fout << "\n"; } } diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 40290d1..974ca62 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -78,11 +78,9 @@ public: bool IsManaged() const; // Write options to output. void OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, - const char* suffix, const std::string& lang); void OutputAdditionalIncludeDirectories(std::ostream& fout, const char* prefix, - const char* suffix, const std::string& lang); void OutputFlagMap(std::ostream& fout, const char* indent); void SetConfiguration(const std::string& config); ----------------------------------------------------------------------- Summary of changes: Help/manual/cmake-generator-expressions.7.rst | 3 ++ Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst | 6 +++ Source/CTest/cmCTestCoverageHandler.cxx | 3 +- Source/cmGeneratorExpressionNode.cxx | 35 +++++++++++++++ Source/cmLocalVisualStudio7Generator.cxx | 26 +++++------ Source/cmTarget.cxx | 7 +-- Source/cmVisualStudio10TargetGenerator.cxx | 45 +++++++++----------- Source/cmVisualStudio10TargetGenerator.h | 3 +- Source/cmVisualStudioGeneratorOptions.cxx | 9 +--- Source/cmVisualStudioGeneratorOptions.h | 2 - .../GeneratorExpression/RunCMakeTest.cmake | 4 ++ ...eck.cmake => TARGET_NAME_IF_EXISTS-check.cmake} | 4 +- .../TARGET_NAME_IF_EXISTS-empty-arg-result.txt} | 0 .../TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt | 9 ++++ .../TARGET_NAME_IF_EXISTS-empty-arg.cmake | 2 + .../TARGET_NAME_IF_EXISTS-no-arg-result.txt} | 0 .../TARGET_NAME_IF_EXISTS-no-arg-stderr.txt | 8 ++++ .../TARGET_NAME_IF_EXISTS-no-arg.cmake | 2 + .../TARGET_NAME_IF_EXISTS-not-a-target-check.cmake | 5 +++ .../TARGET_NAME_IF_EXISTS-not-a-target.cmake | 2 + .../TARGET_NAME_IF_EXISTS.cmake | 3 ++ 21 files changed, 119 insertions(+), 59 deletions(-) create mode 100644 Help/release/dev/genex-TARGET_NAME_IF_EXISTS.rst copy Tests/RunCMake/GeneratorExpression/{TARGET_EXISTS-check.cmake => TARGET_NAME_IF_EXISTS-check.cmake} (56%) copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-empty-arg.cmake copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-result.txt} (100%) create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg-stderr.txt create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-no-arg.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target-check.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS-not-a-target.cmake create mode 100644 Tests/RunCMake/GeneratorExpression/TARGET_NAME_IF_EXISTS.cmake hooks/post-receive -- CMake From kwrobot at kitware.com Fri Mar 30 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Fri, 30 Mar 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-348-g2fc79bc Message-ID: <20180330040506.54A5810CA35@public.kitware.com> 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, master has been updated via 2fc79bcb03dd2ea21caf4227e6e14a8d8d803bfb (commit) from 894a41fc275b454e3d9da04b6e15244099269c74 (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2fc79bcb03dd2ea21caf4227e6e14a8d8d803bfb commit 2fc79bcb03dd2ea21caf4227e6e14a8d8d803bfb Author: Kitware Robot AuthorDate: Fri Mar 30 00:01:09 2018 -0400 Commit: Kitware Robot CommitDate: Fri Mar 30 00:01:09 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 99a1b56..ca3f046 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180329) +set(CMake_VERSION_PATCH 20180330) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake From kwrobot at kitware.com Sat Mar 31 00:05:06 2018 From: kwrobot at kitware.com (Kitware Robot) Date: Sat, 31 Mar 2018 00:05:06 -0400 (EDT) Subject: [Cmake-commits] CMake branch, master, updated. v3.11.0-349-g1d5ad1f Message-ID: <20180331040506.B70C210CA1C@public.kitware.com> 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, master has been updated via 1d5ad1fdee1a40ead9beb4add10640095707e60e (commit) from 2fc79bcb03dd2ea21caf4227e6e14a8d8d803bfb (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 ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d5ad1fdee1a40ead9beb4add10640095707e60e commit 1d5ad1fdee1a40ead9beb4add10640095707e60e Author: Kitware Robot AuthorDate: Sat Mar 31 00:01:09 2018 -0400 Commit: Kitware Robot CommitDate: Sat Mar 31 00:01:09 2018 -0400 CMake Nightly Date Stamp diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ca3f046..8b620b9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 11) -set(CMake_VERSION_PATCH 20180330) +set(CMake_VERSION_PATCH 20180331) #set(CMake_VERSION_RC 1) ----------------------------------------------------------------------- Summary of changes: Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- CMake