diff options
83 files changed, 786 insertions, 491 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 25f17aa..21e8c46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,10 @@ if(CMAKE_BOOTSTRAP) unset(CMAKE_BOOTSTRAP CACHE) endif() +if(CMake_TEST_HOST_CMAKE) + get_filename_component(CMake_TEST_EXTERNAL_CMAKE "${CMAKE_COMMAND}" DIRECTORY) +endif() + if(NOT CMake_TEST_EXTERNAL_CMAKE) if(CMAKE_SYSTEM_NAME STREQUAL "HP-UX") message(FATAL_ERROR @@ -684,7 +688,7 @@ endif() # to a cdash4simpletest database. In these cases, the CDash dashboards # should be run first. # -if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x") +if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x" AND NOT CMake_TEST_NO_NETWORK) set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org") endif() diff --git a/Help/dev/source.rst b/Help/dev/source.rst index 47baff4..0f7488b 100644 --- a/Help/dev/source.rst +++ b/Help/dev/source.rst @@ -74,6 +74,8 @@ The CMake source tree is organized as follows. * ``Utilities/Release/``: Scripts used to package CMake itself for distribution on ``cmake.org``. + See `Utilities/Release/README.rst`_. .. _`CMake Documentation Guide`: documentation.rst .. _`Tests/README.rst`: ../../Tests/README.rst +.. _`Utilities/Release/README.rst`: ../../Utilities/Release/README.rst diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt index 810aaa9..0947e41 100644 --- a/Help/manual/OPTIONS_BUILD.txt +++ b/Help/manual/OPTIONS_BUILD.txt @@ -18,6 +18,9 @@ containing :command:`set` commands that use the ``CACHE`` option, not a cache-format file. + References to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` + within the script evaluate to the top-level source and build tree. + ``-D <var>:<type>=<value>, -D <var>=<value>`` Create or update a CMake ``CACHE`` entry. diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 62d23c7..def9700 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -316,6 +316,7 @@ Properties on Targets /prop_tgt/STATIC_LIBRARY_OPTIONS /prop_tgt/SUFFIX /prop_tgt/Swift_DEPENDENCIES_FILE + /prop_tgt/Swift_LANGUAGE_VERSION /prop_tgt/Swift_MODULE_DIRECTORY /prop_tgt/Swift_MODULE_NAME /prop_tgt/TYPE diff --git a/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst new file mode 100644 index 0000000..7579447 --- /dev/null +++ b/Help/prop_tgt/Swift_LANGUAGE_VERSION.rst @@ -0,0 +1,6 @@ +Swift_LANGUAGE_VERSION +---------------------- + +This property sets the language version for the Swift sources in the target. If +one is not specified, it will default to ``<CMAKE_Swift_LANGUAGE_VERSION>`` if +specified, otherwise it is the latest version supported by the compiler. diff --git a/Help/prop_tgt/VS_CONFIGURATION_TYPE.rst b/Help/prop_tgt/VS_CONFIGURATION_TYPE.rst index ff987ff..640bed5 100644 --- a/Help/prop_tgt/VS_CONFIGURATION_TYPE.rst +++ b/Help/prop_tgt/VS_CONFIGURATION_TYPE.rst @@ -4,6 +4,8 @@ VS_CONFIGURATION_TYPE Visual Studio project configuration type. Sets the ``ConfigurationType`` attribute for a generated Visual Studio project. +The property value may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. If this property is set, it overrides the default setting that is based on the target type (e.g. ``StaticLibrary``, ``Application``, ...). diff --git a/Help/release/dev/cmake-initial-cache-dirs.rst b/Help/release/dev/cmake-initial-cache-dirs.rst new file mode 100644 index 0000000..be91902 --- /dev/null +++ b/Help/release/dev/cmake-initial-cache-dirs.rst @@ -0,0 +1,6 @@ +cmake-initial-cache-dirs +------------------------ + +* The :manual:`cmake(1)` ``-C <initial-cache>`` option now evaluates the + initial cache script with :variable:`CMAKE_SOURCE_DIR` and + :variable:`CMAKE_BINARY_DIR` set to the top-level source and build trees. diff --git a/Help/release/dev/vs-configuration-type-genex.rst b/Help/release/dev/vs-configuration-type-genex.rst new file mode 100644 index 0000000..d930d5b --- /dev/null +++ b/Help/release/dev/vs-configuration-type-genex.rst @@ -0,0 +1,5 @@ +vs-configuration-type-genex +--------------------------- + +* :prop_tgt:`VS_CONFIGURATION_TYPE` now supports + :manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake index 4db4e18..f95e6e2 100644 --- a/Modules/GNUInstallDirs.cmake +++ b/Modules/GNUInstallDirs.cmake @@ -222,7 +222,8 @@ if(NOT DEFINED CMAKE_INSTALL_LIBDIR OR (_libdir_set # updated to the new default, unless the user explicitly changed it. endif() if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$" - AND NOT CMAKE_CROSSCOMPILING) + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/arch-release") if (EXISTS "/etc/debian_version") # is this a debian system ? if(CMAKE_LIBRARY_ARCHITECTURE) if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 7cd07a8..30bf83a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -493,8 +493,6 @@ set(SRCS cmCreateTestSourceList.h cmDefinePropertyCommand.cxx cmDefinePropertyCommand.h - cmDisallowedCommand.cxx - cmDisallowedCommand.h cmEnableLanguageCommand.cxx cmEnableLanguageCommand.h cmEnableTestingCommand.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index f72c20b..1b06e45 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 15) -set(CMake_VERSION_PATCH 20190827) +set(CMake_VERSION_PATCH 20190829) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 8f13d0e..d1ffcef 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -39,24 +39,31 @@ int cmCPackIFWGenerator::PackageFiles() // Run repogen if (!this->Installer.RemoteRepositories.empty()) { - std::string ifwCmd = this->RepoGen; + std::vector<std::string> ifwCmd; + std::string ifwArg; + + ifwCmd.emplace_back(this->RepoGen); if (this->IsVersionLess("2.0.0")) { - ifwCmd += " -c " + this->toplevel + "/config/config.xml"; + ifwCmd.emplace_back("-c"); + ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); } - ifwCmd += " -p " + this->toplevel + "/packages"; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(this->toplevel + "/packages"); if (!this->PkgsDirsVector.empty()) { for (std::string const& it : this->PkgsDirsVector) { - ifwCmd += " -p " + it; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(it); } } if (!this->RepoDirsVector.empty()) { if (!this->IsVersionLess("3.1")) { for (std::string const& rd : this->RepoDirsVector) { - ifwCmd += " --repository " + rd; + ifwCmd.emplace_back("--repository"); + ifwCmd.emplace_back(rd); } } else { cmCPackIFWLogger(WARNING, @@ -69,18 +76,21 @@ int cmCPackIFWGenerator::PackageFiles() } if (!this->OnlineOnly && !this->DownloadedPackages.empty()) { - ifwCmd += " -i "; + ifwCmd.emplace_back("-i"); std::set<cmCPackIFWPackage*>::iterator it = this->DownloadedPackages.begin(); - ifwCmd += (*it)->Name; + ifwArg = (*it)->Name; ++it; while (it != this->DownloadedPackages.end()) { - ifwCmd += "," + (*it)->Name; + ifwArg += "," + (*it)->Name; ++it; } + ifwCmd.emplace_back(ifwArg); } - ifwCmd += " " + this->toplevel + "/repository"; - cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl); + ifwCmd.emplace_back(this->toplevel + "/repository"); + cmCPackIFWLogger(VERBOSE, + "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl); std::string output; int retVal = 1; cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl); @@ -89,14 +99,15 @@ int cmCPackIFWGenerator::PackageFiles() cmDuration::zero()); if (!res || retVal) { cmGeneratedFileStream ofs(ifwTmpFile); - ofs << "# Run command: " << ifwCmd << std::endl + ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl << "# Output:" << std::endl << output << std::endl; - cmCPackIFWLogger(ERROR, - "Problem running IFW command: " - << ifwCmd << std::endl - << "Please check " << ifwTmpFile << " for errors" - << std::endl); + cmCPackIFWLogger( + ERROR, + "Problem running IFW command: " + << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl + << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl); return 0; } @@ -104,46 +115,55 @@ int cmCPackIFWGenerator::PackageFiles() !this->Repository.PatchUpdatesXml()) { cmCPackIFWLogger(WARNING, "Problem patch IFW \"Updates\" " - << "file: " - << this->toplevel + "/repository/Updates.xml" - << std::endl); + << "file: \"" << this->toplevel + << "/repository/Updates.xml\"" << std::endl); } cmCPackIFWLogger(OUTPUT, - "- repository: " << this->toplevel - << "/repository generated" << std::endl); + "- repository: \"" << this->toplevel + << "/repository\" generated" + << std::endl); } // Run binary creator { - std::string ifwCmd = - cmStrCat(this->BinCreator, " -c ", this->toplevel, "/config/config.xml"); + std::vector<std::string> ifwCmd; + std::string ifwArg; + + ifwCmd.emplace_back(this->BinCreator); + + ifwCmd.emplace_back("-c"); + ifwCmd.emplace_back(this->toplevel + "/config/config.xml"); if (!this->Installer.Resources.empty()) { - ifwCmd += " -r "; + ifwCmd.emplace_back("-r"); std::vector<std::string>::iterator it = this->Installer.Resources.begin(); std::string path = this->toplevel + "/resources/"; - ifwCmd += path + *it; + ifwArg = path + *it; ++it; while (it != this->Installer.Resources.end()) { - ifwCmd += "," + path + *it; + ifwArg += "," + path + *it; ++it; } + ifwCmd.emplace_back(ifwArg); } - ifwCmd += " -p " + this->toplevel + "/packages"; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(this->toplevel + "/packages"); if (!this->PkgsDirsVector.empty()) { for (std::string const& it : this->PkgsDirsVector) { - ifwCmd += " -p " + it; + ifwCmd.emplace_back("-p"); + ifwCmd.emplace_back(it); } } if (!this->RepoDirsVector.empty()) { if (!this->IsVersionLess("3.1")) { for (std::string const& rd : this->RepoDirsVector) { - ifwCmd += " --repository " + rd; + ifwCmd.emplace_back("--repository"); + ifwCmd.emplace_back(rd); } } else { cmCPackIFWLogger(WARNING, @@ -156,44 +176,48 @@ int cmCPackIFWGenerator::PackageFiles() } if (this->OnlineOnly) { - ifwCmd += " --online-only"; + ifwCmd.emplace_back("--online-only"); } else if (!this->DownloadedPackages.empty() && !this->Installer.RemoteRepositories.empty()) { - ifwCmd += " -e "; + ifwCmd.emplace_back("-e"); std::set<cmCPackIFWPackage*>::iterator it = this->DownloadedPackages.begin(); - ifwCmd += (*it)->Name; + ifwArg = (*it)->Name; ++it; while (it != this->DownloadedPackages.end()) { - ifwCmd += "," + (*it)->Name; + ifwArg += "," + (*it)->Name; ++it; } + ifwCmd.emplace_back(ifwArg); } else if (!this->DependentPackages.empty()) { - ifwCmd += " -i "; + ifwCmd.emplace_back("-i"); + ifwArg.clear(); // Binary std::set<cmCPackIFWPackage*>::iterator bit = this->BinaryPackages.begin(); while (bit != this->BinaryPackages.end()) { - ifwCmd += (*bit)->Name + ","; + ifwArg += (*bit)->Name + ","; ++bit; } // Depend DependenceMap::iterator it = this->DependentPackages.begin(); - ifwCmd += it->second.Name; + ifwArg += it->second.Name; ++it; while (it != this->DependentPackages.end()) { - ifwCmd += "," + it->second.Name; + ifwArg += "," + it->second.Name; ++it; } + ifwCmd.emplace_back(ifwArg); } // TODO: set correct name for multipackages if (!this->packageFileNames.empty()) { - ifwCmd += " " + this->packageFileNames[0]; + ifwCmd.emplace_back(this->packageFileNames[0]); } else { - ifwCmd += " installer"; - ifwCmd += this->OutputExtension; + ifwCmd.emplace_back("installer" + this->OutputExtension); } - cmCPackIFWLogger(VERBOSE, "Execute: " << ifwCmd << std::endl); + cmCPackIFWLogger(VERBOSE, + "Execute: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl); std::string output; int retVal = 1; cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl); @@ -202,14 +226,15 @@ int cmCPackIFWGenerator::PackageFiles() cmDuration::zero()); if (!res || retVal) { cmGeneratedFileStream ofs(ifwTmpFile); - ofs << "# Run command: " << ifwCmd << std::endl + ofs << "# Run command: " << cmSystemTools::PrintSingleCommand(ifwCmd) + << std::endl << "# Output:" << std::endl << output << std::endl; - cmCPackIFWLogger(ERROR, - "Problem running IFW command: " - << ifwCmd << std::endl - << "Please check " << ifwTmpFile << " for errors" - << std::endl); + cmCPackIFWLogger( + ERROR, + "Problem running IFW command: " + << cmSystemTools::PrintSingleCommand(ifwCmd) << std::endl + << "Please check \"" << ifwTmpFile << "\" for errors" << std::endl); return 0; } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 14f0c0c..f51ed0b 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2127,6 +2127,11 @@ bool cmCTest::ColoredOutputSupportedByConsole() return false; #else // On UNIX we need a non-dumb tty. + std::string clicolor_force; + if (cmSystemTools::GetEnv("CLICOLOR_FORCE", clicolor_force) && + !clicolor_force.empty() && clicolor_force != "0") { + return true; + } return ConsoleIsNotDumb(); #endif } diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index ead16d2..0285525 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -208,8 +208,7 @@ void GetScriptingCommands(cmState* state) "build_name", cmBuildNameCommand, cmPolicies::CMP0036, "The build_name command should not be called; see CMP0036."); state->AddDisallowedCommand( - "use_mangled_mesa", cm::make_unique<cmUseMangledMesaCommand>(), - cmPolicies::CMP0030, + "use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030, "The use_mangled_mesa command should not be called; see CMP0030."); #endif @@ -310,29 +309,24 @@ void GetProjectCommands(cmState* state) cm::make_unique<cmSourceGroupCommand>()); state->AddDisallowedCommand( - "export_library_dependencies", - cm::make_unique<cmExportLibraryDependenciesCommand>(), cmPolicies::CMP0033, + "export_library_dependencies", cmExportLibraryDependenciesCommand, + cmPolicies::CMP0033, "The export_library_dependencies command should not be called; " "see CMP0033."); state->AddDisallowedCommand( - "load_command", cm::make_unique<cmLoadCommandCommand>(), - cmPolicies::CMP0031, + "load_command", cmLoadCommandCommand, cmPolicies::CMP0031, "The load_command command should not be called; see CMP0031."); state->AddDisallowedCommand( - "output_required_files", cm::make_unique<cmOutputRequiredFilesCommand>(), - cmPolicies::CMP0032, + "output_required_files", cmOutputRequiredFilesCommand, cmPolicies::CMP0032, "The output_required_files command should not be called; see CMP0032."); state->AddDisallowedCommand( - "subdir_depends", cm::make_unique<cmSubdirDependsCommand>(), - cmPolicies::CMP0029, + "subdir_depends", cmSubdirDependsCommand, cmPolicies::CMP0029, "The subdir_depends command should not be called; see CMP0029."); state->AddDisallowedCommand( - "utility_source", cm::make_unique<cmUtilitySourceCommand>(), - cmPolicies::CMP0034, + "utility_source", cmUtilitySourceCommand, cmPolicies::CMP0034, "The utility_source command should not be called; see CMP0034."); state->AddDisallowedCommand( - "variable_requires", cm::make_unique<cmVariableRequiresCommand>(), - cmPolicies::CMP0035, + "variable_requires", cmVariableRequiresCommand, cmPolicies::CMP0035, "The variable_requires command should not be called; see CMP0035."); #endif } diff --git a/Source/cmDisallowedCommand.cxx b/Source/cmDisallowedCommand.cxx deleted file mode 100644 index aa1f90b..0000000 --- a/Source/cmDisallowedCommand.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "cmDisallowedCommand.h" - -#include "cmMakefile.h" -#include "cmMessageType.h" - -class cmExecutionStatus; - -bool cmDisallowedCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) -{ - switch (this->Makefile->GetPolicyStatus(this->Policy)) { - case cmPolicies::WARN: - this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(this->Policy)); - break; - case cmPolicies::OLD: - break; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - this->Makefile->IssueMessage(MessageType::FATAL_ERROR, this->Message); - return true; - } - - this->Command->SetExecutionStatus(this->GetExecutionStatus()); - return this->Command->InitialPass(args, status); -} diff --git a/Source/cmDisallowedCommand.h b/Source/cmDisallowedCommand.h deleted file mode 100644 index e07f255..0000000 --- a/Source/cmDisallowedCommand.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef cmDisallowedCommand_h -#define cmDisallowedCommand_h - -#include "cmConfigure.h" // IWYU pragma: keep - -#include <string> -#include <utility> -#include <vector> - -#include "cm_memory.hxx" - -#include "cmCommand.h" -#include "cmPolicies.h" - -class cmExecutionStatus; - -class cmDisallowedCommand : public cmCommand -{ -public: - cmDisallowedCommand(std::unique_ptr<cmCommand> command, - cmPolicies::PolicyID policy, const char* message) - : Command(std::move(command)) - , Policy(policy) - , Message(message) - { - } - - ~cmDisallowedCommand() override = default; - - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmDisallowedCommand>(this->Command->Clone(), - this->Policy, this->Message); - } - - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; - -private: - std::unique_ptr<cmCommand> Command; - cmPolicies::PolicyID Policy; - const char* Message; -}; - -#endif diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 81237db..bab394a 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -8,6 +8,7 @@ #include "cm_memory.hxx" +#include "cmExecutionStatus.h" #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" @@ -18,8 +19,6 @@ #include "cmTargetLinkLibraryType.h" #include "cmake.h" -class cmExecutionStatus; - static void FinalAction(cmMakefile& makefile, std::string const& filename, bool append) { @@ -140,19 +139,20 @@ static void FinalAction(cmMakefile& makefile, std::string const& filename, fout << "endif()\n"; } -bool cmExportLibraryDependenciesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.empty()) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } std::string const& filename = args[0]; bool const append = args.size() > 1 && args[1] == "APPEND"; - this->Makefile->AddFinalAction([filename, append](cmMakefile& makefile) { - FinalAction(makefile, filename, append); - }); + status.GetMakefile().AddFinalAction( + [filename, append](cmMakefile& makefile) { + FinalAction(makefile, filename, append); + }); return true; } diff --git a/Source/cmExportLibraryDependenciesCommand.h b/Source/cmExportLibraryDependenciesCommand.h index 4817162..230c906 100644 --- a/Source/cmExportLibraryDependenciesCommand.h +++ b/Source/cmExportLibraryDependenciesCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmExportLibraryDependenciesCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmExportLibraryDependenciesCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmExportLibraryDependenciesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index d8a1a49..487d0de 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -365,7 +365,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( // check whether it is a C/C++/CUDA implementation file bool isCFile = false; - std::string lang = s->GetLanguage(); + std::string lang = s->GetOrDetermineLanguage(); if (lang == "C" || lang == "CXX" || lang == "CUDA") { std::string const& srcext = s->GetExtension(); isCFile = cm->IsSourceExtension(srcext); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 33f5157..6f4472b 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -342,7 +342,7 @@ std::string cmExtraSublimeTextGenerator::ComputeFlagsForObject( cmSourceFile* source, cmLocalGenerator* lg, cmGeneratorTarget* gtgt) { std::string flags; - std::string language = source->GetLanguage(); + std::string language = source->GetOrDetermineLanguage(); if (language.empty()) { language = "C"; } @@ -377,7 +377,7 @@ std::string cmExtraSublimeTextGenerator::ComputeDefines( { std::set<std::string> defines; cmMakefile* makefile = lg->GetMakefile(); - const std::string& language = source->GetLanguage(); + const std::string& language = source->GetOrDetermineLanguage(); const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target, language); @@ -410,7 +410,7 @@ std::string cmExtraSublimeTextGenerator::ComputeIncludes( { std::vector<std::string> includes; cmMakefile* makefile = lg->GetMakefile(); - const std::string& language = source->GetLanguage(); + const std::string& language = source->GetOrDetermineLanguage(); const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmGeneratorExpressionInterpreter genexInterpreter(lg, config, target, language); diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index e4b7670..08db7c7 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -837,7 +837,7 @@ CompileData Target::BuildCompileData(cmSourceFile* sf) { CompileData fd; - fd.Language = sf->GetLanguage(); + fd.Language = sf->GetOrDetermineLanguage(); if (fd.Language.empty()) { return fd; } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 191d7bb..cdc5f63 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -145,7 +145,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) // look for old style // FIND_*(VAR name path1 path2 ...) - if (!newStyle) { + if (!newStyle && !this->Names.empty()) { // All the short-hand arguments have been recorded as names. std::vector<std::string> shortArgs = this->Names; this->Names.clear(); // clear out any values in Names diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3048c5f..1d64f1c 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1593,7 +1593,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, kind = SourceKindHeader; } else if (sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { kind = SourceKindExternalObject; - } else if (!sf->GetLanguage().empty()) { + } else if (!sf->GetOrDetermineLanguage().empty()) { kind = SourceKindObjectSource; } else if (ext == "def") { kind = SourceKindModuleDefinition; @@ -6055,7 +6055,7 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, std::vector<cmSourceFile*> sourceFiles; this->GetSourceFiles(sourceFiles, config); for (cmSourceFile* src : sourceFiles) { - const std::string& lang = src->GetLanguage(); + const std::string& lang = src->GetOrDetermineLanguage(); if (!lang.empty()) { languages.insert(lang); } diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index a16076d..5c1c8a5 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -24,10 +24,6 @@ bool cmGetSourceFilePropertyCommand::InitialPass( sf = this->Makefile->CreateSource(file); } if (sf) { - if (args[2] == "LANGUAGE") { - this->Makefile->AddDefinition(var, sf->GetLanguage()); - return true; - } const char* prop = nullptr; if (!args[2].empty()) { prop = sf->GetPropertyForUser(args[2]); diff --git a/Source/cmJsonObjects.cxx b/Source/cmJsonObjects.cxx index b8eed13..4948b01 100644 --- a/Source/cmJsonObjects.cxx +++ b/Source/cmJsonObjects.cxx @@ -264,7 +264,7 @@ static Json::Value DumpSourceFilesList( std::unordered_map<LanguageData, std::vector<std::string>> fileGroups; for (cmSourceFile* file : files) { LanguageData fileData; - fileData.Language = file->GetLanguage(); + fileData.Language = file->GetOrDetermineLanguage(); if (!fileData.Language.empty()) { const LanguageData& ld = languageDataMap.at(fileData.Language); cmLocalGenerator* lg = target->GetLocalGenerator(); diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 180e65b..f650eb1 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -14,14 +14,14 @@ #include "cmCPluginAPI.cxx" #include "cmCPluginAPI.h" +#include "cmCommand.h" #include "cmDynamicLoader.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; - #ifdef __QNX__ # include <malloc.h> /* for malloc/free on QNX */ #endif @@ -175,8 +175,8 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args, } // namespace // cmLoadCommandCommand -bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmLoadCommandCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.empty()) { return true; @@ -185,13 +185,13 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // Construct a variable to report what file was loaded, if any. // Start by removing the definition in case of failure. std::string reportVar = cmStrCat("CMAKE_LOADED_COMMAND_", args[0]); - this->Makefile->RemoveDefinition(reportVar); + status.GetMakefile().RemoveDefinition(reportVar); // the file must exist std::string moduleName = cmStrCat( - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_MODULE_PREFIX"), "cm", - args[0], - this->Makefile->GetRequiredDefinition("CMAKE_SHARED_MODULE_SUFFIX")); + status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_PREFIX"), + "cm", args[0], + status.GetMakefile().GetRequiredDefinition("CMAKE_SHARED_MODULE_SUFFIX")); // search for the file std::vector<std::string> path; @@ -209,7 +209,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, if (fullPath.empty()) { std::ostringstream e; e << "Attempt to load command failed from file \"" << moduleName << "\""; - this->SetError(e.str()); + status.SetError(e.str()); return false; } @@ -224,12 +224,12 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, err += " Additional error info is:\n"; err += error; } - this->SetError(err); + status.SetError(err); return false; } // Report what file was loaded for this command. - this->Makefile->AddDefinition(reportVar, fullPath); + status.GetMakefile().AddDefinition(reportVar, fullPath); // find the init function std::string initFuncName = args[0] + "Init"; @@ -243,12 +243,12 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // if the symbol is found call it to set the name on the // function blocker if (initFunction) { - this->Makefile->GetState()->AddScriptedCommand( + status.GetMakefile().GetState()->AddScriptedCommand( args[0], cmLegacyCommandWrapper(cm::make_unique<cmLoadedCommand>(initFunction))); return true; } - this->SetError("Attempt to load command failed. " - "No init function found."); + status.SetError("Attempt to load command failed. " + "No init function found."); return false; } diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index d81cefb..f5fd754 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmLoadCommandCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmLoadCommandCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmLoadCommandCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 57dabd1..2e40543 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1564,6 +1564,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, this->AddConfigVariableFlags(flags, cmStrCat("CMAKE_", lang, "_FLAGS"), config); + if (lang == "Swift") { + if (const char* v = target->GetProperty("Swift_LANGUAGE_VERSION")) { + if (cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER_EQUAL, + this->Makefile->GetDefinition("CMAKE_Swift_COMPILER_VERSION"), + "4.2")) { + this->AppendFlags(flags, "-swift-version " + std::string(v)); + } + } + } + // Add MSVC runtime library flags. This is activated by the presence // of a default selection whether or not it is overridden by a property. const char* msvcRuntimeLibraryDefault = diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index dbb7111..3d8ebc3 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -5,9 +5,12 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" #include <map> +#include <set> +#include <stdio.h> #include <utility> #include "cmAlgorithms.h" +#include "cmExecutionStatus.h" #include "cmGeneratorExpression.h" #include "cmMakefile.h" #include "cmSourceFile.h" @@ -15,8 +18,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" -class cmExecutionStatus; - +namespace { /** \class cmDependInformation * \brief Store dependency information for a single source file. * @@ -452,43 +454,47 @@ protected: DirectoryToFileToPathMapType DirectoryToFileToPathMap; }; +void ListDependencies(cmDependInformation const* info, FILE* fout, + std::set<cmDependInformation const*>* visited); +} + // cmOutputRequiredFilesCommand -bool cmOutputRequiredFilesCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() != 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } // store the arg for final pass - this->File = args[0]; - this->OutputFile = args[1]; + const std::string& file = args[0]; + const std::string& outputFile = args[1]; // compute the list of files cmLBDepend md; - md.SetMakefile(this->Makefile); - md.AddSearchPath(this->Makefile->GetCurrentSourceDirectory()); + md.SetMakefile(&status.GetMakefile()); + md.AddSearchPath(status.GetMakefile().GetCurrentSourceDirectory()); // find the depends for a file - const cmDependInformation* info = md.FindDependencies(this->File.c_str()); + const cmDependInformation* info = md.FindDependencies(file.c_str()); if (info) { // write them out - FILE* fout = cmsys::SystemTools::Fopen(this->OutputFile, "w"); + FILE* fout = cmsys::SystemTools::Fopen(outputFile, "w"); if (!fout) { - this->SetError(cmStrCat("Can not open output file: ", this->OutputFile)); + status.SetError(cmStrCat("Can not open output file: ", outputFile)); return false; } std::set<cmDependInformation const*> visited; - this->ListDependencies(info, fout, &visited); + ListDependencies(info, fout, &visited); fclose(fout); } return true; } -void cmOutputRequiredFilesCommand::ListDependencies( - cmDependInformation const* info, FILE* fout, - std::set<cmDependInformation const*>* visited) +namespace { +void ListDependencies(cmDependInformation const* info, FILE* fout, + std::set<cmDependInformation const*>* visited) { // add info to the visited set visited->insert(info); @@ -503,7 +509,8 @@ void cmOutputRequiredFilesCommand::ListDependencies( fprintf(fout, "%s\n", d->FullPath.c_str()); } } - this->ListDependencies(d, fout, visited); + ListDependencies(d, fout, visited); } } } +} diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index faffabd..4c11894 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -5,34 +5,12 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include <set> -#include <stdio.h> #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - -class cmDependInformation; class cmExecutionStatus; -class cmOutputRequiredFilesCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmOutputRequiredFilesCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; - - void ListDependencies(cmDependInformation const* info, FILE* fout, - std::set<cmDependInformation const*>* visited); - -private: - std::string File; - std::string OutputFile; -}; +bool cmOutputRequiredFilesCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index 133bae5..84359f2 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -949,7 +949,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEval(SourceFileMapT const& fileMap) } bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( - SourceFileHandleT sourceFileHandle) + SourceFileHandleT const& sourceFileHandle) { SourceFileT const& sourceFile = *sourceFileHandle; auto const& Include = sourceFile.ParseData->Uic.Include; @@ -967,7 +967,7 @@ bool cmQtAutoMocUic::JobEvaluateT::UicEvalFile( } // Register mapping if (!UicRegisterMapping(incKey.Key, std::move(uiFileHandle), - std::move(sourceFileHandle))) { + sourceFileHandle)) { return false; } } diff --git a/Source/cmQtAutoMocUic.h b/Source/cmQtAutoMocUic.h index e4c0d66..f676c57 100644 --- a/Source/cmQtAutoMocUic.h +++ b/Source/cmQtAutoMocUic.h @@ -440,7 +440,7 @@ public: // -- Uic bool UicEval(SourceFileMapT const& fileMap); - bool UicEvalFile(SourceFileHandleT sourceFileHandle); + bool UicEvalFile(SourceFileHandleT const& sourceFileHandle); SourceFileHandleT UicFindIncludedUi(std::string const& sourceFile, std::string const& sourceDir, IncludeKeyT const& incKey) const; diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index a6d2807..5d738d5 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -45,11 +45,13 @@ std::string cmSourceFile::GetObjectLibrary() const return this->ObjectLibrary; } -std::string cmSourceFile::GetLanguage() +std::string const& cmSourceFile::GetOrDetermineLanguage() { // If the language was set explicitly by the user then use it. if (const char* lang = this->GetProperty(propLANGUAGE)) { - return lang; + // Assign to member in order to return a reference. + this->Language = lang; + return this->Language; } // Perform computation needed to get the language if necessary. @@ -72,8 +74,8 @@ std::string cmSourceFile::GetLanguage() } } - // Now try to determine the language. - return static_cast<cmSourceFile const*>(this)->GetLanguage(); + // Use the language determined from the file extension. + return this->Language; } std::string cmSourceFile::GetLanguage() const @@ -83,13 +85,8 @@ std::string cmSourceFile::GetLanguage() const return lang; } - // If the language was determined from the source file extension use it. - if (!this->Language.empty()) { - return this->Language; - } - - // The language is not known. - return ""; + // Use the language determined from the file extension. + return this->Language; } cmSourceFileLocation const& cmSourceFile::GetLocation() const @@ -275,6 +272,13 @@ const char* cmSourceFile::GetPropertyForUser(const std::string& prop) this->GetFullPath(); } + // Similarly, LANGUAGE can be determined by the file extension + // if it is requested by the user. + if (prop == propLANGUAGE) { + // The c_str pointer is valid until `this->Language` is modified. + return this->GetOrDetermineLanguage().c_str(); + } + // Perform the normal property lookup. return this->GetProperty(prop); } diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index edad4c7..ccd5b62 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -88,7 +88,7 @@ public: /** * Get the language of the compiler to use for this source file. */ - std::string GetLanguage(); + std::string const& GetOrDetermineLanguage(); std::string GetLanguage() const; /** diff --git a/Source/cmState.cxx b/Source/cmState.cxx index b6f1808..902287c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -14,7 +14,6 @@ #include "cmCacheManager.h" #include "cmCommand.h" #include "cmDefinitions.h" -#include "cmDisallowedCommand.h" #include "cmExecutionStatus.h" #include "cmGlobVerificationManager.h" #include "cmListFileCache.h" @@ -485,16 +484,6 @@ void cmState::AddDisallowedCommand(std::string const& name, }); } -void cmState::AddDisallowedCommand(std::string const& name, - std::unique_ptr<cmCommand> command, - cmPolicies::PolicyID policy, - const char* message) -{ - this->AddBuiltinCommand( - name, - cm::make_unique<cmDisallowedCommand>(std::move(command), policy, message)); -} - void cmState::AddUnexpectedCommand(std::string const& name, const char* error) { this->AddBuiltinCommand( diff --git a/Source/cmState.h b/Source/cmState.h index 937ab61..a7ca015 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -159,9 +159,6 @@ public: void AddBuiltinCommand(std::string const& name, BuiltinCommand command); void AddDisallowedCommand(std::string const& name, BuiltinCommand command, cmPolicies::PolicyID policy, const char* message); - void AddDisallowedCommand(std::string const& name, - std::unique_ptr<cmCommand> command, - cmPolicies::PolicyID policy, const char* message); void AddUnexpectedCommand(std::string const& name, const char* error); void AddScriptedCommand(std::string const& name, Command command); void RemoveBuiltinCommand(std::string const& name); diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index 0bb2c0a..496c60d 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -4,8 +4,8 @@ class cmExecutionStatus; -bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const&, - cmExecutionStatus&) +bool cmSubdirDependsCommand(std::vector<std::string> const&, + cmExecutionStatus&) { return true; } diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index 64c28b9..bf99bd1 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmSubdirDependsCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmSubdirDependsCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmSubdirDependsCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index df37d32..5311d38 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -346,6 +346,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("LINK_SEARCH_START_STATIC"); initProp("LINK_SEARCH_END_STATIC"); initProp("FOLDER"); + initProp("Swift_LANGUAGE_VERSION"); initProp("Swift_MODULE_DIRECTORY"); initProp("VS_JUST_MY_CODE_DEBUGGING"); #ifdef __APPLE__ diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 3d83760..cfc00e8 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -5,26 +5,30 @@ #include "cmsys/FStream.hxx" #include "cmsys/RegularExpression.hxx" +#include "cmExecutionStatus.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; +namespace { +void CopyAndFullPathMesaHeader(const std::string& source, + const std::string& outdir); +} -bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmUseMangledMesaCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { // expected two arguments: // argument one: the full path to gl_mangle.h // argument two : directory for output of edited headers if (args.size() != 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } const std::string& inputDir = args[0]; std::string glh = cmStrCat(inputDir, "/gl.h"); if (!cmSystemTools::FileExists(glh)) { std::string e = cmStrCat("Bad path to Mesa, could not find: ", glh, ' '); - this->SetError(e); + status.SetError(e); return false; } const std::string& destDir = args[1]; @@ -37,14 +41,15 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, cmSystemTools::MakeDirectory(destDir); for (std::string const& f : files) { std::string path = cmStrCat(inputDir, '/', f); - this->CopyAndFullPathMesaHeader(path, destDir); + CopyAndFullPathMesaHeader(path, destDir); } return true; } -void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( - const std::string& source, const std::string& outdir) +namespace { +void CopyAndFullPathMesaHeader(const std::string& source, + const std::string& outdir) { std::string dir; std::string file; @@ -96,3 +101,4 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile); cmSystemTools::RemoveFile(tempOutputFile); } +} diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 1c01596..215e4a3 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -8,25 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmUseMangledMesaCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmUseMangledMesaCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; - -protected: - void CopyAndFullPathMesaHeader(const std::string& source, - const std::string& outdir); -}; +bool cmUseMangledMesaCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index d255b67..25fe4ad 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -4,20 +4,19 @@ #include <string.h> +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmState.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; - // cmUtilitySourceCommand -bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) +bool cmUtilitySourceCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() < 3) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } @@ -25,15 +24,15 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, // The first argument is the cache entry name. std::string const& cacheEntry = *arg++; - const char* cacheValue = this->Makefile->GetDefinition(cacheEntry); + const char* cacheValue = status.GetMakefile().GetDefinition(cacheEntry); // If it exists already and appears up to date then we are done. If // the string contains "(IntDir)" but that is not the // CMAKE_CFG_INTDIR setting then the value is out of date. std::string const& intDir = - this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); + status.GetMakefile().GetRequiredDefinition("CMAKE_CFG_INTDIR"); bool haveCacheValue = false; - if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING")) { + if (status.GetMakefile().IsOn("CMAKE_CROSSCOMPILING")) { haveCacheValue = (cacheValue != nullptr); if (!haveCacheValue) { std::string msg = cmStrCat( @@ -44,7 +43,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, cmSystemTools::Message(msg, "Warning"); } } else { - cmState* state = this->Makefile->GetState(); + cmState* state = status.GetMakefile().GetState(); haveCacheValue = (cacheValue && (strstr(cacheValue, "(IntDir)") == nullptr || (intDir == "$(IntDir)")) && @@ -63,7 +62,7 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, // The third argument specifies the relative directory of the source // of the utility. std::string const& relativeSource = *arg++; - std::string utilitySource = this->Makefile->GetCurrentSourceDirectory(); + std::string utilitySource = status.GetMakefile().GetCurrentSourceDirectory(); utilitySource = utilitySource + "/" + relativeSource; // If the directory doesn't exist, the source has not been included. @@ -81,11 +80,12 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, // The source exists. const std::string& cmakeCFGout = - this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); - std::string utilityDirectory = this->Makefile->GetCurrentBinaryDirectory(); + status.GetMakefile().GetRequiredDefinition("CMAKE_CFG_INTDIR"); + std::string utilityDirectory = + status.GetMakefile().GetCurrentBinaryDirectory(); std::string exePath; - if (this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { - exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH"); + if (status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH")) { + exePath = status.GetMakefile().GetDefinition("EXECUTABLE_OUTPUT_PATH"); } if (!exePath.empty()) { utilityDirectory = exePath; @@ -95,21 +95,22 @@ bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args, // Construct the cache entry for the executable's location. std::string utilityExecutable = utilityDirectory + "/" + cmakeCFGout + "/" + - utilityName + this->Makefile->GetDefinition("CMAKE_EXECUTABLE_SUFFIX"); + utilityName + + status.GetMakefile().GetDefinition("CMAKE_EXECUTABLE_SUFFIX"); // make sure we remove any /./ in the name cmSystemTools::ReplaceString(utilityExecutable, "/./", "/"); // Enter the value into the cache. - this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), - "Path to an internal program.", - cmStateEnums::FILEPATH); + status.GetMakefile().AddCacheDefinition( + cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", + cmStateEnums::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); - this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), - "Executable to project name.", - cmStateEnums::INTERNAL); + status.GetMakefile().AddCacheDefinition( + utilityExecutable, utilityName.c_str(), "Executable to project name.", + cmStateEnums::INTERNAL); return true; } diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index cef7fed..934d539 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmUtilitySourceCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmUtilitySourceCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmUtilitySourceCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index c44eeca..6b93c63 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -2,33 +2,32 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmVariableRequiresCommand.h" +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -class cmExecutionStatus; - // cmLibraryCommand -bool cmVariableRequiresCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmVariableRequiresCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() < 3) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } std::string const& testVariable = args[0]; - if (!this->Makefile->IsOn(testVariable)) { + if (!status.GetMakefile().IsOn(testVariable)) { return true; } std::string const& resultVariable = args[1]; bool requirementsMet = true; std::string notSet; bool hasAdvanced = false; - cmState* state = this->Makefile->GetState(); + cmState* state = status.GetMakefile().GetState(); for (unsigned int i = 2; i < args.size(); ++i) { - if (!this->Makefile->IsOn(args[i])) { + if (!status.GetMakefile().IsOn(args[i])) { requirementsMet = false; notSet += args[i]; notSet += "\n"; @@ -38,12 +37,12 @@ bool cmVariableRequiresCommand::InitialPass( } } } - const char* reqVar = this->Makefile->GetDefinition(resultVariable); + const char* reqVar = status.GetMakefile().GetDefinition(resultVariable); // if reqVar is unset, then set it to requirementsMet // if reqVar is set to true, but requirementsMet is false , then // set reqVar to false. - if (!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) { - this->Makefile->AddDefinitionBool(resultVariable, requirementsMet); + if (!reqVar || (!requirementsMet && status.GetMakefile().IsOn(reqVar))) { + status.GetMakefile().AddDefinitionBool(resultVariable, requirementsMet); } if (!requirementsMet) { diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 38e7490..fb0520e 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -8,21 +8,9 @@ #include <string> #include <vector> -#include "cm_memory.hxx" - -#include "cmCommand.h" - class cmExecutionStatus; -class cmVariableRequiresCommand : public cmCommand -{ -public: - std::unique_ptr<cmCommand> Clone() override - { - return cm::make_unique<cmVariableRequiresCommand>(); - } - bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus& status) override; -}; +bool cmVariableRequiresCommand(std::vector<std::string> const& args, + cmExecutionStatus& status); #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 13f6295..44614a3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1115,7 +1115,10 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0) std::string configType; if (const char* vsConfigurationType = this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) { - configType = vsConfigurationType; + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(vsConfigurationType); + configType = cge->Evaluate(this->LocalGenerator, c); } else { switch (this->GeneratorTarget->GetType()) { case cmStateEnums::SHARED_LIBRARY: diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 4fa98b3..1746082 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -431,6 +431,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } // Register fake project commands that hint misuse in script mode. GetProjectCommandsInScriptMode(this->GetState()); + // Documented behaviour of CMAKE{,_CURRENT}_{SOURCE,BINARY}_DIR is to be + // set to $PWD for -P mode. + this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory( + cmSystemTools::GetCurrentWorkingDirectory()); this->ReadListFile(args, path); } else if (arg.find("--find-package", 0) == 0) { findPackageMode = true; @@ -460,15 +465,9 @@ void cmake::ReadListFile(const std::vector<std::string>& args, // read in the list file to fill the cache if (!path.empty()) { this->CurrentSnapshot = this->State->Reset(); - std::string homeDir = this->GetHomeDirectory(); - std::string homeOutputDir = this->GetHomeOutputDirectory(); - this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmStateSnapshot snapshot = this->GetCurrentSnapshot(); - snapshot.GetDirectory().SetCurrentBinary( - cmSystemTools::GetCurrentWorkingDirectory()); - snapshot.GetDirectory().SetCurrentSource( - cmSystemTools::GetCurrentWorkingDirectory()); + snapshot.GetDirectory().SetCurrentBinary(this->GetHomeOutputDirectory()); + snapshot.GetDirectory().SetCurrentSource(this->GetHomeDirectory()); snapshot.SetDefaultDefinitions(); cmMakefile mf(gg, snapshot); if (this->GetWorkingMode() != NORMAL_MODE) { @@ -481,8 +480,6 @@ void cmake::ReadListFile(const std::vector<std::string>& args, if (!mf.ReadListFile(path)) { cmSystemTools::Error("Error processing file: " + path); } - this->SetHomeDirectory(homeDir); - this->SetHomeOutputDirectory(homeOutputDir); } // free generic one if generated diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 34858b8..02e28d4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -780,8 +780,6 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH win64_release.cmake) ADD_NIGHTLY_BUILD_TEST(CMakeNightlyOSX osx_release.cmake) - ADD_NIGHTLY_BUILD_TEST(CMakeNightlyLinux64 - linux64_release.cmake) set_property(TEST CMakeNightlyWin64 PROPERTY DEPENDS CMakeNightlyWin32) endif() @@ -2619,16 +2617,18 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH PASS_REGULAR_EXPRESSION "Could not find executable" FAIL_REGULAR_EXPRESSION "SegFault") - configure_file( - "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in" - "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" - @ONLY ESCAPE_QUOTES) - add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND} - -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V - --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log" - ) - set_tests_properties(CTestTestUpload PROPERTIES - PASS_REGULAR_EXPRESSION "Upload\\.xml") + if(NOT CMake_TEST_NO_NETWORK) + configure_file( + "${CMake_SOURCE_DIR}/Tests/CTestTestUpload/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" + @ONLY ESCAPE_QUOTES) + add_test(CTestTestUpload ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestUpload/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestUpload/testOut.log" + ) + set_tests_properties(CTestTestUpload PROPERTIES + PASS_REGULAR_EXPRESSION "Upload\\.xml") + endif() configure_file( "${CMake_SOURCE_DIR}/Tests/CTestCoverageCollectGCOV/test.cmake.in" diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt index 3037f13..20615fe 100644 --- a/Tests/COnly/CMakeLists.txt +++ b/Tests/COnly/CMakeLists.txt @@ -13,11 +13,5 @@ if(MSVC_VERSION AND NOT CMAKE_C_COMPILER_ID STREQUAL Clang OR "x${CMAKE_C_COMPIL endif() string(ASCII 35 32 67 77 97 107 101 ASCII_STRING) message(STATUS "String: ${ASCII_STRING}") -get_source_file_property(LANG conly.c LANGUAGE) -if("${LANG}" STREQUAL "C") - message("Language is C") -else() - message(FATAL_ERROR "Bad language for file conly.c") -endif() add_library(testCModule MODULE testCModule.c) diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt new file mode 100644 index 0000000..0d8f72e --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt @@ -0,0 +1,8 @@ +initial-cache.txt: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src +initial-cache.txt: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +PreLoad.cmake: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src +PreLoad.cmake: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +CMakeLists.txt: INITIAL_SOURCE_DIR: .*/C_buildsrcdir/src +CMakeLists.txt: INITIAL_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir +CMakeLists.txt: PRELOAD_SOURCE_DIR: .*/C_buildsrcdir/src +CMakeLists.txt: PRELOAD_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt new file mode 100644 index 0000000..c69b11e --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt @@ -0,0 +1,2 @@ +loading initial cache file .*/C_buildsrcdir/initial-cache.txt +.* diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir.cmake b/Tests/RunCMake/CommandLine/C_buildsrcdir.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir.cmake diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt new file mode 100644 index 0000000..adc125b --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir/initial-cache.txt @@ -0,0 +1,6 @@ +# Used to verify that the values match what is passed via -S and -B, and are retained in cache. +set(INITIAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "defined in initial.cmake") +set(INITIAL_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "defined in initial.cmake") + +message("initial-cache.txt: CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") +message("initial-cache.txt: CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir/src/CMakeLists.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir/src/CMakeLists.txt new file mode 100644 index 0000000..4893fe7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir/src/CMakeLists.txt @@ -0,0 +1,6 @@ +project(C_buildsrcdir) + +message("CMakeLists.txt: INITIAL_SOURCE_DIR: ${INITIAL_SOURCE_DIR}") +message("CMakeLists.txt: INITIAL_BINARY_DIR: ${INITIAL_BINARY_DIR}") +message("CMakeLists.txt: PRELOAD_SOURCE_DIR: ${PRELOAD_SOURCE_DIR}") +message("CMakeLists.txt: PRELOAD_BINARY_DIR: ${PRELOAD_BINARY_DIR}") diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir/src/PreLoad.cmake b/Tests/RunCMake/CommandLine/C_buildsrcdir/src/PreLoad.cmake new file mode 100644 index 0000000..5199219 --- /dev/null +++ b/Tests/RunCMake/CommandLine/C_buildsrcdir/src/PreLoad.cmake @@ -0,0 +1,6 @@ +# Used to verify that the values match what is passed via -S and -B, and are retained in cache. +message("PreLoad.cmake: CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}") +message("PreLoad.cmake: CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}") + +set(PRELOAD_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "value of cmake_binary_dir during preload") +set(PRELOAD_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "value of cmake_source_dir during preload") diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index dd49423..71a3843 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -391,6 +391,13 @@ run_cmake_command(E_sleep-one-tenth ${CMAKE_COMMAND} -E sleep 0.1) run_cmake_command(P_directory ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}) run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake) +# Documented to return the same result as above even if -S and -B are set to something else. +# Tests the values of CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR. +run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake -S something_else -B something_else_1) + +# CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified. +run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt) + set(RunCMake_TEST_OPTIONS "-DFOO=-DBAR:BOOL=BAZ") diff --git a/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake b/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake index 4690970..bbd34da 100644 --- a/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake +++ b/Tests/RunCMake/VS10Project/VsConfigurationType-check.cmake @@ -9,7 +9,7 @@ file(STRINGS "${vcProjectFile}" lines) foreach(line IN LISTS lines) if(line MATCHES "^ *<ConfigurationType>(.*)</ConfigurationType>$") set(propertyFound TRUE) - set(expectedValue "MyValue") + set(expectedValue "MyValue foo") set(actualValue ${CMAKE_MATCH_1}) if(NOT (${actualValue} STREQUAL ${expectedValue})) set(RunCMake_TEST_FAILED "ConfigurationType \"${actualValue}\" differs from expected value \"${expectedValue}\".") diff --git a/Tests/RunCMake/VS10Project/VsConfigurationType.cmake b/Tests/RunCMake/VS10Project/VsConfigurationType.cmake index a73dfe8..a2f544a 100644 --- a/Tests/RunCMake/VS10Project/VsConfigurationType.cmake +++ b/Tests/RunCMake/VS10Project/VsConfigurationType.cmake @@ -1,3 +1,3 @@ enable_language(CXX) add_library(foo foo.cpp) -set_target_properties(foo PROPERTIES VS_CONFIGURATION_TYPE "MyValue") +set_target_properties(foo PROPERTIES VS_CONFIGURATION_TYPE "MyValue $<TARGET_PROPERTY:foo,NAME>") diff --git a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake index ef772ea..8c0b470 100644 --- a/Tests/RunCMake/XcodeProject/XcodeBundles.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeBundles.cmake @@ -5,6 +5,7 @@ enable_language(C) if(CMAKE_SYSTEM_NAME STREQUAL "iOS") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") endif() diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake index f6c00b1..c221033 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined.cmake @@ -11,6 +11,7 @@ if(NOT IOS) endif() set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake index ec11dbb..172f2e8 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedPrune.cmake @@ -7,6 +7,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9) endif() set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") add_library(foo SHARED foo.cpp) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake index 58e96b4..038a890 100644 --- a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch.cmake @@ -7,6 +7,7 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 9) endif() set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") +set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf") add_library(foo SHARED foo.cpp) diff --git a/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt b/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt new file mode 100644 index 0000000..8f21eb8 --- /dev/null +++ b/Tests/RunCMake/find_path/EmptyOldStyle-stdout.txt @@ -0,0 +1 @@ +-- VAR-NOTFOUND diff --git a/Tests/RunCMake/find_path/EmptyOldStyle.cmake b/Tests/RunCMake/find_path/EmptyOldStyle.cmake new file mode 100644 index 0000000..d78bb65 --- /dev/null +++ b/Tests/RunCMake/find_path/EmptyOldStyle.cmake @@ -0,0 +1,2 @@ +find_path(VAR ONLY_CMAKE_FIND_ROOT_PATH) +message(STATUS "${VAR}") diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake index 8b5b5b7..ed55f51 100644 --- a/Tests/RunCMake/find_path/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EmptyOldStyle) run_cmake(FromPATHEnv) run_cmake(PrefixInPATH) diff --git a/Tests/SourceFileProperty/CMakeLists.txt b/Tests/SourceFileProperty/CMakeLists.txt index 1b6506d..5e55f7b 100644 --- a/Tests/SourceFileProperty/CMakeLists.txt +++ b/Tests/SourceFileProperty/CMakeLists.txt @@ -1,19 +1,27 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.1) project(SourceFileProperty C) -set(sources) - if (EXISTS icasetest.c) # If a file exists by this name, use it. set_source_files_properties(icasetest.c PROPERTIES - COMPILE_FLAGS -DNEEDED_TO_WORK) + COMPILE_DEFINITIONS NEEDED_TO_WORK) else () # Work on case-sensitive file systems as well. set_source_files_properties(main.c PROPERTIES - COMPILE_FLAGS -DNO_NEED_TO_CALL) + COMPILE_DEFINITIONS NO_NEED_TO_CALL) endif () -list(APPEND sources ICaseTest.c) -add_executable(SourceFileProperty main.c ${sources}) +add_executable(SourceFileProperty main.c) +target_sources(SourceFileProperty PRIVATE ICaseTest.c) + +get_source_file_property(LANG_MAIN main.c LANGUAGE) +if(NOT "${LANG_MAIN}" STREQUAL "C") + message(FATAL_ERROR "Bad language for file main.c") +endif() + +get_property(LANG_TEST SOURCE ICaseTest.c PROPERTY LANGUAGE) +if (NOT "${LANG_TEST}" STREQUAL "C") + message(FATAL_ERROR "Bad language for file ICaseTest.c") +endif () diff --git a/Utilities/Release/README b/Utilities/Release/README deleted file mode 100644 index 11de1c3..0000000 --- a/Utilities/Release/README +++ /dev/null @@ -1,18 +0,0 @@ -To create a cmake release, make sure the "release" tag is pointing to the -expected git commit: - -https://cmake.org/gitweb?p=cmake.git;a=shortlog;h=refs/heads/release - -Then as kitware@hythloth, using an up-to-date CMake: - - cd ~/CMakeReleases/cmake/Utilities/Release - mkdir 283rc1 - cd 283rc1 - ~/CMakeReleases/build/bin/cmake -DCMAKE_CREATE_VERSION=release -P ../create-cmake-release.cmake - ./create-release.sh - - -create-cmake-release.cmake: script to run to create release sh scripts -Add or remove machines in create-cmake-release.cmake. - -machine_release.cmake : config files for each machine diff --git a/Utilities/Release/README.rst b/Utilities/Release/README.rst new file mode 100644 index 0000000..e7f0eb3 --- /dev/null +++ b/Utilities/Release/README.rst @@ -0,0 +1,84 @@ +CMake Release Utilities +*********************** + +This directory contains scripts used to package CMake itself for distribution +on ``cmake.org``. See also the `CMake Source Code Guide`_. + +.. _`CMake Source Code Guide`: ../../Help/dev/source.rst + +Docker +------ + +The ``linux/<arch>/`` directories contain Docker specifications that anyone +may use to produce Linux binaries for CMake: + +* ``linux/<arch>/base/Dockerfile``: + Produces a base image with a build environment for portable CMake binaries. + This image is published in the `kitware/cmake Docker Hub Repository`_ + with tag ``build-linux-<arch>-base-<date>``. + +* ``linux/<arch>/deps/Dockerfile``: + Produces an image with custom-built dependencies for portable CMake binaries. + This image is published in the `kitware/cmake Docker Hub Repository`_ + with tag ``build-linux-<arch>-deps-<date>``. + +* ``linux/<arch>/Dockerfile``: + Produce an image containing a portable CMake binary package for Linux. + Build this image using the CMake source directory as the build context. + The resulting image will have an ``/out`` directory containing the package. + For example: + + .. code-block:: console + + $ docker build --tag=cmake:build --network none \ + -f cmake-src/Utilities/Release/linux/$arch/Dockerfile cmake-src + $ docker container create --name cmake-build cmake:build + $ docker cp cmake-build:/out . + $ ls out/cmake-*-Linux-$arch.tar.gz + +* ``linux/<arch>/test/Dockerfile``: + Produces a base image with a test environment for packaged CMake binaries. + For example, build the test base image: + + .. code-block:: console + + $ docker build --tag=cmake:test-base \ + cmake-src/Utilities/Release/linux/$arch/test + + Then create a local ``test/Dockerfile`` to prepare an image with both the + CMake source tree and the above-built package:: + + FROM cmake:test-base + COPY cmake-src /opt/cmake/src/cmake + ADD out/cmake-<ver>-Linux-<arch>.tar.gz /opt/ + ENV PATH=/opt/cmake-<ver>-Linux-<arch>/bin:$PATH + + Build the test image and run it to drive testing: + + .. code-block:: console + + $ docker build --tag cmake:test --network none -f test/Dockerfile . + $ docker run --network none cmake:test bash test-make.bash + $ docker run --network none cmake:test bash test-ninja.bash + +.. _`kitware/cmake Docker Hub Repository`: https://hub.docker.com/r/kitware/cmake + +Scripts for Kitware +------------------- + +Kitware uses the following scripts to produce binaries for ``cmake.org``. +They work only on specific machines Kitware uses for such builds. + +* ``create-cmake-release.cmake``: + Run ``cmake -DCMAKE_CREATE_VERSION=$ver -P ../create-cmake-release.cmake`` + to generate ``create-$ver-*.sh`` release scripts. It also displays + instructions to run them. + +* ``*_release.cmake``: + Platform-specific settings used in corresponding scripts generated above. + +* ``release_cmake.cmake``: + Code shared by all ``*_release.cmake`` scripts. + +* ``release_cmake.sh.in``: + Template for script that runs on the actual build machines. diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 0622ad8..17a2151 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -45,14 +45,12 @@ echo 'Failed to create \${name}.tar.gz' endfunction() write_docs_shell_script("create-${CMAKE_CREATE_VERSION}-docs.sh") -write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-linux64.sh" linux64_release) # Linux x86_64 write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-macos.sh" osx_release ) # macOS x86_64 write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-win64.sh" win64_release ) # Windows x64 write_rel_shell_script("create-${CMAKE_CREATE_VERSION}-win32.sh" win32_release ) # Windows x86 message("Build docs first and then build for each platform: ./create-${CMAKE_CREATE_VERSION}-docs.sh && - ./create-${CMAKE_CREATE_VERSION}-linux64.sh && ./create-${CMAKE_CREATE_VERSION}-macos.sh && ./create-${CMAKE_CREATE_VERSION}-win64.sh && ./create-${CMAKE_CREATE_VERSION}-win32.sh && diff --git a/Utilities/Release/linux/x86_64/Dockerfile b/Utilities/Release/linux/x86_64/Dockerfile new file mode 100644 index 0000000..f3ba69c --- /dev/null +++ b/Utilities/Release/linux/x86_64/Dockerfile @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce an image containing a portable CMake binary package for Linux/x86_64. +# Build using the CMake source directory as the build context. +# The resulting image will have an '/out' directory containing the package. + +ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-deps-2019-08-09 +ARG FROM_IMAGE_DIGEST=@sha256:630c320b26a67fc584e0bc98314f1fb0cb0abc764348bb2613ef07437f7101f9 +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +COPY . /opt/cmake/src/cmake + +ARG TEST=true + +RUN : \ + && mkdir -p /opt/cmake/src/cmake-build \ + && cd /opt/cmake/src/cmake-build \ + && cp ../cmake/Utilities/Release/linux/x86_64/cache.txt CMakeCache.txt \ + && source /opt/rh/devtoolset-6/enable \ + && source /opt/rh/rh-python36/enable \ + && export LANG=en_US.UTF-8 \ + && set -x \ + && ../cmake/bootstrap --parallel=$(nproc) --docdir=doc/cmake \ + && nice make -j $(nproc) \ + && if $TEST; then \ + # Run tests that require the full build tree. + bin/ctest --output-on-failure -j 8 -R '^(CMake\.|CMakeLib\.|CMakeServerLib\.|RunCMake\.ctest_memcheck)'; \ + fi \ + && bin/cpack -G TGZ \ + && set +x \ + && mkdir /out \ + && mv cmake-*-Linux-x86_64.tar.gz /out \ + && : diff --git a/Utilities/Release/linux/x86_64/base/Dockerfile b/Utilities/Release/linux/x86_64/base/Dockerfile new file mode 100644 index 0000000..dfc7df8 --- /dev/null +++ b/Utilities/Release/linux/x86_64/base/Dockerfile @@ -0,0 +1,30 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce a base image with a build environment for portable CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=centos:6 +ARG FROM_IMAGE_DIGEST=@sha256:dec8f471302de43f4cfcf82f56d99a5227b5ea1aa6d02fa56344986e1f4610e7 +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +RUN : \ + && yum install -y centos-release-scl \ + && yum install -y \ + ca-certificates \ + curl \ + devtoolset-6-gcc \ + devtoolset-6-gcc-c++ \ + fontconfig-devel \ + freetype-devel \ + git \ + libX11-devel \ + libxcb-devel \ + make \ + patch \ + perl \ + rh-python36-python-pip \ + xz \ + && yum clean all \ + && : diff --git a/Utilities/Release/linux/x86_64/cache.txt b/Utilities/Release/linux/x86_64/cache.txt new file mode 100644 index 0000000..a2864e9 --- /dev/null +++ b/Utilities/Release/linux/x86_64/cache.txt @@ -0,0 +1,44 @@ +CMAKE_BUILD_TYPE:STRING=Release + +CMAKE_C_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=14 + +# Require only older APIs where possible. +CMAKE_C_FLAGS:STRING=-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 + +# Link C++ library statically. +CMAKE_EXE_LINKER_FLAGS:STRING=-static-libstdc++ -static-libgcc + +# Enable ssl support in curl +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:STRING=/opt/openssl/lib/libcrypto.a;-pthread +OPENSSL_INCLUDE_DIR:PATH=/opt/openssl/include +OPENSSL_SSL_LIBRARY:FILEPATH=/opt/openssl/lib/libssl.a + +# Enable ccmake +BUILD_CursesDialog:BOOL=ON +CURSES_FORM_LIBRARY:FILEPATH=/opt/ncurses/lib/libform.a +CURSES_INCLUDE_PATH:PATH=/opt/ncurses/include +CURSES_NCURSES_LIBRARY:FILEPATH=/opt/ncurses/lib/libncurses.a + +# Enable cmake-gui with static qt plugins +BUILD_QtDialog:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 +CMAKE_PREFIX_PATH:STRING=/opt/qt +CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES:STRING=/opt/qt/plugins/platforms/libqxcb.a;/opt/qt/lib/libQt5XcbQpa.a;/opt/qt/lib/libQt5ServiceSupport.a;/opt/qt/lib/libQt5EdidSupport.a;/opt/qt/lib/libQt5EventDispatcherSupport.a;/opt/qt/lib/libQt5FontDatabaseSupport.a;/opt/qt/lib/libQt5ThemeSupport.a;/opt/qt/lib/libxcb-static.a;-lxcb;-lfontconfig;-lfreetype + +# Build documentation. +SPHINX_EXECUTABLE:FILEPATH=/opt/rh/rh-python36/root/usr/bin/sphinx-build +SPHINX_HTML:BOOL=ON +SPHINX_MAN:BOOL=ON +SPHINX_QTHELP:BOOL=ON +QCOLLECTIONGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator + +# We bootstrap as part of the build so skip its test. +CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE + +# Skip Qt5 tests because our Qt is static. +CMake_TEST_Qt5:BOOL=FALSE + +# CPack package file name component for this platform. +CPACK_SYSTEM_NAME:STRING=Linux-x86_64 diff --git a/Utilities/Release/linux/x86_64/deps/Dockerfile b/Utilities/Release/linux/x86_64/deps/Dockerfile new file mode 100644 index 0000000..db5551c --- /dev/null +++ b/Utilities/Release/linux/x86_64/deps/Dockerfile @@ -0,0 +1,142 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce an image with custom-built dependencies for portable CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-x86_64-base-2019-08-09 +ARG FROM_IMAGE_DIGEST=@sha256:d2c13617f01181a3143a069e4496d6b78eafffa19d181c42be196d5dfd588151 +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +# Sphinx +RUN : \ + && source /opt/rh/rh-python36/enable \ + && pip install sphinx==2.1.2 \ + && : + +# Qt +# Version 5.12.0 was the last to bundle xkbcommon. +COPY qt-install.patch /opt/qt/src/ +RUN : \ + && mkdir -p /opt/qt/src/qt-build \ + && cd /opt/qt/src \ + && curl -OL https://download.qt.io/archive/qt/5.12/5.12.0/single/qt-everywhere-src-5.12.0.tar.xz \ + && sha512sum qt-everywhere-src-5.12.0.tar.xz | grep -q 0dd03d2645fb6dac5b58c8caf92b4a0a6900131f1ccfb02443a0df4702b5da0458f4c45e758d1b929ec709b0f4b36900df2fd60a058af9cc8c1a0748b6d57aae \ + && tar xJf qt-everywhere-src-5.12.0.tar.xz \ + && cd qt-build \ + && source /opt/rh/devtoolset-6/enable \ + && ../qt-everywhere-src-5.12.0/configure \ + -prefix /opt/qt \ + -static \ + -release \ + -c++std c++11 \ + -opensource -confirm-license \ + -gui \ + -widgets \ + -xcb \ + -fontconfig \ + -sql-sqlite \ + -qt-doubleconversion \ + -qt-libjpeg \ + -qt-libpng \ + -qt-pcre \ + -qt-sqlite \ + -qt-xcb \ + -qt-xkbcommon \ + -qt-zlib \ + -system-freetype \ + -no-accessibility \ + -no-compile-examples \ + -no-cups \ + -no-dbus \ + -no-directfb \ + -no-egl \ + -no-eglfs \ + -no-evdev \ + -no-gbm \ + -no-gif \ + -no-glib \ + -no-gtk \ + -no-harfbuzz \ + -no-iconv \ + -no-icu \ + -no-journald \ + -no-kms \ + -no-libinput \ + -no-libproxy \ + -no-linuxfb \ + -no-ltcg \ + -no-mirclient \ + -no-mtdev \ + -no-opengl \ + -no-openssl \ + -no-pch \ + -no-sql-mysql \ + -no-sql-psql \ + -no-sql-sqlite2 \ + -no-syslog \ + -no-system-proxies \ + -no-tslib \ + -no-use-gold-linker \ + -skip declarative \ + -skip multimedia \ + -skip qtcanvas3d \ + -skip qtconnectivity \ + -skip qtdeclarative \ + -skip qtlocation \ + -skip qtmultimedia \ + -skip qtsensors \ + -skip qtserialport \ + -skip qtsvg \ + -skip qtwayland \ + -skip qtwebchannel \ + -skip qtwebengine \ + -skip qtwebsockets \ + -skip qtwinextras \ + -skip qtxmlpatterns \ + -nomake examples \ + -nomake tests \ + && make install -j $(nproc) \ + && cd /opt/qt \ + && patch -p1 -i src/qt-install.patch \ + && cd /opt \ + && rm -rf /opt/qt/src \ + && : + +# Curses +RUN : \ + && mkdir -p /opt/ncurses/src/ncurses-build \ + && cd /opt/ncurses/src \ + && curl -O https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz \ + && sha512sum ncurses-6.1.tar.gz | grep -q e308af43f8b7e01e98a55f4f6c4ee4d1c39ce09d95399fa555b3f0cdf5fd0db0f4c4d820b4af78a63f6cf6d8627587114a40af48cfc066134b600520808a77ee \ + && tar xzf ncurses-6.1.tar.gz \ + && cd ncurses-build \ + && source /opt/rh/devtoolset-6/enable \ + && ../ncurses-6.1/configure \ + --prefix=/opt/ncurses \ + --with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo \ + --with-default-terminfo-dir=/usr/share/terminfo \ + --without-shared \ + && make -j $(nproc) \ + && make install.libs install.includes \ + && cd /opt \ + && rm -rf /opt/ncurses/src \ + && : + +# OpenSSL +COPY openssl-source.patch /opt/openssl/src/ +RUN : \ + && mkdir -p /opt/openssl/src \ + && cd /opt/openssl/src \ + && curl -O https://www.openssl.org/source/openssl-1.1.1c.tar.gz \ + && sha512sum openssl-1.1.1c.tar.gz | grep -q 8e2c5cc11c120efbb7d7850980cb6eaa782d29b4996b3f3378d37613c1679f852d7cc08a90d62e78fcec3439f06bdbee70064579a8c2adaffd91532a97f646ff \ + && tar xzf openssl-1.1.1c.tar.gz \ + && cd openssl-1.1.1c \ + && patch -p1 -i ../openssl-source.patch \ + && source /opt/rh/devtoolset-6/enable \ + && ./Configure --prefix=/opt/openssl linux-elf no-asm no-shared -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 \ + && make install_dev -j $(nproc) \ + && cd /opt \ + && rm -rf /opt/openssl/src \ + && : diff --git a/Utilities/Release/linux/x86_64/deps/openssl-source.patch b/Utilities/Release/linux/x86_64/deps/openssl-source.patch new file mode 100644 index 0000000..c81fe2f --- /dev/null +++ b/Utilities/Release/linux/x86_64/deps/openssl-source.patch @@ -0,0 +1,12 @@ +# enable pthread APIs disabled by our _POSIX_SOURCE definitions +--- openssl-source/crypto/threads_pthread.c.orig ++++ openssl-source/crypto/threads_pthread.c +@@ -6,6 +6,8 @@ + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ ++#undef _POSIX_C_SOURCE ++#undef _POSIX_SOURCE + + #include <openssl/crypto.h> + #include "internal/cryptlib.h" diff --git a/Utilities/Release/linux/x86_64/deps/qt-install.patch b/Utilities/Release/linux/x86_64/deps/qt-install.patch new file mode 100644 index 0000000..792aefd --- /dev/null +++ b/Utilities/Release/linux/x86_64/deps/qt-install.patch @@ -0,0 +1,24 @@ +# Add Qt Core dependencies missing from static Qt build. +--- qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake.orig ++++ qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake +@@ -111,7 +111,7 @@ + list(REMOVE_DUPLICATES Qt5Core_COMPILE_DEFINITIONS) + list(REMOVE_DUPLICATES Qt5Core_EXECUTABLE_COMPILE_FLAGS) + +- set(_Qt5Core_LIB_DEPENDENCIES "") ++ set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/libqtpcre2.a") + + + add_library(Qt5::Core STATIC IMPORTED) +# Add Qt Gui dependencies missing from static Qt build. +--- qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake.orig ++++ qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake +@@ -111,7 +111,7 @@ + list(REMOVE_DUPLICATES Qt5Gui_COMPILE_DEFINITIONS) + list(REMOVE_DUPLICATES Qt5Gui_EXECUTABLE_COMPILE_FLAGS) + +- set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core") ++ set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core;${_qt5Gui_install_prefix}/lib/libqtlibpng.a") + + + add_library(Qt5::Gui STATIC IMPORTED) diff --git a/Utilities/Release/linux/x86_64/test/Dockerfile b/Utilities/Release/linux/x86_64/test/Dockerfile new file mode 100644 index 0000000..6629156 --- /dev/null +++ b/Utilities/Release/linux/x86_64/test/Dockerfile @@ -0,0 +1,26 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce a base image with a test environment for packaged CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=debian:9 +ARG FROM_IMAGE_DIGEST=@sha256:397b2157a9ea8d7f16c613aded70284292106e8b813fb1ed5de8a8785310a26a +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +RUN : \ + && apt-get update \ + && apt-get install -y \ + dpkg \ + file \ + gcc \ + g++ \ + gfortran \ + qt5-default \ + make \ + ninja-build \ + && apt-get clean \ + && : + +COPY test-make.bash test-ninja.bash / diff --git a/Utilities/Release/linux/x86_64/test/cache-ninja.txt b/Utilities/Release/linux/x86_64/test/cache-ninja.txt new file mode 100644 index 0000000..b00370e --- /dev/null +++ b/Utilities/Release/linux/x86_64/test/cache-ninja.txt @@ -0,0 +1,4 @@ +CMAKE_Fortran_COMPILER:STRING= +CMake_TEST_IPO_WORKS_C:BOOL=ON +CMake_TEST_IPO_WORKS_CXX:BOOL=ON +CMake_TEST_Qt5:BOOL=ON diff --git a/Utilities/Release/linux/x86_64/test/test-make.bash b/Utilities/Release/linux/x86_64/test/test-make.bash new file mode 100644 index 0000000..10d30c3 --- /dev/null +++ b/Utilities/Release/linux/x86_64/test/test-make.bash @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +set -e +set -x +mkdir -p /opt/cmake/src/cmake-make +cd /opt/cmake/src/cmake-make +echo >CMakeCache.txt ' +CMake_TEST_IPO_WORKS_C:BOOL=ON +CMake_TEST_IPO_WORKS_CXX:BOOL=ON +CMake_TEST_IPO_WORKS_Fortran:BOOL=ON +CMake_TEST_NO_NETWORK:BOOL=ON +CMake_TEST_Qt5:BOOL=ON +' +cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Unix Makefiles" +make -j $(nproc) +ctest --output-on-failure -j $(nproc) diff --git a/Utilities/Release/linux/x86_64/test/test-ninja.bash b/Utilities/Release/linux/x86_64/test/test-ninja.bash new file mode 100644 index 0000000..fe39e2e --- /dev/null +++ b/Utilities/Release/linux/x86_64/test/test-ninja.bash @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +set -e +set -x +mkdir -p /opt/cmake/src/cmake-ninja +cd /opt/cmake/src/cmake-ninja +echo >CMakeCache.txt ' +CMAKE_Fortran_COMPILER:STRING= +CMake_TEST_IPO_WORKS_C:BOOL=ON +CMake_TEST_IPO_WORKS_CXX:BOOL=ON +CMake_TEST_NO_NETWORK:BOOL=ON +CMake_TEST_Qt5:BOOL=ON +' +cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Ninja" +ninja +ctest --output-on-failure -j $(nproc) diff --git a/Utilities/Release/linux64_release.cmake b/Utilities/Release/linux64_release.cmake deleted file mode 100644 index 958ed25..0000000 --- a/Utilities/Release/linux64_release.cmake +++ /dev/null @@ -1,53 +0,0 @@ -set(PROCESSORS 4) -set(BOOTSTRAP_ARGS "--docdir=doc/cmake") -set(HOST linux64) -set(MAKE_PROGRAM "make") -set(CPACK_BINARY_GENERATORS "STGZ TGZ") -set(CC /opt/gcc-8.2.0/bin/gcc) -set(CXX /opt/gcc-8.2.0/bin/g++) -set(CFLAGS "") -set(CXXFLAGS "") -set(qt_prefix "/home/kitware/qt-5.7.0") -set(qt_xcb_libs - ${qt_prefix}/plugins/platforms/libqxcb.a - ${qt_prefix}/lib/libQt5XcbQpa.a - ${qt_prefix}/lib/libQt5PlatformSupport.a - ${qt_prefix}/lib/libxcb-static.a - -lX11-xcb - -lX11 - -lxcb - -lfontconfig - -lfreetype - ) -set(INITIAL_CACHE " -CMAKE_BUILD_TYPE:STRING=Release -CMAKE_C_STANDARD:STRING=11 -CMAKE_CXX_STANDARD:STRING=14 -CMAKE_C_FLAGS:STRING=-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 -CMAKE_EXE_LINKER_FLAGS:STRING=-static-libstdc++ -static-libgcc -CURSES_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libncurses.a -CURSES_INCLUDE_PATH:PATH=/home/kitware/ncurses-5.9/include -FORM_LIBRARY:FILEPATH=/home/kitware/ncurses-5.9/lib/libform.a -CMAKE_USE_OPENSSL:BOOL=ON -OPENSSL_CRYPTO_LIBRARY:STRING=/home/kitware/openssl-1.1.1/lib/libcrypto.a;-pthread -OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.1.1/include -OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.1.1/lib/libssl.a -PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 -CPACK_SYSTEM_NAME:STRING=Linux-x86_64 -BUILD_CursesDialog:BOOL=ON -BUILD_QtDialog:BOOL=TRUE -CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE -CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 -CMAKE_PREFIX_PATH:STRING=${qt_prefix} -CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES:STRING=${qt_xcb_libs} -") -set(ENV [[ -export CMAKE_PREFIX_PATH=/opt/binutils-2.31 -]]) -set(SIGN "") - -# Exclude Qt5 tests because our Qt5 is static. -set(EXTRA_CTEST_ARGS "-E Qt5") - -get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/osx_release.cmake b/Utilities/Release/osx_release.cmake index ac35872..5ef3003 100644 --- a/Utilities/Release/osx_release.cmake +++ b/Utilities/Release/osx_release.cmake @@ -5,7 +5,7 @@ set(HOST dragnipur) set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "DragNDrop TGZ") -set(CPACK_SOURCE_GENERATORS "TGZ TZ") +set(CPACK_SOURCE_GENERATORS "") set(CPACK_DMG_FORMAT "UDBZ") #build using bzip2 for smaller package size set(CC clang) set(CXX clang++) diff --git a/Utilities/Release/win32_release.cmake b/Utilities/Release/win32_release.cmake index f0f51b8..14e5cba 100644 --- a/Utilities/Release/win32_release.cmake +++ b/Utilities/Release/win32_release.cmake @@ -5,7 +5,7 @@ set(PROCESSORS 16) set(HOST win32) set(RUN_LAUNCHER ~/rel/run) set(CPACK_BINARY_GENERATORS "WIX ZIP") -set(CPACK_SOURCE_GENERATORS "ZIP") +set(CPACK_SOURCE_GENERATORS "") set(MAKE_PROGRAM "ninja") set(MAKE "${MAKE_PROGRAM} -j16") set(qt_prefix "c:/Qt/5.12.1/msvc2017-32-w7-mt") @@ -297,7 +297,6 @@ CMAKE_CXX_SOURCES="\ cmDefinitions \ cmDepends \ cmDependsC \ - cmDisallowedCommand \ cmDocumentationFormatter \ cmEnableLanguageCommand \ cmEnableTestingCommand \ |