diff options
Diffstat (limited to 'Source')
151 files changed, 5248 insertions, 3033 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 30bef74..0457984 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -379,6 +379,8 @@ set(SRCS cmAddCompileDefinitionsCommand.h cmAddCompileOptionsCommand.cxx cmAddCompileOptionsCommand.h + cmAddLinkOptionsCommand.cxx + cmAddLinkOptionsCommand.h cmAddCustomCommandCommand.cxx cmAddCustomCommandCommand.h cmAddCustomTargetCommand.cxx @@ -574,6 +576,8 @@ set(SRCS cmTargetCompileOptionsCommand.h cmTargetIncludeDirectoriesCommand.cxx cmTargetIncludeDirectoriesCommand.h + cmTargetLinkOptionsCommand.cxx + cmTargetLinkOptionsCommand.h cmTargetLinkLibrariesCommand.cxx cmTargetLinkLibrariesCommand.h cmTargetPropCommandBase.cxx @@ -882,6 +886,8 @@ include_directories( set(CPACK_SRCS CPack/cmCPackArchiveGenerator.cxx CPack/cmCPackComponentGroup.cxx + CPack/cmCPackDebGenerator.cxx + CPack/cmCPackExtGenerator.cxx CPack/cmCPackGeneratorFactory.cxx CPack/cmCPackGenerator.cxx CPack/cmCPackLog.cxx @@ -894,7 +900,6 @@ set(CPACK_SRCS CPack/cmCPackTarCompressGenerator.cxx CPack/cmCPackZIPGenerator.cxx CPack/cmCPack7zGenerator.cxx - CPack/cmCPackDebGenerator.cxx ) # CPack IFW generator set(CPACK_SRCS ${CPACK_SRCS} diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a1343ae..d8f56f6 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 12) -set(CMake_VERSION_PATCH 1) -#set(CMake_VERSION_RC 0) +set(CMake_VERSION_PATCH 20180809) +#set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index cf8334a..180c92e 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -90,7 +90,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + cmGeneratedFileStream ofs(ifwTmpFile); ofs << "# Run command: " << ifwCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -203,7 +203,7 @@ int cmCPackIFWGenerator::PackageFiles() ifwCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(ifwTmpFile.c_str()); + cmGeneratedFileStream ofs(ifwTmpFile); ofs << "# Run command: " << ifwCmd << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 36cf08c..8f492af 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -306,7 +306,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() } // Output stream - cmGeneratedFileStream fout((this->Directory + "/config/config.xml").data()); + cmGeneratedFileStream fout(this->Directory + "/config/config.xml"); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index f24ab69..67e279c 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -528,7 +528,7 @@ void cmCPackIFWPackage::GeneratePackageFile() } // Output stream - cmGeneratedFileStream fout((this->Directory + "/meta/package.xml").data()); + cmGeneratedFileStream fout(this->Directory + "/meta/package.xml"); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index a01fc4e..987cad8 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -183,7 +183,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml() this->Directory + "/repository/UpdatesPatch.xml"; // Output stream - cmGeneratedFileStream fout(updatesPatchXml.data()); + cmGeneratedFileStream fout(updatesPatchXml); cmXMLWriter xout(fout); xout.StartDocument(); diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index e06efda..398ebd3 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -100,6 +100,10 @@ bool cmCPackWIXGenerator::RunCandleCommand(std::string const& sourceFile, command << " -ext " << QuotePath(ext); } + if (sourceFile.rfind(this->CPackTopLevel, 0) != 0) { + command << " " << QuotePath("-I" + this->CPackTopLevel); + } + AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command); command << " " << QuotePath(sourceFile); @@ -148,7 +152,7 @@ int cmCPackWIXGenerator::PackageFiles() bool cmCPackWIXGenerator::InitializeWiXConfiguration() { - if (!ReadListFile("CPackWIX.cmake")) { + if (!ReadListFile("Internal/CPack/CPackWIX.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while executing CPackWIX.cmake" << std::endl); return false; diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index b734bb4..ee1070f 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -103,18 +103,18 @@ int cmCPackArchiveGenerator::addOneComponentToArchive( */ #define DECLARE_AND_OPEN_ARCHIVE(filename, archive) \ cmGeneratedFileStream gf; \ - gf.Open((filename).c_str(), false, true); \ + gf.Open((filename), false, true); \ if (!GenerateHeader(&gf)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to generate Header for archive < " \ + "Problem to generate Header for archive <" \ << (filename) << ">." << std::endl); \ return 0; \ } \ cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \ if (!(archive)) { \ cmCPackLogger(cmCPackLog::LOG_ERROR, \ - "Problem to create archive < " \ - << (filename) << ">. ERROR =" << (archive).GetError() \ + "Problem to create archive <" \ + << (filename) << ">, ERROR = " << (archive).GetError() \ << std::endl); \ return 0; \ } @@ -262,9 +262,9 @@ int cmCPackArchiveGenerator::PackageFiles() archive.Add(rp, 0, nullptr, false); if (!archive) { cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem while adding file< " + "Problem while adding file <" << file << "> to archive <" << packageFileNames[0] - << "> .ERROR =" << archive.GetError() << std::endl); + << ">, ERROR = " << archive.GetError() << std::endl); return 0; } } diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index f2907db..bb980d7 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -143,4 +143,29 @@ public: std::vector<cmCPackComponentGroup*> Subgroups; }; +/** \class cmCPackInstallCMakeProject + * \brief A single quadruplet from the CPACK_INSTALL_CMAKE_PROJECTS variable. + */ +class cmCPackInstallCMakeProject +{ +public: + /// The directory of the CMake project. + std::string Directory; + + /// The name of the CMake project. + std::string ProjectName; + + /// The name of the component (or component set) to install. + std::string Component; + + /// The subdirectory to install into. + std::string SubDirectory; + + /// The list of installation types. + std::vector<cmCPackInstallationType*> InstallationTypes; + + /// The list of components. + std::vector<cmCPackComponent*> Components; +}; + #endif diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 8a4c004..972fe6f 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -61,7 +61,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel, component_path += packageName; this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); - if (!this->ReadListFile("CPackDeb.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackDeb.cmake" << std::endl); retval = 0; @@ -179,7 +179,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne( this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); } - if (!this->ReadListFile("CPackDeb.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackDeb.cmake" << std::endl); retval = 0; @@ -238,7 +238,7 @@ int cmCPackDebGenerator::createDeb() const std::string strGenWDIR(this->GetOption("GEN_WDIR")); const std::string dbfilename = strGenWDIR + "/debian-binary"; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(dbfilename.c_str()); + cmGeneratedFileStream out(dbfilename); out << "2.0"; out << std::endl; // required for valid debian package } @@ -287,7 +287,7 @@ int cmCPackDebGenerator::createDeb() this->GetOption("GEN_CPACK_DEBIAN_PACKAGE_SOURCE"); { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(ctlfilename.c_str()); + cmGeneratedFileStream out(ctlfilename); out << "Package: " << debian_pkg_name << "\n"; out << "Version: " << debian_pkg_version << "\n"; out << "Section: " << debian_pkg_section << "\n"; @@ -347,7 +347,7 @@ int cmCPackDebGenerator::createDeb() const bool gen_shibs = this->IsOn("CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS") && debian_pkg_shlibs && *debian_pkg_shlibs; if (gen_shibs) { - cmGeneratedFileStream out(shlibsfilename.c_str()); + cmGeneratedFileStream out(shlibsfilename); out << debian_pkg_shlibs; out << std::endl; } @@ -355,7 +355,7 @@ int cmCPackDebGenerator::createDeb() const std::string postinst = strGenWDIR + "/postinst"; const std::string postrm = strGenWDIR + "/postrm"; if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTINST")) { - cmGeneratedFileStream out(postinst.c_str()); + cmGeneratedFileStream out(postinst); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"configure\" ]; then\n" @@ -363,7 +363,7 @@ int cmCPackDebGenerator::createDeb() "fi\n"; } if (this->IsOn("GEN_CPACK_DEBIAN_GENERATE_POSTRM")) { - cmGeneratedFileStream out(postrm.c_str()); + cmGeneratedFileStream out(postrm); out << "#!/bin/sh\n\n" "set -e\n\n" "if [ \"$1\" = \"remove\" ]; then\n" @@ -412,7 +412,7 @@ int cmCPackDebGenerator::createDeb() // atomic file generation for data.tar { cmGeneratedFileStream fileStream_data_tar; - fileStream_data_tar.Open(filename_data_tar.c_str(), false, true); + fileStream_data_tar.Open(filename_data_tar, false, true); if (!fileStream_data_tar) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error opening the file \"" @@ -493,7 +493,7 @@ int cmCPackDebGenerator::createDeb() std::string md5filename = strGenWDIR + "/md5sums"; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(md5filename.c_str()); + cmGeneratedFileStream out(md5filename); std::string topLevelWithTrailingSlash = this->GetOption("CPACK_TEMPORARY_DIRECTORY"); @@ -528,7 +528,7 @@ int cmCPackDebGenerator::createDeb() // atomic file generation for control.tar { cmGeneratedFileStream fileStream_control_tar; - fileStream_control_tar.Open(filename_control_tar.c_str(), false, true); + fileStream_control_tar.Open(filename_control_tar, false, true); if (!fileStream_control_tar) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error opening the file \"" << filename_control_tar @@ -662,7 +662,7 @@ int cmCPackDebGenerator::createDeb() std::string const outputPath = outputDir + "/" + outputName; std::string const tlDir = strGenWDIR + "/"; cmGeneratedFileStream debStream; - debStream.Open(outputPath.c_str(), false, true); + debStream.Open(outputPath, false, true); cmArchiveWrite deb(debStream, cmArchiveWrite::CompressNone, "arbsd"); // uid/gid should be the one of the root user, and this root user has diff --git a/Source/CPack/cmCPackExtGenerator.cxx b/Source/CPack/cmCPackExtGenerator.cxx new file mode 100644 index 0000000..c36b098 --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.cxx @@ -0,0 +1,291 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCPackExtGenerator.h" + +#include "cmAlgorithms.h" +#include "cmCPackComponentGroup.h" +#include "cmCPackLog.h" +#include "cmSystemTools.h" + +#include "cm_jsoncpp_value.h" +#include "cm_jsoncpp_writer.h" + +#include "cmsys/FStream.hxx" + +#include <utility> +#include <vector> + +int cmCPackExtGenerator::InitializeInternal() +{ + this->SetOption("CPACK_EXT_KNOWN_VERSIONS", "1.0"); + + if (!this->ReadListFile("Internal/CPack/CPackExt.cmake")) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while executing CPackExt.cmake" << std::endl); + return 0; + } + + std::string major = this->GetOption("CPACK_EXT_SELECTED_MAJOR"); + if (major == "1") { + this->Generator = cm::make_unique<cmCPackExtVersion1Generator>(this); + } + + return this->Superclass::InitializeInternal(); +} + +int cmCPackExtGenerator::PackageFiles() +{ + Json::StreamWriterBuilder builder; + builder["indentation"] = " "; + + std::string filename = "package.json"; + if (!this->packageFileNames.empty()) { + filename = this->packageFileNames[0]; + } + + cmsys::ofstream fout(filename.c_str()); + std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); + + Json::Value root(Json::objectValue); + + if (!this->Generator->WriteToJSON(root)) { + return 0; + } + + if (jout->write(root, &fout)) { + return 0; + } + + return 1; +} + +bool cmCPackExtGenerator::SupportsComponentInstallation() const +{ + return true; +} + +int cmCPackExtGenerator::InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) +{ + (void)setDestDir; + (void)tempInstallDirectory; + return 1; +} + +int cmCPackExtGenerator::InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) +{ + (void)setDestDir; + (void)tempInstallDirectory; + (void)default_dir_mode; + return 1; +} + +int cmCPackExtGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + (void)installProjectName; + (void)installDirectory; + (void)globalGenerator; + (void)buildConfig; + return 1; +} + +int cmCPackExtGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + (void)setDestDir; + (void)installDirectory; + (void)baseTempInstallDirectory; + (void)default_dir_mode; + (void)component; + (void)componentInstall; + (void)installSubDirectory; + (void)buildConfig; + (void)absoluteDestFiles; + return 1; +} + +cmCPackExtGenerator::cmCPackExtVersionGenerator::cmCPackExtVersionGenerator( + cmCPackExtGenerator* parent) + : Parent(parent) +{ +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteVersion( + Json::Value& root) +{ + root["formatVersionMajor"] = this->GetVersionMajor(); + root["formatVersionMinor"] = this->GetVersionMinor(); + + return 1; +} + +int cmCPackExtGenerator::cmCPackExtVersionGenerator::WriteToJSON( + Json::Value& root) +{ + if (!this->WriteVersion(root)) { + return 0; + } + + const char* packageName = this->Parent->GetOption("CPACK_PACKAGE_NAME"); + if (packageName) { + root["packageName"] = packageName; + } + + const char* packageVersion = + this->Parent->GetOption("CPACK_PACKAGE_VERSION"); + if (packageVersion) { + root["packageVersion"] = packageVersion; + } + + const char* packageDescriptionFile = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE"); + if (packageDescriptionFile) { + root["packageDescriptionFile"] = packageDescriptionFile; + } + + const char* packageDescriptionSummary = + this->Parent->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"); + if (packageDescriptionSummary) { + root["packageDescriptionSummary"] = packageDescriptionSummary; + } + + const char* buildConfigCstr = this->Parent->GetOption("CPACK_BUILD_CONFIG"); + if (buildConfigCstr) { + root["buildConfig"] = buildConfigCstr; + } + + const char* defaultDirectoryPermissions = + this->Parent->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (defaultDirectoryPermissions && *defaultDirectoryPermissions) { + root["defaultDirectoryPermissions"] = defaultDirectoryPermissions; + } + if (cmSystemTools::IsInternallyOn( + this->Parent->GetOption("CPACK_SET_DESTDIR"))) { + root["setDestdir"] = true; + root["packagingInstallPrefix"] = + this->Parent->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); + } else { + root["setDestdir"] = false; + } + + root["stripFiles"] = + !cmSystemTools::IsOff(this->Parent->GetOption("CPACK_STRIP_FILES")); + root["warnOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION"); + root["errorOnAbsoluteInstallDestination"] = + this->Parent->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION"); + + Json::Value& projects = root["projects"] = Json::Value(Json::arrayValue); + for (auto& project : this->Parent->CMakeProjects) { + Json::Value jsonProject(Json::objectValue); + + jsonProject["projectName"] = project.ProjectName; + jsonProject["component"] = project.Component; + jsonProject["directory"] = project.Directory; + jsonProject["subDirectory"] = project.SubDirectory; + + Json::Value& installationTypes = jsonProject["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : project.InstallationTypes) { + installationTypes.append(installationType->Name); + } + + Json::Value& components = jsonProject["components"] = + Json::Value(Json::arrayValue); + for (auto& component : project.Components) { + components.append(component->Name); + } + + projects.append(jsonProject); + } + + Json::Value& installationTypes = root["installationTypes"] = + Json::Value(Json::objectValue); + for (auto& installationType : this->Parent->InstallationTypes) { + Json::Value& jsonInstallationType = + installationTypes[installationType.first] = + Json::Value(Json::objectValue); + + jsonInstallationType["name"] = installationType.second.Name; + jsonInstallationType["displayName"] = installationType.second.DisplayName; + jsonInstallationType["index"] = installationType.second.Index; + } + + Json::Value& components = root["components"] = + Json::Value(Json::objectValue); + for (auto& component : this->Parent->Components) { + Json::Value& jsonComponent = components[component.first] = + Json::Value(Json::objectValue); + + jsonComponent["name"] = component.second.Name; + jsonComponent["displayName"] = component.second.DisplayName; + if (component.second.Group) { + jsonComponent["group"] = component.second.Group->Name; + } + jsonComponent["isRequired"] = component.second.IsRequired; + jsonComponent["isHidden"] = component.second.IsHidden; + jsonComponent["isDisabledByDefault"] = + component.second.IsDisabledByDefault; + jsonComponent["isDownloaded"] = component.second.IsDownloaded; + jsonComponent["description"] = component.second.Description; + jsonComponent["archiveFile"] = component.second.ArchiveFile; + + Json::Value& cmpInstallationTypes = jsonComponent["installationTypes"] = + Json::Value(Json::arrayValue); + for (auto& installationType : component.second.InstallationTypes) { + cmpInstallationTypes.append(installationType->Name); + } + + Json::Value& dependencies = jsonComponent["dependencies"] = + Json::Value(Json::arrayValue); + for (auto& dep : component.second.Dependencies) { + dependencies.append(dep->Name); + } + } + + Json::Value& groups = root["componentGroups"] = + Json::Value(Json::objectValue); + for (auto& group : this->Parent->ComponentGroups) { + Json::Value& jsonGroup = groups[group.first] = + Json::Value(Json::objectValue); + + jsonGroup["name"] = group.second.Name; + jsonGroup["displayName"] = group.second.DisplayName; + jsonGroup["description"] = group.second.Description; + jsonGroup["isBold"] = group.second.IsBold; + jsonGroup["isExpandedByDefault"] = group.second.IsExpandedByDefault; + if (group.second.ParentGroup) { + jsonGroup["parentGroup"] = group.second.ParentGroup->Name; + } + + Json::Value& subgroups = jsonGroup["subgroups"] = + Json::Value(Json::arrayValue); + for (auto& subgroup : group.second.Subgroups) { + subgroups.append(subgroup->Name); + } + + Json::Value& groupComponents = jsonGroup["components"] = + Json::Value(Json::arrayValue); + for (auto& component : group.second.Components) { + groupComponents.append(component->Name); + } + } + + return 1; +} diff --git a/Source/CPack/cmCPackExtGenerator.h b/Source/CPack/cmCPackExtGenerator.h new file mode 100644 index 0000000..fa12d7f --- /dev/null +++ b/Source/CPack/cmCPackExtGenerator.h @@ -0,0 +1,86 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmCPackExtGenerator_h +#define cmCPackExtGenerator_h + +#include "cmCPackGenerator.h" +#include "cm_sys_stat.h" + +#include <memory> +#include <string> + +class cmGlobalGenerator; +namespace Json { +class Value; +} + +/** \class cmCPackExtGenerator + * \brief A generator for CPack External packaging tools + */ +class cmCPackExtGenerator : public cmCPackGenerator +{ +public: + cmCPackTypeMacro(cmCPackExtGenerator, cmCPackGenerator); + + const char* GetOutputExtension() override { return ".json"; } + +protected: + int InitializeInternal() override; + + int PackageFiles() override; + + bool SupportsComponentInstallation() const override; + + int InstallProjectViaInstallCommands( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstallScript( + bool setDestDir, const std::string& tempInstallDirectory) override; + int InstallProjectViaInstalledDirectories( + bool setDestDir, const std::string& tempInstallDirectory, + const mode_t* default_dir_mode) override; + + int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig) override; + int InstallCMakeProject(bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, + const std::string& buildConfig, + std::string& absoluteDestFiles) override; + +private: + class cmCPackExtVersionGenerator + { + public: + cmCPackExtVersionGenerator(cmCPackExtGenerator* parent); + + virtual ~cmCPackExtVersionGenerator() = default; + + virtual int WriteToJSON(Json::Value& root); + + protected: + virtual int GetVersionMajor() = 0; + virtual int GetVersionMinor() = 0; + + int WriteVersion(Json::Value& root); + + cmCPackExtGenerator* Parent; + }; + + class cmCPackExtVersion1Generator : public cmCPackExtVersionGenerator + { + public: + using cmCPackExtVersionGenerator::cmCPackExtVersionGenerator; + + protected: + int GetVersionMajor() override { return 1; } + int GetVersionMinor() override { return 0; } + }; + + std::unique_ptr<cmCPackExtVersionGenerator> Generator; +}; + +#endif diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 91ae1a2..1433414 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -298,7 +298,7 @@ static bool has_suffix(const std::string& str, const std::string& suffix) int cmCPackFreeBSDGenerator::PackageFiles() { - if (!this->ReadListFile("CPackFreeBSD.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackFreeBSD.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackFreeBSD.cmake" << std::endl); return 0; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index f15445b..6347eed 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -288,7 +288,7 @@ int cmCPackGenerator::InstallProjectViaInstallCommands( if (!resB || retVal) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/InstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << ic << std::endl << "# Output:" << std::endl << output << std::endl; @@ -369,7 +369,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( inFile += '/'; } for (cmsys::RegularExpression& reg : ignoreFilesRegex) { - if (reg.find(inFile.c_str())) { + if (reg.find(inFile)) { cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Ignore file: " << inFile << std::endl); skip = true; @@ -545,10 +545,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( ++it; std::string installProjectName = *it; ++it; - std::string installComponent = *it; + cmCPackInstallCMakeProject project; + + project.Directory = installDirectory; + project.ProjectName = installProjectName; + project.Component = *it; ++it; - std::string installSubDirectory = *it; - std::string installFile = installDirectory + "/cmake_install.cmake"; + project.SubDirectory = *it; std::vector<std::string> componentsVector; @@ -559,34 +562,36 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( * - the user did not request Monolithic install * (this works at CPack time too) */ - if (this->SupportsComponentInstallation() & + if (this->SupportsComponentInstallation() && !(this->IsOn("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + - cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; + cmSystemTools::UpperCase(project.Component) + "_INSTALL_TYPES"; const char* installTypes = this->GetOption(installTypesVar); if (installTypes && *installTypes) { std::vector<std::string> installTypesVector; cmSystemTools::ExpandListArgument(installTypes, installTypesVector); for (std::string const& installType : installTypesVector) { - this->GetInstallationType(installProjectName, installType); + project.InstallationTypes.push_back( + this->GetInstallationType(project.ProjectName, installType)); } } // Determine the set of components that will be used in this project std::string componentsVar = - "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); + "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(project.Component); const char* components = this->GetOption(componentsVar); if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); for (std::string const& comp : componentsVector) { - GetComponent(installProjectName, comp); + project.Components.push_back( + this->GetComponent(project.ProjectName, comp)); } componentInstall = true; } } if (componentsVector.empty()) { - componentsVector.push_back(installComponent); + componentsVector.push_back(project.Component); } const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG"); @@ -606,297 +611,316 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // on windows. cmSystemTools::SetForceUnixPaths(globalGenerator->GetForceUnixPaths()); - // Does this generator require pre-install? - if (const char* preinstall = - globalGenerator->GetPreinstallTargetName()) { - std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( - preinstall, buildConfig, "", false); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Install command: " << buildCommand << std::endl); - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Run preinstall target for: " << installProjectName - << std::endl); - std::string output; - int retVal = 1; - bool resB = cmSystemTools::RunSingleCommand( - buildCommand.c_str(), &output, &output, &retVal, - installDirectory.c_str(), this->GeneratorVerbose, - cmDuration::zero()); - if (!resB || retVal) { - std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); - tmpFile += "/PreinstallOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); - ofs << "# Run command: " << buildCommand << std::endl - << "# Directory: " << installDirectory << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running install command: " - << buildCommand << std::endl - << "Please check " << tmpFile << " for errors" - << std::endl); - return 0; - } + if (!this->RunPreinstallTarget(project.ProjectName, project.Directory, + globalGenerator, buildConfig)) { + return 0; } + delete globalGenerator; cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install project: " << installProjectName << std::endl); + "- Install project: " << project.ProjectName << std::endl); // Run the installation for each component for (std::string const& component : componentsVector) { - std::string tempInstallDirectory = baseTempInstallDirectory; - installComponent = component; - if (componentInstall) { - cmCPackLogger(cmCPackLog::LOG_OUTPUT, - "- Install component: " << installComponent - << std::endl); + if (!this->InstallCMakeProject( + setDestDir, project.Directory, baseTempInstallDirectory, + default_dir_mode, component, componentInstall, + project.SubDirectory, buildConfig, absoluteDestFiles)) { + return 0; } + } - cmake cm(cmake::RoleScript); - cm.SetHomeDirectory(""); - cm.SetHomeOutputDirectory(""); - cm.GetCurrentSnapshot().SetDefaultDefinitions(); - cm.AddCMakePaths(); - cm.SetProgressCallback(cmCPackGeneratorProgress, this); - cm.SetTrace(this->Trace); - cm.SetTraceExpand(this->TraceExpand); - cmGlobalGenerator gg(&cm); - cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - if (!installSubDirectory.empty() && installSubDirectory != "/" && - installSubDirectory != ".") { - tempInstallDirectory += installSubDirectory; - } - if (componentInstall) { - tempInstallDirectory += "/"; - // Some CPack generators would rather chose - // the local installation directory suffix. - // Some (e.g. RPM) use - // one install directory for each component **GROUP** - // instead of the default - // one install directory for each component. - tempInstallDirectory += - GetComponentInstallDirNameSuffix(installComponent); - if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { - tempInstallDirectory += "/"; - tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); - } - } + this->CMakeProjects.push_back(project); + } + } + this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", + absoluteDestFiles.c_str()); + return 1; +} - const char* default_dir_inst_permissions = - this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); - if (default_dir_inst_permissions && *default_dir_inst_permissions) { - mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", - default_dir_inst_permissions); - } +int cmCPackGenerator::RunPreinstallTarget( + const std::string& installProjectName, const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, const std::string& buildConfig) +{ + // Does this generator require pre-install? + if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) { + std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand( + preinstall, buildConfig, "", false); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Install command: " << buildCommand << std::endl); + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Run preinstall target for: " << installProjectName + << std::endl); + std::string output; + int retVal = 1; + bool resB = cmSystemTools::RunSingleCommand( + buildCommand.c_str(), &output, &output, &retVal, + installDirectory.c_str(), this->GeneratorVerbose, cmDuration::zero()); + if (!resB || retVal) { + std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); + tmpFile += "/PreinstallOutput.log"; + cmGeneratedFileStream ofs(tmpFile); + ofs << "# Run command: " << buildCommand << std::endl + << "# Directory: " << installDirectory << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running install command: " + << buildCommand << std::endl + << "Please check " << tmpFile << " for errors" + << std::endl); + return 0; + } + } - if (!setDestDir) { - tempInstallDirectory += this->GetPackagingInstallPrefix(); - } + return 1; +} - if (setDestDir) { - // For DESTDIR based packaging, use the *project* - // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The - // value of the project's CMAKE_INSTALL_PREFIX is sent in here as - // the value of the CPACK_INSTALL_PREFIX variable. - // - // If DESTDIR has been 'internally set ON' this means that - // the underlying CPack specific generator did ask for that - // In this case we may override CPACK_INSTALL_PREFIX with - // CPACK_PACKAGING_INSTALL_PREFIX - // I know this is tricky and awkward but it's the price for - // CPACK_SET_DESTDIR backward compatibility. - if (cmSystemTools::IsInternallyOn( - this->GetOption("CPACK_SET_DESTDIR"))) { - this->SetOption("CPACK_INSTALL_PREFIX", - this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); - } - std::string dir; - if (this->GetOption("CPACK_INSTALL_PREFIX")) { - dir += this->GetOption("CPACK_INSTALL_PREFIX"); - } - mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); +int cmCPackGenerator::InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, const mode_t* default_dir_mode, + const std::string& component, bool componentInstall, + const std::string& installSubDirectory, const std::string& buildConfig, + std::string& absoluteDestFiles) +{ + std::string tempInstallDirectory = baseTempInstallDirectory; + std::string installFile = installDirectory + "/cmake_install.cmake"; - cmCPackLogger( - cmCPackLog::LOG_DEBUG, - "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" - << std::endl); - - // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory - // exists: - // - if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { - dir = tempInstallDirectory + dir; - } else { - dir = tempInstallDirectory + "/" + dir; - } - /* - * We must re-set DESTDIR for each component - * We must not add the CPACK_INSTALL_PREFIX part because - * it will be added using the override of CMAKE_INSTALL_PREFIX - * The main reason for this awkward trick is that - * are using DESTDIR for 2 different reasons: - * - Because it was asked by the CPack Generator or the user - * using CPACK_SET_DESTDIR - * - Because it was already used for component install - * in order to put things in subdirs... - */ - cmSystemTools::PutEnv(std::string("DESTDIR=") + - tempInstallDirectory); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Creating directory: '" << dir << "'" << std::endl); + if (componentInstall) { + cmCPackLogger(cmCPackLog::LOG_OUTPUT, + "- Install component: " << component << std::endl); + } - if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { - cmCPackLogger( - cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " << dir << std::endl); - return 0; - } - } else { - mf.AddDefinition("CMAKE_INSTALL_PREFIX", - tempInstallDirectory.c_str()); + cmake cm(cmake::RoleScript); + cm.SetHomeDirectory(""); + cm.SetHomeOutputDirectory(""); + cm.GetCurrentSnapshot().SetDefaultDefinitions(); + cm.AddCMakePaths(); + cm.SetProgressCallback(cmCPackGeneratorProgress, this); + cm.SetTrace(this->Trace); + cm.SetTraceExpand(this->TraceExpand); + cmGlobalGenerator gg(&cm); + cmMakefile mf(&gg, cm.GetCurrentSnapshot()); + if (!installSubDirectory.empty() && installSubDirectory != "/" && + installSubDirectory != ".") { + tempInstallDirectory += installSubDirectory; + } + if (componentInstall) { + tempInstallDirectory += "/"; + // Some CPack generators would rather chose + // the local installation directory suffix. + // Some (e.g. RPM) use + // one install directory for each component **GROUP** + // instead of the default + // one install directory for each component. + tempInstallDirectory += GetComponentInstallDirNameSuffix(component); + if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) { + tempInstallDirectory += "/"; + tempInstallDirectory += this->GetOption("CPACK_PACKAGE_FILE_NAME"); + } + } - if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, - default_dir_mode)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem creating temporary directory: " - << tempInstallDirectory << std::endl); - return 0; - } + const char* default_dir_inst_permissions = + this->GetOption("CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS"); + if (default_dir_inst_permissions && *default_dir_inst_permissions) { + mf.AddDefinition("CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS", + default_dir_inst_permissions); + } - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Using non-DESTDIR install... (mf.AddDefinition)" - << std::endl); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "- Setting CMAKE_INSTALL_PREFIX to '" - << tempInstallDirectory << "'" << std::endl); - } + if (!setDestDir) { + tempInstallDirectory += this->GetPackagingInstallPrefix(); + } - if (!buildConfig.empty()) { - mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); - } - std::string installComponentLowerCase = - cmSystemTools::LowerCase(installComponent); - if (installComponentLowerCase != "all") { - mf.AddDefinition("CMAKE_INSTALL_COMPONENT", - installComponent.c_str()); - } + if (setDestDir) { + // For DESTDIR based packaging, use the *project* + // CMAKE_INSTALL_PREFIX underneath the tempInstallDirectory. The + // value of the project's CMAKE_INSTALL_PREFIX is sent in here as + // the value of the CPACK_INSTALL_PREFIX variable. + // + // If DESTDIR has been 'internally set ON' this means that + // the underlying CPack specific generator did ask for that + // In this case we may override CPACK_INSTALL_PREFIX with + // CPACK_PACKAGING_INSTALL_PREFIX + // I know this is tricky and awkward but it's the price for + // CPACK_SET_DESTDIR backward compatibility. + if (cmSystemTools::IsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"))) { + this->SetOption("CPACK_INSTALL_PREFIX", + this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")); + } + std::string dir; + if (this->GetOption("CPACK_INSTALL_PREFIX")) { + dir += this->GetOption("CPACK_INSTALL_PREFIX"); + } + mf.AddDefinition("CMAKE_INSTALL_PREFIX", dir.c_str()); - // strip on TRUE, ON, 1, one or several file names, but not on - // FALSE, OFF, 0 and an empty string - if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { - mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); - } - // Remember the list of files before installation - // of the current component (if we are in component install) - std::string const& InstallPrefix = tempInstallDirectory; - std::vector<std::string> filesBefore; - std::string findExpr = tempInstallDirectory; - if (componentInstall) { - cmsys::Glob glB; - findExpr += "/*"; - glB.RecurseOn(); - glB.SetRecurseListDirs(true); - glB.FindFiles(findExpr); - filesBefore = glB.GetFiles(); - std::sort(filesBefore.begin(), filesBefore.end()); - } + cmCPackLogger( + cmCPackLog::LOG_DEBUG, + "- Using DESTDIR + CPACK_INSTALL_PREFIX... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << dir << "'" + << std::endl); + + // Make sure that DESTDIR + CPACK_INSTALL_PREFIX directory + // exists: + // + if (cmSystemTools::StringStartsWith(dir.c_str(), "/")) { + dir = tempInstallDirectory + dir; + } else { + dir = tempInstallDirectory + "/" + dir; + } + /* + * We must re-set DESTDIR for each component + * We must not add the CPACK_INSTALL_PREFIX part because + * it will be added using the override of CMAKE_INSTALL_PREFIX + * The main reason for this awkward trick is that + * are using DESTDIR for 2 different reasons: + * - Because it was asked by the CPack Generator or the user + * using CPACK_SET_DESTDIR + * - Because it was already used for component install + * in order to put things in subdirs... + */ + cmSystemTools::PutEnv(std::string("DESTDIR=") + tempInstallDirectory); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Creating directory: '" << dir << "'" << std::endl); - // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION - // then forward request to cmake_install.cmake script - if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // If current CPack generator does support - // ABSOLUTE INSTALL DESTINATION or CPack has been asked for - // then ask cmake_install.cmake script to error out - // as soon as it occurs (before installing file) - if (!SupportsAbsoluteDestination() || - this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { - mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); - } - // do installation - int res = mf.ReadListFile(installFile.c_str()); - // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES - // to CPack (may be used by generators like CPack RPM or DEB) - // in order to transparently handle ABSOLUTE PATH - if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { - mf.AddDefinition( - "CPACK_ABSOLUTE_DESTINATION_FILES", - mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); - } + if (!cmsys::SystemTools::MakeDirectory(dir, default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " << dir + << std::endl); + return 0; + } + } else { + mf.AddDefinition("CMAKE_INSTALL_PREFIX", tempInstallDirectory.c_str()); - // Now rebuild the list of files after installation - // of the current component (if we are in component install) - if (componentInstall) { - cmsys::Glob glA; - glA.RecurseOn(); - glA.SetRecurseListDirs(true); - glA.SetRecurseThroughSymlinks(false); - glA.FindFiles(findExpr); - std::vector<std::string> filesAfter = glA.GetFiles(); - std::sort(filesAfter.begin(), filesAfter.end()); - std::vector<std::string>::iterator diff; - std::vector<std::string> result(filesAfter.size()); - diff = std::set_difference(filesAfter.begin(), filesAfter.end(), - filesBefore.begin(), filesBefore.end(), - result.begin()); - - std::vector<std::string>::iterator fit; - std::string localFileName; - // Populate the File field of each component - for (fit = result.begin(); fit != diff; ++fit) { - localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); - localFileName = - localFileName.substr(localFileName.find_first_not_of('/')); - Components[installComponent].Files.push_back(localFileName); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Adding file <" - << localFileName << "> to component <" - << installComponent << ">" << std::endl); - } - } + if (!cmsys::SystemTools::MakeDirectory(tempInstallDirectory, + default_dir_mode)) { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem creating temporary directory: " + << tempInstallDirectory << std::endl); + return 0; + } - if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { - if (!absoluteDestFiles.empty()) { - absoluteDestFiles += ";"; - } - absoluteDestFiles += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - cmCPackLogger(cmCPackLog::LOG_DEBUG, - "Got some ABSOLUTE DESTINATION FILES: " - << absoluteDestFiles << std::endl); - // define component specific var - if (componentInstall) { - std::string absoluteDestFileComponent = - std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + - GetComponentInstallDirNameSuffix(installComponent); - if (nullptr != this->GetOption(absoluteDestFileComponent)) { - std::string absoluteDestFilesListComponent = - this->GetOption(absoluteDestFileComponent); - absoluteDestFilesListComponent += ";"; - absoluteDestFilesListComponent += - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - this->SetOption(absoluteDestFileComponent, - absoluteDestFilesListComponent.c_str()); - } else { - this->SetOption( - absoluteDestFileComponent, - mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); - } - } - } - if (cmSystemTools::GetErrorOccuredFlag() || !res) { - return 0; - } + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Using non-DESTDIR install... (mf.AddDefinition)" + << std::endl); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "- Setting CMAKE_INSTALL_PREFIX to '" << tempInstallDirectory + << "'" << std::endl); + } + + if (!buildConfig.empty()) { + mf.AddDefinition("BUILD_TYPE", buildConfig.c_str()); + } + std::string installComponentLowerCase = cmSystemTools::LowerCase(component); + if (installComponentLowerCase != "all") { + mf.AddDefinition("CMAKE_INSTALL_COMPONENT", component.c_str()); + } + + // strip on TRUE, ON, 1, one or several file names, but not on + // FALSE, OFF, 0 and an empty string + if (!cmSystemTools::IsOff(this->GetOption("CPACK_STRIP_FILES"))) { + mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1"); + } + // Remember the list of files before installation + // of the current component (if we are in component install) + std::string const& InstallPrefix = tempInstallDirectory; + std::vector<std::string> filesBefore; + std::string findExpr = tempInstallDirectory; + if (componentInstall) { + cmsys::Glob glB; + findExpr += "/*"; + glB.RecurseOn(); + glB.SetRecurseListDirs(true); + glB.FindFiles(findExpr); + filesBefore = glB.GetFiles(); + std::sort(filesBefore.begin(), filesBefore.end()); + } + + // If CPack was asked to warn on ABSOLUTE INSTALL DESTINATION + // then forward request to cmake_install.cmake script + if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // If current CPack generator does support + // ABSOLUTE INSTALL DESTINATION or CPack has been asked for + // then ask cmake_install.cmake script to error out + // as soon as it occurs (before installing file) + if (!SupportsAbsoluteDestination() || + this->IsOn("CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION")) { + mf.AddDefinition("CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION", "1"); + } + // do installation + int res = mf.ReadListFile(installFile.c_str()); + // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES + // to CPack (may be used by generators like CPack RPM or DEB) + // in order to transparently handle ABSOLUTE PATH + if (mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")) { + mf.AddDefinition("CPACK_ABSOLUTE_DESTINATION_FILES", + mf.GetDefinition("CMAKE_ABSOLUTE_DESTINATION_FILES")); + } + + // Now rebuild the list of files after installation + // of the current component (if we are in component install) + if (componentInstall) { + cmsys::Glob glA; + glA.RecurseOn(); + glA.SetRecurseListDirs(true); + glA.SetRecurseThroughSymlinks(false); + glA.FindFiles(findExpr); + std::vector<std::string> filesAfter = glA.GetFiles(); + std::sort(filesAfter.begin(), filesAfter.end()); + std::vector<std::string>::iterator diff; + std::vector<std::string> result(filesAfter.size()); + diff = std::set_difference(filesAfter.begin(), filesAfter.end(), + filesBefore.begin(), filesBefore.end(), + result.begin()); + + std::vector<std::string>::iterator fit; + std::string localFileName; + // Populate the File field of each component + for (fit = result.begin(); fit != diff; ++fit) { + localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); + localFileName = + localFileName.substr(localFileName.find_first_not_of('/')); + Components[component].Files.push_back(localFileName); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Adding file <" << localFileName << "> to component <" + << component << ">" << std::endl); + } + } + + if (nullptr != mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")) { + if (!absoluteDestFiles.empty()) { + absoluteDestFiles += ";"; + } + absoluteDestFiles += mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Got some ABSOLUTE DESTINATION FILES: " << absoluteDestFiles + << std::endl); + // define component specific var + if (componentInstall) { + std::string absoluteDestFileComponent = + std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + + GetComponentInstallDirNameSuffix(component); + if (nullptr != this->GetOption(absoluteDestFileComponent)) { + std::string absoluteDestFilesListComponent = + this->GetOption(absoluteDestFileComponent); + absoluteDestFilesListComponent += ";"; + absoluteDestFilesListComponent += + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); + this->SetOption(absoluteDestFileComponent, + absoluteDestFilesListComponent.c_str()); + } else { + this->SetOption(absoluteDestFileComponent, + mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); } } } - this->SetOption("CPACK_ABSOLUTE_DESTINATION_FILES", - absoluteDestFiles.c_str()); + if (cmSystemTools::GetErrorOccuredFlag() || !res) { + return 0; + } return 1; } diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index c22f36b..c13c649 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -15,6 +15,7 @@ #include "cm_sys_stat.h" class cmCPackLog; +class cmGlobalGenerator; class cmInstalledFile; class cmMakefile; @@ -185,6 +186,17 @@ protected: bool setDestDir, const std::string& tempInstallDirectory, const mode_t* default_dir_mode); + virtual int RunPreinstallTarget(const std::string& installProjectName, + const std::string& installDirectory, + cmGlobalGenerator* globalGenerator, + const std::string& buildConfig); + virtual int InstallCMakeProject( + bool setDestDir, const std::string& installDirectory, + const std::string& baseTempInstallDirectory, + const mode_t* default_dir_mode, const std::string& component, + bool componentInstall, const std::string& installSubDirectory, + const std::string& buildConfig, std::string& absoluteDestFiles); + /** * The various level of support of * CPACK_SET_DESTDIR used by the generator. @@ -271,6 +283,7 @@ protected: */ std::vector<std::string> files; + std::vector<cmCPackInstallCMakeProject> CMakeProjects; std::map<std::string, cmCPackInstallationType> InstallationTypes; /** * The set of components. diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx index d47e5ed..8ef24f7 100644 --- a/Source/CPack/cmCPackGeneratorFactory.cxx +++ b/Source/CPack/cmCPackGeneratorFactory.cxx @@ -12,6 +12,7 @@ # include "cmCPackFreeBSDGenerator.h" #endif #include "cmCPackDebGenerator.h" +#include "cmCPackExtGenerator.h" #include "cmCPackGenerator.h" #include "cmCPackLog.h" #include "cmCPackNSISGenerator.h" @@ -110,6 +111,10 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory() this->RegisterGenerator("NuGet", "NuGet packages", cmCPackNuGetGenerator::CreateGenerator); } + if (cmCPackExtGenerator::CanGenerate()) { + this->RegisterGenerator("Ext", "CPack External packages", + cmCPackExtGenerator::CreateGenerator); + } #ifdef __APPLE__ if (cmCPackDragNDropGenerator::CanGenerate()) { this->RegisterGenerator("DragNDrop", "Mac OSX Drag And Drop", diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index a893a0f..f75a750 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -305,7 +305,7 @@ int cmCPackNSISGenerator::PackageFiles() nsisCmd.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -416,7 +416,7 @@ int cmCPackNSISGenerator::InitializeInternal() const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); std::string tmpFile = topDir ? topDir : "."; tmpFile += "/NSISOutput.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << nsisCmd << std::endl << "# Output:" << std::endl << output << std::endl; @@ -703,7 +703,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( // Find a ZIP program if (!this->IsSet("ZIP_EXECUTABLE")) { - this->ReadListFile("CPackZIP.cmake"); + this->ReadListFile("Internal/CPack/CPackZIP.cmake"); if (!this->IsSet("ZIP_EXECUTABLE")) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -726,7 +726,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( cmSystemTools::IsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES")); unsigned long totalSize = 0; { // the scope is needed for cmGeneratedFileStream - cmGeneratedFileStream out(zipListFileName.c_str()); + cmGeneratedFileStream out(zipListFileName); for (std::string const& file : component->Files) { if (needQuotesInFile) { out << "\""; @@ -754,7 +754,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( if (!res || retVal) { std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY"); tmpFile += "/CompressZip.log"; - cmGeneratedFileStream ofs(tmpFile.c_str()); + cmGeneratedFileStream ofs(tmpFile); ofs << "# Run command: " << cmd << std::endl << "# Output:" << std::endl << output << std::endl; diff --git a/Source/CPack/cmCPackNuGetGenerator.cxx b/Source/CPack/cmCPackNuGetGenerator.cxx index 2ae8cba..76f0699 100644 --- a/Source/CPack/cmCPackNuGetGenerator.cxx +++ b/Source/CPack/cmCPackNuGetGenerator.cxx @@ -49,7 +49,7 @@ int cmCPackNuGetGenerator::PackageFiles() this->SetOption("CPACK_NUGET_ORDINAL_MONOLITIC", "TRUE"); } - auto retval = this->ReadListFile("CPackNuGet.cmake"); + auto retval = this->ReadListFile("Internal/CPack/CPackNuGet.cmake"); if (retval) { AddGeneratedPackageNames(); } else { diff --git a/Source/CPack/cmCPackProductBuildGenerator.cxx b/Source/CPack/cmCPackProductBuildGenerator.cxx index 4ca0fa8..76b3275 100644 --- a/Source/CPack/cmCPackProductBuildGenerator.cxx +++ b/Source/CPack/cmCPackProductBuildGenerator.cxx @@ -144,10 +144,10 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command) tmpFile += "/ProductBuildOutput.log"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl); - std::string output, error_output; + std::string output; int retVal = 1; bool res = cmSystemTools::RunSingleCommand( - command.c_str(), &output, &error_output, &retVal, nullptr, + command.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl); if (!res || retVal) { diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index c389884..5834829 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -89,7 +89,7 @@ int cmCPackRPMGenerator::PackageOnePack(std::string const& initialToplevel, component_path += packageName; this->SetOption("CPACK_RPM_PACKAGE_COMPONENT_PART_PATH", component_path.c_str()); - if (!this->ReadListFile("CPackRPM.cmake")) { + if (!this->ReadListFile("Internal/CPack/CPackRPM.cmake")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error while execution CPackRPM.cmake" << std::endl); retval = 0; @@ -385,7 +385,7 @@ int cmCPackRPMGenerator::PackageComponentsAllInOne( component_path.c_str()); } - if (this->ReadListFile("CPackRPM.cmake")) { + if (this->ReadListFile("Internal/CPack/CPackRPM.cmake")) { AddGeneratedPackageNames(); } else { cmCPackLogger(cmCPackLog::LOG_ERROR, diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 8527d54..3f6654b 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -589,7 +589,7 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) for (cmCTestCompileErrorWarningRex& rit : this->ErrorWarningFileLineRegex) { cmsys::RegularExpression* re = &rit.RegularExpression; - if (re->find(cm->Text.c_str())) { + if (re->find(cm->Text)) { cm->SourceFile = re->match(rit.FileIndex); // At this point we need to make this->SourceFile relative to // the source root of the project, so cvs links will work @@ -742,7 +742,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteLauncherConfig() // Give some testing configuration information to the launcher. std::string fname = this->Handler->CTestLaunchDir; fname += "/CTestLaunchConfig.cmake"; - cmGeneratedFileStream fout(fname.c_str()); + cmGeneratedFileStream fout(fname); std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); fout << "set(CTEST_SOURCE_DIRECTORY \"" << srcdir << "\")\n"; } @@ -757,7 +757,7 @@ void cmCTestBuildHandler::LaunchHelper::WriteScrapeMatchers( fname += "/Custom"; fname += purpose; fname += ".txt"; - cmGeneratedFileStream fout(fname.c_str()); + cmGeneratedFileStream fout(fname); for (std::string const& m : matchers) { fout << m << "\n"; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 43a2bae..1d9a5f7 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -1075,7 +1075,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( if (line.empty()) { // Ignore empty line; probably style 2 - } else if (st1re1.find(line.c_str())) { + } else if (st1re1.find(line)) { if (gcovStyle == 0) { gcovStyle = 1; } @@ -1088,7 +1088,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( actualSourceFile.clear(); sourceFile = st1re1.match(2); - } else if (st1re2.find(line.c_str())) { + } else if (st1re2.find(line)) { if (gcovStyle == 0) { gcovStyle = 1; } @@ -1100,7 +1100,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } gcovFile = st1re2.match(1); - } else if (st2re1.find(line.c_str())) { + } else if (st2re1.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1113,7 +1113,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( actualSourceFile.clear(); sourceFile = st2re1.match(1); - } else if (st2re2.find(line.c_str())) { + } else if (st2re2.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1123,7 +1123,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( cont->Error++; break; } - } else if (st2re3.find(line.c_str())) { + } else if (st2re3.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1135,7 +1135,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( } gcovFile = st2re3.match(2); - } else if (st2re4.find(line.c_str())) { + } else if (st2re4.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1150,7 +1150,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "Warning: " << st2re4.match(1) << " had unexpected EOF" << std::endl, this->Quiet); - } else if (st2re5.find(line.c_str())) { + } else if (st2re5.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } @@ -1165,7 +1165,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( "Warning: Cannot open file: " << st2re5.match(1) << std::endl, this->Quiet); - } else if (st2re6.find(line.c_str())) { + } else if (st2re6.find(line)) { if (gcovStyle == 0) { gcovStyle = 2; } diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 0bffde3..6cd1c09 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -345,7 +345,7 @@ void cmCTestLaunch::WriteXML() logXML += ".xml"; // Use cmGeneratedFileStream to atomically create the report file. - cmGeneratedFileStream fxml(logXML.c_str()); + cmGeneratedFileStream fxml(logXML); cmXMLWriter xml(fxml, 2); cmXMLElement e2(xml, "Failure"); e2.Attribute("type", this->IsError() ? "Error" : "Warning"); @@ -584,7 +584,7 @@ bool cmCTestLaunch::Match(std::string const& line, std::vector<cmsys::RegularExpression>& regexps) { for (cmsys::RegularExpression& r : regexps) { - if (r.find(line.c_str())) { + if (r.find(line)) { return true; } } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index dcef8a0..52db9d4 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -15,7 +15,6 @@ #include "cmUVSignalHackRAII.h" // IWYU pragma: keep #include "cmsys/FStream.hxx" -#include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" #include <algorithm> @@ -458,7 +457,7 @@ void cmCTestMultiProcessHandler::UpdateCostData() if (line == "---") { break; } - std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); + std::vector<std::string> parts = cmSystemTools::SplitString(line, ' '); // Format: <name> <previous_runs> <avg_cost> if (parts.size() < 3) { break; @@ -511,7 +510,7 @@ void cmCTestMultiProcessHandler::ReadCostData() break; } - std::vector<cmsys::String> parts = cmSystemTools::SplitString(line, ' '); + std::vector<std::string> parts = cmSystemTools::SplitString(line, ' '); // Probably an older version of the file, will be fixed next run if (parts.size() < 3) { diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 927797a..ef0a49d 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -49,7 +49,7 @@ void cmCTestRunTest::CheckOutput(std::string const& line) // Check for TIMEOUT_AFTER_MATCH property. if (!this->TestProperties->TimeoutRegularExpressions.empty()) { for (auto& reg : this->TestProperties->TimeoutRegularExpressions) { - if (reg.first.find(this->ProcessOutput.c_str())) { + if (reg.first.find(this->ProcessOutput)) { cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->GetIndex() << ": " @@ -148,7 +148,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) this->FailedDependencies.empty()) { bool found = false; for (auto& pass : this->TestProperties->RequiredRegularExpressions) { - if (pass.first.find(this->ProcessOutput.c_str())) { + if (pass.first.find(this->ProcessOutput)) { found = true; reason = "Required regular expression found."; break; @@ -168,7 +168,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) if (!this->TestProperties->ErrorRegularExpressions.empty() && this->FailedDependencies.empty()) { for (auto& pass : this->TestProperties->ErrorRegularExpressions) { - if (pass.first.find(this->ProcessOutput.c_str())) { + if (pass.first.find(this->ProcessOutput)) { reason = "Error regular expression found in output."; reason += " Regex=["; reason += pass.second; @@ -616,10 +616,10 @@ void cmCTestRunTest::DartProcessing() { if (!this->ProcessOutput.empty() && this->ProcessOutput.find("<DartMeasurement") != std::string::npos) { - if (this->TestHandler->DartStuff.find(this->ProcessOutput.c_str())) { + if (this->TestHandler->DartStuff.find(this->ProcessOutput)) { this->TestResult.DartString = this->TestHandler->DartStuff.match(1); // keep searching and replacing until none are left - while (this->TestHandler->DartStuff1.find(this->ProcessOutput.c_str())) { + while (this->TestHandler->DartStuff1.find(this->ProcessOutput)) { // replace the exact match for the string cmSystemTools::ReplaceString( this->ProcessOutput, this->TestHandler->DartStuff1.match(1).c_str(), diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 333c899..6b62bb4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -792,7 +792,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard() cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Write CMake output to file: " << cmakeOutputFile << std::endl); - cmGeneratedFileStream fout(cmakeOutputFile.c_str()); + cmGeneratedFileStream fout(cmakeOutputFile); if (fout) { fout << output.c_str(); } else { @@ -856,7 +856,7 @@ bool cmCTestScriptHandler::WriteInitialCache(const char* directory, { std::string cacheFile = directory; cacheFile += "/CMakeCache.txt"; - cmGeneratedFileStream fout(cacheFile.c_str()); + cmGeneratedFileStream fout(cacheFile); if (!fout) { return false; } diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 3911540..47006c1 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -121,7 +121,7 @@ bool cmCTestStartCommand::InitialPass(std::vector<std::string> const& args, // Log startup actions. std::string startLogFile = binaryDir + "/Testing/Temporary/LastStart.log"; - cmGeneratedFileStream ofs(startLogFile.c_str()); + cmGeneratedFileStream ofs(startLogFile); if (!ofs) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: LastStart.log" << std::endl); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 91b92a3..d1d8d08 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2310,7 +2310,7 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) this->Quiet); if (this->UseExcludeRegExpFlag && this->UseExcludeRegExpFirst && - this->ExcludeTestsRegularExpression.find(testname.c_str())) { + this->ExcludeTestsRegularExpression.find(testname)) { return true; } if (this->MemCheck) { @@ -2365,10 +2365,10 @@ bool cmCTestTestHandler::AddTest(const std::vector<std::string>& args) test.SkipReturnCode = -1; test.PreviousRuns = 0; if (this->UseIncludeRegExpFlag && - !this->IncludeTestsRegularExpression.find(testname.c_str())) { + !this->IncludeTestsRegularExpression.find(testname)) { test.IsInBasedOnREOptions = false; } else if (this->UseExcludeRegExpFlag && !this->UseExcludeRegExpFirst && - this->ExcludeTestsRegularExpression.find(testname.c_str())) { + this->ExcludeTestsRegularExpression.find(testname)) { test.IsInBasedOnREOptions = false; } this->TestList.push_back(test); diff --git a/Source/Checks/cm_cxx14_check.cmake b/Source/Checks/cm_cxx14_check.cmake index a78ba35..38606b9 100644 --- a/Source/Checks/cm_cxx14_check.cmake +++ b/Source/Checks/cm_cxx14_check.cmake @@ -1,5 +1,5 @@ set(CMake_CXX14_BROKEN 0) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI") if(NOT CMAKE_CXX14_STANDARD_COMPILE_OPTION) set(CMake_CXX14_WORKS 0) endif() diff --git a/Source/Checks/cm_cxx14_check.cpp b/Source/Checks/cm_cxx14_check.cpp index f5806a9..9369ba2 100644 --- a/Source/Checks/cm_cxx14_check.cpp +++ b/Source/Checks/cm_cxx14_check.cpp @@ -1,5 +1,8 @@ #include <cstdio> +#include <memory> + int main() { - return 0; + std::unique_ptr<int> u(new int(0)); + return *u; } diff --git a/Source/Checks/cm_cxx17_check.cmake b/Source/Checks/cm_cxx17_check.cmake index 83d3971..4da2fd7 100644 --- a/Source/Checks/cm_cxx17_check.cmake +++ b/Source/Checks/cm_cxx17_check.cmake @@ -1,5 +1,5 @@ set(CMake_CXX17_BROKEN 0) -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|PGI") if(NOT CMAKE_CXX17_STANDARD_COMPILE_OPTION) set(CMake_CXX17_WORKS 0) endif() diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp index 2cbf1d5..4e89184 100644 --- a/Source/Checks/cm_cxx17_check.cpp +++ b/Source/Checks/cm_cxx17_check.cpp @@ -1,7 +1,9 @@ #include <cstdio> +#include <memory> #include <unordered_map> int main() { - return 0; + std::unique_ptr<int> u(new int(0)); + return *u; } diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index 9bd1c11..a41d051 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -43,7 +43,7 @@ void cmCursesLongMessageForm::UpdateStatusBar() getmaxyx(stdscr, y, x); char bar[cmCursesMainForm::MAX_WIDTH]; - size_t size = strlen(this->Title.c_str()); + size_t size = this->Title.size(); if (size >= cmCursesMainForm::MAX_WIDTH) { size = cmCursesMainForm::MAX_WIDTH - 1; } diff --git a/Source/LexerParser/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx index aed0826..68b9e6c 100644 --- a/Source/LexerParser/cmCommandArgumentParser.cxx +++ b/Source/LexerParser/cmCommandArgumentParser.cxx @@ -126,8 +126,11 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4244) /* loss of precision */ # pragma warning (disable: 4702) /* unreachable code */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif -#line 131 "cmCommandArgumentParser.cxx" /* yacc.c:339 */ +#line 134 "cmCommandArgumentParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -200,7 +203,7 @@ int cmCommandArgument_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 204 "cmCommandArgumentParser.cxx" /* yacc.c:358 */ +#line 207 "cmCommandArgumentParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -498,9 +501,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 96, 96, 102, 105, 110, 113, 118, 121, 126, - 129, 132, 135, 138, 141, 146, 149, 152, 155, 160, - 163, 168, 171, 176, 179 + 0, 99, 99, 105, 108, 113, 116, 121, 124, 129, + 132, 135, 138, 141, 144, 149, 152, 155, 158, 163, + 166, 171, 174, 179, 182 }; #endif @@ -1297,192 +1300,192 @@ yyreduce: switch (yyn) { case 2: -#line 96 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 99 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = 0; yyGetParser->SetResult((yyvsp[0].str)); } -#line 1306 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1309 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 102 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1314 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1317 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 105 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 108 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1322 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1325 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 110 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = 0; } -#line 1330 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1333 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 113 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 116 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1338 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1341 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 118 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1346 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1349 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 121 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 124 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1354 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1357 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 126 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1362 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1365 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 129 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1370 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1373 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 132 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1378 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1381 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 135 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1386 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1389 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 138 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1394 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1397 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 141 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 144 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1402 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1405 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 146 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); } -#line 1410 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1413 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 149 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->ExpandSpecialVariable((yyvsp[-2].str), (yyvsp[-1].str)); } -#line 1418 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1421 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 152 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->ExpandVariable((yyvsp[-1].str)); } -#line 1426 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1429 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 155 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 158 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->ExpandVariableForAt((yyvsp[0].str)); } -#line 1434 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1437 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 160 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1442 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1445 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 163 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 166 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[-1].str); } -#line 1450 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1453 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 168 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = 0; } -#line 1458 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1461 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 171 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 174 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = yyGetParser->CombineUnions((yyvsp[-1].str), (yyvsp[0].str)); } -#line 1466 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1469 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 176 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1474 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1477 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 179 "cmCommandArgumentParser.y" /* yacc.c:1646 */ +#line 182 "cmCommandArgumentParser.y" /* yacc.c:1646 */ { (yyval.str) = (yyvsp[0].str); } -#line 1482 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1485 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ break; -#line 1486 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ +#line 1489 "cmCommandArgumentParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1712,7 +1715,7 @@ yyreturn: #endif return yyresult; } -#line 184 "cmCommandArgumentParser.y" /* yacc.c:1906 */ +#line 187 "cmCommandArgumentParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y index 55a88df..0c6aad5 100644 --- a/Source/LexerParser/cmCommandArgumentParser.y +++ b/Source/LexerParser/cmCommandArgumentParser.y @@ -55,6 +55,9 @@ static void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4244) /* loss of precision */ # pragma warning (disable: 4702) /* unreachable code */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif %} /* Generate a reentrant parser object. */ diff --git a/Source/LexerParser/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx index bc45d45..5400a10 100644 --- a/Source/LexerParser/cmDependsJavaParser.cxx +++ b/Source/LexerParser/cmDependsJavaParser.cxx @@ -115,8 +115,11 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif -#line 120 "cmDependsJavaParser.cxx" /* yacc.c:339 */ +#line 123 "cmDependsJavaParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -371,7 +374,7 @@ int cmDependsJava_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 375 "cmDependsJavaParser.cxx" /* yacc.c:358 */ +#line 378 "cmDependsJavaParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -679,42 +682,42 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 179, 179, 188, 196, 204, 212, 220, 228, 237, - 245, 254, 262, 271, 276, 281, 286, 291, 296, 301, - 306, 312, 320, 329, 339, 348, 357, 365, 375, 381, - 388, 395, 401, 408, 417, 427, 437, 446, 454, 463, - 472, 478, 487, 493, 502, 508, 517, 529, 537, 546, - 558, 571, 579, 587, 596, 604, 613, 613, 613, 614, - 615, 615, 615, 615, 615, 615, 616, 619, 629, 638, - 647, 656, 666, 672, 681, 690, 699, 707, 716, 725, - 731, 740, 748, 756, 764, 773, 781, 790, 796, 804, - 813, 821, 830, 839, 848, 856, 865, 873, 881, 890, - 899, 909, 916, 926, 936, 943, 950, 953, 959, 969, - 979, 989, 995, 1005, 1015, 1025, 1034, 1044, 1055, 1065, - 1072, 1082, 1091, 1101, 1110, 1120, 1126, 1136, 1145, 1155, - 1165, 1172, 1181, 1190, 1199, 1208, 1216, 1225, 1234, 1244, - 1254, 1263, 1273, 1283, 1290, 1299, 1309, 1318, 1328, 1337, - 1344, 1354, 1363, 1373, 1382, 1391, 1401, 1411, 1420, 1430, - 1439, 1448, 1457, 1466, 1475, 1485, 1494, 1503, 1512, 1521, - 1531, 1540, 1549, 1558, 1567, 1576, 1585, 1594, 1603, 1612, - 1621, 1630, 1640, 1650, 1661, 1671, 1681, 1690, 1699, 1708, - 1717, 1726, 1735, 1745, 1755, 1765, 1775, 1782, 1789, 1796, - 1806, 1813, 1823, 1833, 1842, 1852, 1861, 1871, 1878, 1885, - 1892, 1900, 1907, 1917, 1924, 1934, 1944, 1951, 1961, 1970, - 1980, 1990, 1999, 2009, 2018, 2028, 2039, 2046, 2053, 2064, - 2074, 2084, 2094, 2103, 2113, 2120, 2130, 2139, 2149, 2156, - 2166, 2175, 2185, 2194, 2200, 2209, 2218, 2227, 2236, 2246, - 2256, 2263, 2273, 2280, 2290, 2299, 2309, 2318, 2327, 2336, - 2346, 2353, 2363, 2372, 2382, 2392, 2398, 2405, 2415, 2425, - 2435, 2446, 2456, 2467, 2477, 2488, 2498, 2508, 2517, 2526, - 2535, 2544, 2554, 2564, 2574, 2583, 2592, 2601, 2610, 2620, - 2630, 2640, 2649, 2658, 2667, 2677, 2686, 2695, 2702, 2711, - 2720, 2729, 2739, 2748, 2757, 2767, 2776, 2785, 2794, 2804, - 2813, 2822, 2831, 2840, 2849, 2859, 2868, 2877, 2887, 2896, - 2906, 2915, 2925, 2934, 2944, 2953, 2963, 2972, 2982, 2991, - 3001, 3010, 3020, 3030, 3040, 3049, 3059, 3068, 3077, 3086, - 3095, 3104, 3113, 3122, 3131, 3140, 3149, 3158, 3168, 3178, - 3188, 3197 + 0, 182, 182, 191, 199, 207, 215, 223, 231, 240, + 248, 257, 265, 274, 279, 284, 289, 294, 299, 304, + 309, 315, 323, 332, 342, 351, 360, 368, 378, 384, + 391, 398, 404, 411, 420, 430, 440, 449, 457, 466, + 475, 481, 490, 496, 505, 511, 520, 532, 540, 549, + 561, 574, 582, 590, 599, 607, 616, 616, 616, 617, + 618, 618, 618, 618, 618, 618, 619, 622, 632, 641, + 650, 659, 669, 675, 684, 693, 702, 710, 719, 728, + 734, 743, 751, 759, 767, 776, 784, 793, 799, 807, + 816, 824, 833, 842, 851, 859, 868, 876, 884, 893, + 902, 912, 919, 929, 939, 946, 953, 956, 962, 972, + 982, 992, 998, 1008, 1018, 1028, 1037, 1047, 1058, 1068, + 1075, 1085, 1094, 1104, 1113, 1123, 1129, 1139, 1148, 1158, + 1168, 1175, 1184, 1193, 1202, 1211, 1219, 1228, 1237, 1247, + 1257, 1266, 1276, 1286, 1293, 1302, 1312, 1321, 1331, 1340, + 1347, 1357, 1366, 1376, 1385, 1394, 1404, 1414, 1423, 1433, + 1442, 1451, 1460, 1469, 1478, 1488, 1497, 1506, 1515, 1524, + 1534, 1543, 1552, 1561, 1570, 1579, 1588, 1597, 1606, 1615, + 1624, 1633, 1643, 1653, 1664, 1674, 1684, 1693, 1702, 1711, + 1720, 1729, 1738, 1748, 1758, 1768, 1778, 1785, 1792, 1799, + 1809, 1816, 1826, 1836, 1845, 1855, 1864, 1874, 1881, 1888, + 1895, 1903, 1910, 1920, 1927, 1937, 1947, 1954, 1964, 1973, + 1983, 1993, 2002, 2012, 2021, 2031, 2042, 2049, 2056, 2067, + 2077, 2087, 2097, 2106, 2116, 2123, 2133, 2142, 2152, 2159, + 2169, 2178, 2188, 2197, 2203, 2212, 2221, 2230, 2239, 2249, + 2259, 2266, 2276, 2283, 2293, 2302, 2312, 2321, 2330, 2339, + 2349, 2356, 2366, 2375, 2385, 2395, 2401, 2408, 2418, 2428, + 2438, 2449, 2459, 2470, 2480, 2491, 2501, 2511, 2520, 2529, + 2538, 2547, 2557, 2567, 2577, 2586, 2595, 2604, 2613, 2623, + 2633, 2643, 2652, 2661, 2670, 2680, 2689, 2698, 2705, 2714, + 2723, 2732, 2742, 2751, 2760, 2770, 2779, 2788, 2797, 2807, + 2816, 2825, 2834, 2843, 2852, 2862, 2871, 2880, 2890, 2899, + 2909, 2918, 2928, 2937, 2947, 2956, 2966, 2975, 2985, 2994, + 3004, 3013, 3023, 3033, 3043, 3052, 3062, 3071, 3080, 3089, + 3098, 3107, 3116, 3125, 3134, 3143, 3152, 3161, 3171, 3181, + 3191, 3200 }; #endif @@ -2282,214 +2285,214 @@ yyreduce: switch (yyn) { case 2: -#line 180 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 183 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 189 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 192 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2304 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2307 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 197 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 200 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2315 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2318 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 205 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 208 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2326 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 213 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 216 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2337 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2340 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 221 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 224 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2348 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2351 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 229 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 232 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 238 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 241 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 246 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 249 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2384 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 255 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 258 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2395 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 263 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 266 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2403 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2406 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 272 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 275 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2411 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2414 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 277 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 280 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2419 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2422 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 282 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 285 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 287 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 290 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2435 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 292 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 295 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2443 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2446 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 297 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 300 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2451 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2454 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 302 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 305 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2459 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 307 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 310 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); } -#line 2467 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2470 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 313 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 316 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2478 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2481 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 321 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 324 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2489 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 330 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 333 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpStoreClass((yyvsp[0].str)); @@ -2497,44 +2500,44 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 340 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 343 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 25: -#line 349 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 352 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2523 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2526 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 26: -#line 358 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 361 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2537 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 27: -#line 366 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 369 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpStoreClass((yyvsp[-1].str)); @@ -2542,56 +2545,56 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2549 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 28: -#line 376 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 379 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 29: -#line 382 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 385 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2564 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2567 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 30: -#line 389 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 392 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2573 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2576 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 31: -#line 396 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 399 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = (yyvsp[0].str); } -#line 2582 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2585 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 32: -#line 402 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 405 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); (yyval.str) = (yyvsp[0].str); } -#line 2591 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2594 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 33: -#line 409 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 412 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->AddClassFound((yyvsp[-2].str)); @@ -2599,11 +2602,11 @@ yyreduce: yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); (yyval.str) = const_cast<char*>(yyGetParser->GetCurrentCombine()); } -#line 2603 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2606 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 34: -#line 418 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 421 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -2612,11 +2615,11 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2619 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 35: -#line 428 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 431 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -2625,118 +2628,118 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 36: -#line 438 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 441 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2640 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2643 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 37: -#line 447 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 450 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2651 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2654 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 38: -#line 455 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 458 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 39: -#line 464 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 467 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2673 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2676 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 40: -#line 472 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 475 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 41: -#line 479 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 482 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2694 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2697 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 42: -#line 487 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 490 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2704 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 43: -#line 494 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 497 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2715 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 44: -#line 502 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 505 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2728 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 45: -#line 509 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 512 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2736 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2739 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 46: -#line 518 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 521 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->SetCurrentPackage((yyvsp[-1].str)); @@ -2746,33 +2749,33 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2753 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 47: -#line 530 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 533 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2764 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 48: -#line 538 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 541 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2772 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2775 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 49: -#line 547 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 550 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->AddPackagesImport((yyvsp[-1].str)); @@ -2782,11 +2785,11 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2786 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2789 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 50: -#line 559 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 562 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); std::string str = (yyvsp[-3].str); @@ -2797,77 +2800,77 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2801 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2804 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 51: -#line 572 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 575 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 52: -#line 580 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 583 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2823 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2826 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 53: -#line 588 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 591 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2834 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2837 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 54: -#line 597 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 600 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 55: -#line 605 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 608 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2856 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2859 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 67: -#line 620 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 623 "cmDependsJavaParser.y" /* yacc.c:1646 */ { yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } -#line 2867 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2870 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 68: -#line 630 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 633 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -2875,11 +2878,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 2879 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2882 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 69: -#line 639 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 642 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(2); @@ -2887,11 +2890,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 2891 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2894 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 70: -#line 648 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 651 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -2899,11 +2902,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 2903 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2906 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 71: -#line 657 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 660 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -2911,226 +2914,226 @@ yyreduce: yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 2915 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2918 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 72: -#line 666 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 669 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2925 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2928 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 73: -#line 673 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 676 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2936 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2939 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 74: -#line 682 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 685 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 75: -#line 691 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 694 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2958 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2961 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 76: -#line 700 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 703 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2969 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2972 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 77: -#line 708 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 711 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 78: -#line 717 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 720 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 2991 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 2994 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 79: -#line 725 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 728 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3001 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 80: -#line 732 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 735 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3012 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3015 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 81: -#line 741 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 744 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 82: -#line 749 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 752 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3034 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3037 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 83: -#line 757 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 760 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3045 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3048 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 84: -#line 765 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 768 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3056 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 85: -#line 774 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 777 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3070 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 86: -#line 782 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 785 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3078 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3081 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 87: -#line 791 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 794 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); } -#line 3086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3089 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 88: -#line 797 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 800 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 89: -#line 805 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 808 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3108 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3111 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 90: -#line 814 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 817 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 91: -#line 822 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 825 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3130 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 92: -#line 831 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 834 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -3138,77 +3141,77 @@ yyreduce: (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 93: -#line 840 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 843 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3153 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3156 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 94: -#line 849 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 852 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 95: -#line 857 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 860 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3178 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 96: -#line 866 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 869 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3186 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3189 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 97: -#line 874 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 877 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 98: -#line 882 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 885 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3208 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3211 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 99: -#line 891 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 894 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -3216,11 +3219,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3220 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3223 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 100: -#line 900 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 903 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -3228,22 +3231,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3232 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3235 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 101: -#line 909 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 912 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 102: -#line 917 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 920 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3251,11 +3254,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3255 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3258 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 103: -#line 927 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 930 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -3264,40 +3267,40 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3268 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3271 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 104: -#line 937 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 940 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); } -#line 3277 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3280 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 105: -#line 943 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 946 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3288 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3291 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 107: -#line 954 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 957 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } -#line 3297 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3300 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 108: -#line 960 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 963 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3305,11 +3308,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3309 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3312 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 109: -#line 970 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 973 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3317,11 +3320,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3321 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3324 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 110: -#line 980 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 983 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3329,20 +3332,20 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3333 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3336 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 111: -#line 990 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 993 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } -#line 3342 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3345 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 112: -#line 996 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 999 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3350,11 +3353,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3354 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3357 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 113: -#line 1006 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1009 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3362,11 +3365,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3366 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3369 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 114: -#line 1016 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1019 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3374,11 +3377,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3378 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3381 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 115: -#line 1026 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1029 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -3386,11 +3389,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3390 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 116: -#line 1035 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1038 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -3398,11 +3401,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3402 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 117: -#line 1045 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1048 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -3411,11 +3414,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3415 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3418 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 118: -#line 1056 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1059 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -3423,22 +3426,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3427 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3430 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 119: -#line 1065 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1068 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3438 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 120: -#line 1073 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1076 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3446,11 +3449,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3450 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 121: -#line 1083 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1086 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -3458,11 +3461,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3462 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 122: -#line 1092 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1095 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -3470,22 +3473,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 123: -#line 1102 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1105 "cmDependsJavaParser.y" /* yacc.c:1646 */ { yyGetParser->StartClass((yyvsp[0].str)); jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); jpCheckEmpty(3); } -#line 3485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 124: -#line 1111 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1114 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3493,21 +3496,21 @@ yyreduce: yyGetParser->SetCurrentCombine(""); yyGetParser->EndClass(); } -#line 3497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 125: -#line 1120 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1123 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3507 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3510 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 126: -#line 1127 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1130 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3515,11 +3518,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3519 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3522 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 127: -#line 1137 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1140 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3527,11 +3530,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3531 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3534 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 128: -#line 1146 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1149 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3539,11 +3542,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3543 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3546 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 129: -#line 1156 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1159 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3551,33 +3554,33 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3555 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 130: -#line 1165 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1168 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 131: -#line 1173 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1176 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3577 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3580 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 132: -#line 1182 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1185 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3585,11 +3588,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3589 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3592 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 133: -#line 1191 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1194 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3597,11 +3600,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3601 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3604 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 134: -#line 1200 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1203 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3609,22 +3612,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3613 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3616 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 135: -#line 1209 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1212 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3624 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3627 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 136: -#line 1217 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1220 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3632,22 +3635,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3636 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3639 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 137: -#line 1226 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1229 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3647 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 138: -#line 1235 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1238 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3655,11 +3658,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3659 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 139: -#line 1245 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1248 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3667,11 +3670,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3671 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 140: -#line 1255 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1258 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3679,11 +3682,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3683 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 141: -#line 1264 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1267 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3691,11 +3694,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3695 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 142: -#line 1274 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1277 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3703,22 +3706,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3707 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 143: -#line 1283 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1286 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3718 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3721 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 144: -#line 1291 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1294 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3726,11 +3729,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3730 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3733 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 145: -#line 1300 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1303 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -3738,11 +3741,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3742 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3745 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 146: -#line 1310 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1313 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3750,11 +3753,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3754 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3757 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 147: -#line 1319 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1322 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -3762,33 +3765,33 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3766 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3769 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 148: -#line 1329 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1332 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3777 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3780 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 149: -#line 1337 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1340 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 3788 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3791 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 150: -#line 1345 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1348 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3796,11 +3799,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3800 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3803 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 151: -#line 1355 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1358 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3808,11 +3811,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3812 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3815 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 152: -#line 1364 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1367 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); @@ -3820,11 +3823,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3824 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 153: -#line 1374 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1377 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3832,11 +3835,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3836 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 154: -#line 1383 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1386 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3844,11 +3847,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3848 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 155: -#line 1392 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1395 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3856,11 +3859,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3860 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 156: -#line 1402 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1405 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); @@ -3868,11 +3871,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3872 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 157: -#line 1412 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1415 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(3); @@ -3880,11 +3883,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 158: -#line 1421 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1424 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(2); @@ -3892,11 +3895,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 159: -#line 1431 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1434 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3904,11 +3907,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 160: -#line 1440 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1443 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3916,11 +3919,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 161: -#line 1449 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1452 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3928,11 +3931,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 162: -#line 1458 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1461 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3940,11 +3943,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 163: -#line 1467 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1470 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3952,11 +3955,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 164: -#line 1476 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1479 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3964,11 +3967,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3968 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3971 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 165: -#line 1486 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1489 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3976,11 +3979,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3980 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3983 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 166: -#line 1495 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1498 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -3988,11 +3991,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 3992 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 3995 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 167: -#line 1504 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1507 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4000,11 +4003,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4004 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4007 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 168: -#line 1513 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1516 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4012,11 +4015,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4016 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4019 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 169: -#line 1522 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1525 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4024,11 +4027,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4028 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4031 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 170: -#line 1532 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1535 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4036,11 +4039,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4040 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4043 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 171: -#line 1541 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1544 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4048,11 +4051,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4052 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4055 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 172: -#line 1550 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1553 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4060,11 +4063,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4064 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4067 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 173: -#line 1559 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1562 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4072,11 +4075,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4076 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4079 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 174: -#line 1568 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1571 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4084,11 +4087,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4091 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 175: -#line 1577 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1580 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4096,11 +4099,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4103 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 176: -#line 1586 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1589 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4108,11 +4111,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4115 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 177: -#line 1595 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1598 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4120,11 +4123,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4127 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 178: -#line 1604 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1607 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4132,11 +4135,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4139 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 179: -#line 1613 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1616 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4144,11 +4147,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4148 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 180: -#line 1622 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1625 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4156,11 +4159,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4160 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4163 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 181: -#line 1631 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1634 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4168,11 +4171,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4172 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4175 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 182: -#line 1641 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1644 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4180,11 +4183,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 183: -#line 1651 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1654 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-2].str))); @@ -4193,11 +4196,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4197 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4200 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 184: -#line 1662 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1665 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4205,11 +4208,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4209 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4212 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 185: -#line 1672 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1675 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4217,11 +4220,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4221 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4224 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 186: -#line 1682 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1685 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4229,11 +4232,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4236 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 187: -#line 1691 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1694 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4241,11 +4244,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4245 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4248 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 188: -#line 1700 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1703 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4253,11 +4256,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4257 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4260 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 189: -#line 1709 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1712 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4265,11 +4268,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 190: -#line 1718 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1721 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4277,11 +4280,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 191: -#line 1727 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1730 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4289,11 +4292,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 192: -#line 1736 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1739 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4301,11 +4304,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 193: -#line 1746 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1749 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -4313,11 +4316,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 194: -#line 1756 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1759 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); jpCheckEmpty(7); @@ -4325,11 +4328,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 195: -#line 1766 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1769 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); jpCheckEmpty(7); @@ -4337,40 +4340,40 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 196: -#line 1776 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1779 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } -#line 4350 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 197: -#line 1783 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1786 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); } -#line 4359 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4362 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 198: -#line 1789 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1792 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4370 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4373 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 199: -#line 1797 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1800 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4378,22 +4381,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4382 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4385 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 200: -#line 1806 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1809 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4393 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4396 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 201: -#line 1814 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1817 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4401,11 +4404,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4405 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4408 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 202: -#line 1824 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1827 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4413,11 +4416,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4417 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4420 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 203: -#line 1834 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1837 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4425,11 +4428,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4429 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4432 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 204: -#line 1843 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1846 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4437,11 +4440,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4441 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4444 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 205: -#line 1853 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1856 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4449,11 +4452,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4453 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4456 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 206: -#line 1862 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1865 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4461,58 +4464,58 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4465 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4468 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 207: -#line 1872 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1875 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } -#line 4474 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4477 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 208: -#line 1879 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1882 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } -#line 4483 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4486 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 209: -#line 1886 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1889 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(7); } -#line 4492 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4495 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 210: -#line 1894 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1897 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(9); } -#line 4501 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4504 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 211: -#line 1900 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1903 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4515 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 212: -#line 1908 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1911 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4520,22 +4523,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4527 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 213: -#line 1917 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1920 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4535 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4538 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 214: -#line 1925 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1928 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4543,33 +4546,33 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4547 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4550 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 215: -#line 1936 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1939 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(9); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4558 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4561 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 216: -#line 1944 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1947 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4572 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 217: -#line 1952 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1955 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4577,11 +4580,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4584 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 218: -#line 1962 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1965 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4589,11 +4592,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4596 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 219: -#line 1971 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1974 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4601,11 +4604,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4608 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 220: -#line 1981 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1984 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4613,11 +4616,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4620 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 221: -#line 1991 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 1994 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4625,11 +4628,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4632 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 222: -#line 2000 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2003 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4637,11 +4640,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4644 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 223: -#line 2010 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2013 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4649,11 +4652,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4656 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 224: -#line 2019 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2022 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -4661,11 +4664,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4668 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 225: -#line 2029 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2032 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); @@ -4674,31 +4677,31 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4678 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4681 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 226: -#line 2039 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2042 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4692 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 227: -#line 2047 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2050 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } -#line 4698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 228: -#line 2054 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2057 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[-1].str))); @@ -4707,11 +4710,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4711 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4714 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 229: -#line 2065 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2068 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4719,11 +4722,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4723 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4726 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 230: -#line 2075 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2078 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4731,11 +4734,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4735 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4738 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 231: -#line 2085 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2088 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -4743,11 +4746,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4747 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4750 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 232: -#line 2095 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2098 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4755,11 +4758,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4759 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4762 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 233: -#line 2104 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2107 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -4767,22 +4770,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4771 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4774 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 234: -#line 2113 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2116 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 235: -#line 2121 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2124 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4790,11 +4793,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 236: -#line 2131 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2134 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4802,11 +4805,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 237: -#line 2140 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2143 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4814,20 +4817,20 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 238: -#line 2150 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2153 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } -#line 4827 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 239: -#line 2157 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2160 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -4835,11 +4838,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4839 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 240: -#line 2167 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2170 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4847,11 +4850,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4851 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 241: -#line 2176 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2179 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4859,11 +4862,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4863 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 242: -#line 2186 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2189 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4871,20 +4874,20 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4875 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 243: -#line 2195 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2198 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); } -#line 4884 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4887 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 244: -#line 2201 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2204 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -4892,11 +4895,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4896 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4899 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 245: -#line 2210 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2213 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4904,11 +4907,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4908 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4911 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 246: -#line 2219 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2222 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4916,11 +4919,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4920 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4923 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 247: -#line 2228 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2231 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4928,11 +4931,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4932 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4935 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 248: -#line 2237 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2240 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4940,11 +4943,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4944 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4947 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 249: -#line 2247 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2250 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); jpCheckEmpty(6); @@ -4952,22 +4955,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4956 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4959 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 250: -#line 2256 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2259 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4967 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4970 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 251: -#line 2264 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2267 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4975,22 +4978,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 4979 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4982 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 252: -#line 2273 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2276 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 4990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 4993 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 253: -#line 2281 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2284 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -4998,11 +5001,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5005 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 254: -#line 2291 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2294 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5010,11 +5013,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5017 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 255: -#line 2300 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2303 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5022,11 +5025,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5029 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 256: -#line 2310 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2313 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5034,11 +5037,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5041 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 257: -#line 2319 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2322 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5046,11 +5049,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5053 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 258: -#line 2328 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2331 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5058,11 +5061,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5065 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 259: -#line 2337 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2340 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5070,22 +5073,22 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5077 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 260: -#line 2346 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2349 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(0); (yyval.str) = 0; yyGetParser->SetCurrentCombine(""); } -#line 5085 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5088 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 261: -#line 2354 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2357 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5093,11 +5096,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5097 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5100 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 262: -#line 2364 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2367 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5105,11 +5108,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5109 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5112 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 263: -#line 2373 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2376 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5117,11 +5120,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5121 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5124 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 264: -#line 2383 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2386 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5129,29 +5132,29 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5133 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5136 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 265: -#line 2393 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2396 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); } -#line 5142 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5145 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 266: -#line 2399 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2402 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); } -#line 5151 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5154 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 267: -#line 2406 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2409 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5160,11 +5163,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5164 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 268: -#line 2416 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2419 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5173,11 +5176,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5177 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 269: -#line 2426 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2429 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5186,11 +5189,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5190 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5193 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 270: -#line 2436 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2439 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5199,11 +5202,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5203 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5206 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 271: -#line 2447 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2450 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5212,11 +5215,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5216 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5219 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 272: -#line 2457 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2460 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-5].str))); @@ -5226,11 +5229,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5230 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5233 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 273: -#line 2468 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2471 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5239,11 +5242,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5243 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5246 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 274: -#line 2478 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2481 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(6); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5252,11 +5255,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5256 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5259 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 275: -#line 2489 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2492 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); yyGetParser->DeallocateParserType(&((yyvsp[-3].str))); @@ -5265,11 +5268,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5269 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5272 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 276: -#line 2499 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2502 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5277,11 +5280,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5281 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5284 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 277: -#line 2509 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2512 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5289,11 +5292,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5293 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5296 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 278: -#line 2518 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2521 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5301,11 +5304,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5305 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5308 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 279: -#line 2527 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2530 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5313,11 +5316,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5317 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5320 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 280: -#line 2536 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2539 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5325,11 +5328,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5329 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5332 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 281: -#line 2545 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2548 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5337,11 +5340,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5341 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5344 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 282: -#line 2555 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2558 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5349,11 +5352,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5353 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5356 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 283: -#line 2565 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2568 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5361,11 +5364,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5365 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5368 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 284: -#line 2575 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2578 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5373,11 +5376,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5377 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5380 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 285: -#line 2584 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2587 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5385,11 +5388,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5389 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5392 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 286: -#line 2593 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2596 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5397,11 +5400,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5401 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5404 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 287: -#line 2602 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2605 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5409,11 +5412,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5413 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5416 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 288: -#line 2611 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2614 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5421,11 +5424,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5425 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5428 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 289: -#line 2621 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2624 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5433,11 +5436,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5437 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5440 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 290: -#line 2631 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2634 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5445,11 +5448,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5449 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5452 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 291: -#line 2641 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2644 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5457,11 +5460,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5461 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5464 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 292: -#line 2650 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2653 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5469,11 +5472,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5473 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5476 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 293: -#line 2659 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2662 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(2); jpCheckEmpty(2); @@ -5481,11 +5484,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5485 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5488 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 294: -#line 2668 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2671 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5493,11 +5496,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5497 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5500 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 295: -#line 2678 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2681 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -5505,11 +5508,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5509 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5512 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 296: -#line 2687 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2690 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(4); jpCheckEmpty(4); @@ -5517,20 +5520,20 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5521 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5524 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 297: -#line 2696 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2699 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); } -#line 5530 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5533 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 298: -#line 2703 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2706 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5538,11 +5541,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5542 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5545 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 299: -#line 2712 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2715 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5550,11 +5553,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5554 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5557 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 300: -#line 2721 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2724 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5562,11 +5565,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5566 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5569 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 301: -#line 2730 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2733 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5574,11 +5577,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5578 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5581 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 302: -#line 2740 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2743 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5586,11 +5589,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5590 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5593 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 303: -#line 2749 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2752 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5598,11 +5601,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5602 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5605 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 304: -#line 2758 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2761 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5610,11 +5613,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5614 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5617 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 305: -#line 2768 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2771 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5622,11 +5625,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5626 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5629 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 306: -#line 2777 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2780 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5634,11 +5637,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5638 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5641 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 307: -#line 2786 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2789 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5646,11 +5649,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5650 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5653 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 308: -#line 2795 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2798 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5658,11 +5661,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5662 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5665 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 309: -#line 2805 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2808 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5670,11 +5673,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5674 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5677 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 310: -#line 2814 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2817 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5682,11 +5685,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5686 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5689 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 311: -#line 2823 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2826 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5694,11 +5697,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5698 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5701 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 312: -#line 2832 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2835 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5706,11 +5709,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5710 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5713 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 313: -#line 2841 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2844 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5718,11 +5721,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5722 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5725 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 314: -#line 2850 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2853 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5730,11 +5733,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5734 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5737 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 315: -#line 2860 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2863 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5742,11 +5745,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5746 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5749 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 316: -#line 2869 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2872 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5754,11 +5757,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5758 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5761 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 317: -#line 2878 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2881 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5766,11 +5769,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5770 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5773 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 318: -#line 2888 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2891 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5778,11 +5781,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5782 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5785 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 319: -#line 2897 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2900 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5790,11 +5793,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5794 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5797 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 320: -#line 2907 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2910 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5802,11 +5805,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5806 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5809 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 321: -#line 2916 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2919 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5814,11 +5817,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5818 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5821 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 322: -#line 2926 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2929 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5826,11 +5829,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5830 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5833 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 323: -#line 2935 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2938 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5838,11 +5841,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5842 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5845 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 324: -#line 2945 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2948 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5850,11 +5853,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5854 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5857 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 325: -#line 2954 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2957 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5862,11 +5865,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5866 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5869 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 326: -#line 2964 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2967 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5874,11 +5877,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5878 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5881 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 327: -#line 2973 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2976 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5886,11 +5889,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5890 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5893 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 328: -#line 2983 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2986 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5898,11 +5901,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5902 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5905 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 329: -#line 2992 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 2995 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(5); jpCheckEmpty(5); @@ -5910,11 +5913,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5914 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5917 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 330: -#line 3002 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3005 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5922,11 +5925,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5926 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5929 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 331: -#line 3011 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3014 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5934,11 +5937,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5938 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5941 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 332: -#line 3021 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3024 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpCheckEmpty(3); @@ -5946,11 +5949,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5950 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5953 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 333: -#line 3031 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3034 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); yyGetParser->DeallocateParserType(&((yyvsp[0].str))); @@ -5959,11 +5962,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5963 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5966 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 334: -#line 3041 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3044 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5971,11 +5974,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5975 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5978 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 335: -#line 3050 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3053 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5983,11 +5986,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5987 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 5990 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 336: -#line 3060 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3063 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -5995,11 +5998,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 5999 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6002 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 337: -#line 3069 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3072 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6007,11 +6010,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6011 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6014 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 338: -#line 3078 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3081 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6019,11 +6022,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6023 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6026 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 339: -#line 3087 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3090 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6031,11 +6034,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6035 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6038 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 340: -#line 3096 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3099 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6043,11 +6046,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6047 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6050 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 341: -#line 3105 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3108 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6055,11 +6058,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6059 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6062 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 342: -#line 3114 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3117 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6067,11 +6070,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6071 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6074 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 343: -#line 3123 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3126 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6079,11 +6082,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6083 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6086 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 344: -#line 3132 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3135 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6091,11 +6094,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6095 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6098 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 345: -#line 3141 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3144 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6103,11 +6106,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6107 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6110 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 346: -#line 3150 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3153 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6115,11 +6118,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6119 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6122 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 347: -#line 3159 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3162 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6127,11 +6130,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6131 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6134 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 348: -#line 3169 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3172 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6139,11 +6142,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6143 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6146 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 349: -#line 3179 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3182 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6151,11 +6154,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6155 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6158 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 350: -#line 3189 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3192 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(1); jpCheckEmpty(1); @@ -6163,11 +6166,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6167 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6170 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; case 351: -#line 3198 "cmDependsJavaParser.y" /* yacc.c:1646 */ +#line 3201 "cmDependsJavaParser.y" /* yacc.c:1646 */ { jpElementStart(3); jpStoreClass((yyvsp[-2].str)); @@ -6176,11 +6179,11 @@ yyreduce: yyGetParser->SetCurrentCombine(""); } -#line 6180 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6183 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ break; -#line 6184 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ +#line 6187 "cmDependsJavaParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -6410,7 +6413,7 @@ yyreturn: #endif return yyresult; } -#line 3207 "cmDependsJavaParser.y" /* yacc.c:1906 */ +#line 3210 "cmDependsJavaParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y index f7eb228..a4e9c5d 100644 --- a/Source/LexerParser/cmDependsJavaParser.y +++ b/Source/LexerParser/cmDependsJavaParser.y @@ -44,6 +44,9 @@ static void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif %} /* Generate a reentrant parser object. */ diff --git a/Source/LexerParser/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index 81a1ec5..cb24687 100644 --- a/Source/LexerParser/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx @@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 15 -#define YY_END_OF_BUFFER 16 +#define YY_NUM_RULES 18 +#define YY_END_OF_BUFFER 19 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -557,29 +557,29 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[23] = +static const flex_int16_t yy_accept[29] = { 0, - 0, 0, 16, 15, 6, 8, 13, 14, 4, 2, - 3, 5, 1, 15, 15, 9, 7, 10, 1, 11, - 12, 0 + 0, 0, 19, 17, 1, 18, 8, 10, 15, 16, + 6, 4, 5, 7, 2, 2, 17, 17, 11, 9, + 12, 2, 0, 13, 14, 3, 3, 0 } ; static const YY_CHAR yy_ec[256] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 4, 5, 1, 6, + 7, 8, 9, 1, 10, 1, 11, 12, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 1, 1, 14, + 1, 15, 1, 1, 16, 16, 16, 16, 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 2, 3, 1, 4, - 5, 6, 7, 1, 8, 1, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 1, 11, - 1, 12, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 13, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 17, 1, 1, + 1, 1, 1, 18, 1, 1, 16, 16, 16, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 14, 1, 15, 1, 1, 1, 1, + 16, 16, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, + 1, 1, 1, 19, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -596,40 +596,46 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[16] = +static const YY_CHAR yy_meta[21] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 + 1, 2, 2, 1, 1, 3, 4, 1, 1, 1 } ; -static const flex_int16_t yy_base[23] = +static const flex_int16_t yy_base[32] = { 0, - 0, 0, 20, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 9, 7, 5, 21, 21, 21, 6, 21, - 21, 21 + 0, 0, 34, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 16, 9, 18, 11, 35, 35, + 35, 11, 0, 35, 35, 0, 0, 35, 23, 26, + 28 } ; -static const flex_int16_t yy_def[23] = +static const flex_int16_t yy_def[32] = { 0, - 22, 1, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 0 + 28, 1, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 29, 28, 28, 28, 28, 28, + 28, 28, 30, 28, 28, 31, 31, 0, 28, 28, + 28 } ; -static const flex_int16_t yy_nxt[37] = +static const flex_int16_t yy_nxt[56] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 21, 20, 19, 22, - 3, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 14, 15, 16, 17, 18, 4, 4, 19, 20, 21, + 22, 22, 22, 22, 22, 25, 22, 26, 26, 27, + 27, 24, 23, 28, 3, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; -static const flex_int16_t yy_chk[37] = +static const flex_int16_t yy_chk[56] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 19, 15, 14, 13, 3, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 22, 22, 22, 22, 22, 22 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 16, 16, 22, 22, 29, 18, 29, 30, 30, 31, + 31, 17, 15, 3, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28 } ; /* The intent behind this definition is that it'll catch @@ -668,6 +674,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include <string> + /*--------------------------------------------------------------------------*/ #define INITIAL 0 @@ -946,13 +954,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 21 ); + while ( yy_base[yy_current_state] != 35 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -978,62 +986,74 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -{ yylvalp->Number = atoi(yytext); return exp_NUMBER; } +{} YY_BREAK case 2: YY_RULE_SETUP -{ return exp_PLUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } YY_BREAK case 3: YY_RULE_SETUP -{ return exp_MINUS; } +{ yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } YY_BREAK case 4: YY_RULE_SETUP -{ return exp_TIMES; } +{ return exp_PLUS; } YY_BREAK case 5: YY_RULE_SETUP -{ return exp_DIVIDE; } +{ return exp_MINUS; } YY_BREAK case 6: YY_RULE_SETUP -{ return exp_MOD; } +{ return exp_TIMES; } YY_BREAK case 7: YY_RULE_SETUP -{ return exp_OR; } +{ return exp_DIVIDE; } YY_BREAK case 8: YY_RULE_SETUP -{ return exp_AND; } +{ return exp_MOD; } YY_BREAK case 9: YY_RULE_SETUP -{ return exp_XOR; } +{ return exp_OR; } YY_BREAK case 10: YY_RULE_SETUP -{ return exp_NOT; } +{ return exp_AND; } YY_BREAK case 11: YY_RULE_SETUP -{ return exp_SHIFTLEFT; } +{ return exp_XOR; } YY_BREAK case 12: YY_RULE_SETUP -{ return exp_SHIFTRIGHT; } +{ return exp_NOT; } YY_BREAK case 13: YY_RULE_SETUP -{ return exp_OPENPARENT; } +{ return exp_SHIFTLEFT; } YY_BREAK case 14: YY_RULE_SETUP -{ return exp_CLOSEPARENT; } +{ return exp_SHIFTRIGHT; } YY_BREAK case 15: YY_RULE_SETUP +{ return exp_OPENPARENT; } + YY_BREAK +case 16: +YY_RULE_SETUP +{ return exp_CLOSEPARENT; } + YY_BREAK +case 17: +YY_RULE_SETUP +{ yyextra->UnexpectedChar(yytext[0]); } + YY_BREAK +case 18: +YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): @@ -1334,7 +1354,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1363,11 +1383,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 23 ) + if ( yy_current_state >= 29 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 22); + yy_is_jam = (yy_current_state == 28); (void)yyg; return yy_is_jam ? 0 : yy_current_state; diff --git a/Source/LexerParser/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index e5f177a..2197c2a 100644 --- a/Source/LexerParser/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l @@ -28,6 +28,8 @@ Modify cmExprLexer.cxx: /* Include the set of tokens from the parser. */ #include "cmExprParserTokens.h" +#include <string> + /*--------------------------------------------------------------------------*/ %} @@ -38,8 +40,10 @@ Modify cmExprLexer.cxx: %pointer %% +[ \t] {} -[0-9][0-9]* { yylvalp->Number = atoi(yytext); return exp_NUMBER; } +[0-9][0-9]* { yylvalp->Number = std::stoll(yytext, nullptr, 10); return exp_NUMBER; } +0[xX][0-9a-fA-F][0-9a-fA-F]* { yylvalp->Number = std::stoll(yytext, nullptr, 16); return exp_NUMBER; } "+" { return exp_PLUS; } "-" { return exp_MINUS; } @@ -54,5 +58,6 @@ Modify cmExprLexer.cxx: ">>" { return exp_SHIFTRIGHT; } "(" { return exp_OPENPARENT; } ")" { return exp_CLOSEPARENT; } +. { yyextra->UnexpectedChar(yytext[0]); } %% diff --git a/Source/LexerParser/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index 67664a5..73ece2b 100644 --- a/Source/LexerParser/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -89,6 +89,7 @@ Modify cmExprParser.cxx: #include <stdlib.h> #include <string.h> +#include <stdexcept> /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -107,8 +108,11 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif -#line 112 "cmExprParser.cxx" /* yacc.c:339 */ +#line 116 "cmExprParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -185,7 +189,7 @@ int cmExpr_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 189 "cmExprParser.cxx" /* yacc.c:358 */ +#line 193 "cmExprParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -484,9 +488,9 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 73, 73, 78, 81, 86, 89, 94, 97, 102, - 105, 108, 113, 116, 119, 124, 127, 130, 133, 138, - 141, 144, 149, 152 + 0, 77, 77, 82, 85, 90, 93, 98, 101, 106, + 109, 112, 117, 120, 123, 128, 131, 134, 140, 145, + 148, 151, 156, 159 }; #endif @@ -1281,183 +1285,186 @@ yyreduce: switch (yyn) { case 2: -#line 73 "cmExprParser.y" /* yacc.c:1646 */ +#line 77 "cmExprParser.y" /* yacc.c:1646 */ { cmExpr_yyget_extra(yyscanner)->SetResult((yyvsp[0].Number)); } -#line 1289 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1293 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 3: -#line 78 "cmExprParser.y" /* yacc.c:1646 */ +#line 82 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1297 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1301 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 4: -#line 81 "cmExprParser.y" /* yacc.c:1646 */ +#line 85 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) | (yyvsp[0].Number); } -#line 1305 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1309 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 86 "cmExprParser.y" /* yacc.c:1646 */ +#line 90 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1313 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1317 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 89 "cmExprParser.y" /* yacc.c:1646 */ +#line 93 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) ^ (yyvsp[0].Number); } -#line 1321 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1325 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 94 "cmExprParser.y" /* yacc.c:1646 */ +#line 98 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1329 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1333 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 97 "cmExprParser.y" /* yacc.c:1646 */ +#line 101 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) & (yyvsp[0].Number); } -#line 1337 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1341 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 102 "cmExprParser.y" /* yacc.c:1646 */ +#line 106 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1345 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1349 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 105 "cmExprParser.y" /* yacc.c:1646 */ +#line 109 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) << (yyvsp[0].Number); } -#line 1353 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1357 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 108 "cmExprParser.y" /* yacc.c:1646 */ +#line 112 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) >> (yyvsp[0].Number); } -#line 1361 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1365 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 113 "cmExprParser.y" /* yacc.c:1646 */ +#line 117 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1369 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1373 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 116 "cmExprParser.y" /* yacc.c:1646 */ +#line 120 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) + (yyvsp[0].Number); } -#line 1377 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1381 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 119 "cmExprParser.y" /* yacc.c:1646 */ +#line 123 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) - (yyvsp[0].Number); } -#line 1385 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1389 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 124 "cmExprParser.y" /* yacc.c:1646 */ +#line 128 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1393 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1397 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 127 "cmExprParser.y" /* yacc.c:1646 */ +#line 131 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) * (yyvsp[0].Number); } -#line 1401 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1405 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 130 "cmExprParser.y" /* yacc.c:1646 */ +#line 134 "cmExprParser.y" /* yacc.c:1646 */ { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } (yyval.Number) = (yyvsp[-2].Number) / (yyvsp[0].Number); } -#line 1409 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1416 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 133 "cmExprParser.y" /* yacc.c:1646 */ +#line 140 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-2].Number) % (yyvsp[0].Number); } -#line 1417 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1424 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 138 "cmExprParser.y" /* yacc.c:1646 */ +#line 145 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1425 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1432 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 141 "cmExprParser.y" /* yacc.c:1646 */ +#line 148 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = + (yyvsp[0].Number); } -#line 1433 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1440 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 144 "cmExprParser.y" /* yacc.c:1646 */ +#line 151 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = - (yyvsp[0].Number); } -#line 1441 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1448 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 149 "cmExprParser.y" /* yacc.c:1646 */ +#line 156 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[0].Number); } -#line 1449 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1456 "cmExprParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 152 "cmExprParser.y" /* yacc.c:1646 */ +#line 159 "cmExprParser.y" /* yacc.c:1646 */ { (yyval.Number) = (yyvsp[-1].Number); } -#line 1457 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1464 "cmExprParser.cxx" /* yacc.c:1646 */ break; -#line 1461 "cmExprParser.cxx" /* yacc.c:1646 */ +#line 1468 "cmExprParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1687,7 +1694,7 @@ yyreturn: #endif return yyresult; } -#line 157 "cmExprParser.y" /* yacc.c:1906 */ +#line 164 "cmExprParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmExprParser.y b/Source/LexerParser/cmExprParser.y index d1c3a97..2137473 100644 --- a/Source/LexerParser/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -18,6 +18,7 @@ Modify cmExprParser.cxx: #include <stdlib.h> #include <string.h> +#include <stdexcept> /*-------------------------------------------------------------------------*/ #define YYDEBUG 1 @@ -36,6 +37,9 @@ static void cmExpr_yyerror(yyscan_t yyscanner, const char* message); # pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4065) /* Switch statement contains default but no case. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif %} /* Generate a reentrant parser object. */ @@ -128,6 +132,9 @@ term: $<Number>$ = $<Number>1 * $<Number>3; } | term exp_DIVIDE unary { + if (yyvsp[0].Number == 0) { + throw std::overflow_error("divide by zero"); + } $<Number>$ = $<Number>1 / $<Number>3; } | term exp_MOD unary { diff --git a/Source/LexerParser/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx index 00c8a8a..015cab9 100644 --- a/Source/LexerParser/cmFortranParser.cxx +++ b/Source/LexerParser/cmFortranParser.cxx @@ -127,8 +127,11 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) # pragma warning (disable: 4127) /* Conditional expression is constant. */ # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif -#line 132 "cmFortranParser.cxx" /* yacc.c:339 */ +#line 135 "cmFortranParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -248,11 +251,11 @@ extern int cmFortran_yydebug; union YYSTYPE { -#line 70 "cmFortranParser.y" /* yacc.c:355 */ +#line 73 "cmFortranParser.y" /* yacc.c:355 */ char* string; -#line 256 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 259 "cmFortranParser.cxx" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -268,7 +271,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 272 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 275 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -569,13 +572,13 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 98, 98, 98, 101, 105, 110, 119, 125, 132, - 137, 141, 146, 154, 159, 164, 169, 174, 179, 184, - 189, 194, 198, 202, 206, 210, 211, 216, 216, 216, - 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, - 222, 222, 223, 223, 224, 224, 225, 225, 228, 229, - 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243 + 0, 101, 101, 101, 104, 108, 113, 122, 128, 135, + 140, 144, 149, 157, 162, 167, 172, 177, 182, 187, + 192, 197, 201, 205, 209, 213, 214, 219, 219, 219, + 220, 220, 221, 221, 222, 222, 223, 223, 224, 224, + 225, 225, 226, 226, 227, 227, 228, 228, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246 }; #endif @@ -1527,26 +1530,26 @@ yyreduce: switch (yyn) { case 4: -#line 101 "cmFortranParser.y" /* yacc.c:1646 */ +#line 104 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); } -#line 1536 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1539 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 5: -#line 105 "cmFortranParser.y" /* yacc.c:1646 */ +#line 108 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1546 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1549 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 6: -#line 110 "cmFortranParser.y" /* yacc.c:1646 */ +#line 113 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); if (cmsysString_strcasecmp((yyvsp[-2].string), "function") != 0 && @@ -1556,22 +1559,22 @@ yyreduce: } free((yyvsp[-2].string)); } -#line 1560 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1563 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 119 "cmFortranParser.y" /* yacc.c:1646 */ +#line 122 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleSubmodule(parser, (yyvsp[-4].string), (yyvsp[-2].string)); free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1571 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1574 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 8: -#line 125 "cmFortranParser.y" /* yacc.c:1646 */ +#line 128 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleSubmoduleNested(parser, (yyvsp[-6].string), (yyvsp[-4].string), (yyvsp[-2].string)); @@ -1579,40 +1582,40 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1583 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1586 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 9: -#line 132 "cmFortranParser.y" /* yacc.c:1646 */ +#line 135 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true); free((yyvsp[-2].string)); } -#line 1593 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1596 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 10: -#line 137 "cmFortranParser.y" /* yacc.c:1646 */ +#line 140 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, false); } -#line 1602 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1605 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 11: -#line 141 "cmFortranParser.y" /* yacc.c:1646 */ +#line 144 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1612 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1615 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 12: -#line 146 "cmFortranParser.y" /* yacc.c:1646 */ +#line 149 "cmFortranParser.y" /* yacc.c:1646 */ { if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); @@ -1621,139 +1624,139 @@ yyreduce: free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1625 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 13: -#line 154 "cmFortranParser.y" /* yacc.c:1646 */ +#line 157 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1635 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 14: -#line 159 "cmFortranParser.y" /* yacc.c:1646 */ +#line 162 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1645 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1648 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 15: -#line 164 "cmFortranParser.y" /* yacc.c:1646 */ +#line 167 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1655 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1658 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 16: -#line 169 "cmFortranParser.y" /* yacc.c:1646 */ +#line 172 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1668 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 17: -#line 174 "cmFortranParser.y" /* yacc.c:1646 */ +#line 177 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1675 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1678 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 18: -#line 179 "cmFortranParser.y" /* yacc.c:1646 */ +#line 182 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1685 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1688 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 19: -#line 184 "cmFortranParser.y" /* yacc.c:1646 */ +#line 187 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1695 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1698 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 20: -#line 189 "cmFortranParser.y" /* yacc.c:1646 */ +#line 192 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1705 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1708 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 21: -#line 194 "cmFortranParser.y" /* yacc.c:1646 */ +#line 197 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); } -#line 1714 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1717 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 22: -#line 198 "cmFortranParser.y" /* yacc.c:1646 */ +#line 201 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); } -#line 1723 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1726 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 23: -#line 202 "cmFortranParser.y" /* yacc.c:1646 */ +#line 205 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); } -#line 1732 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1735 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 24: -#line 206 "cmFortranParser.y" /* yacc.c:1646 */ +#line 209 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); } -#line 1741 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1744 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 48: -#line 228 "cmFortranParser.y" /* yacc.c:1646 */ +#line 231 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1747 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1750 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 55: -#line 235 "cmFortranParser.y" /* yacc.c:1646 */ +#line 238 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1753 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1756 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1757 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1760 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1983,6 +1986,6 @@ yyreturn: #endif return yyresult; } -#line 246 "cmFortranParser.y" /* yacc.c:1906 */ +#line 249 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/LexerParser/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y index 5e09248..87f3e0a 100644 --- a/Source/LexerParser/cmFortranParser.y +++ b/Source/LexerParser/cmFortranParser.y @@ -56,6 +56,9 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message) # pragma warning (disable: 4127) /* Conditional expression is constant. */ # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ #endif +#if defined(__GNUC__) && __GNUC__ >= 8 +# pragma GCC diagnostic ignored "-Wconversion" +#endif %} /* Generate a reentrant parser object. */ diff --git a/Source/LexerParser/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h index 8d6a5fe..29c6d60 100644 --- a/Source/LexerParser/cmFortranParserTokens.h +++ b/Source/LexerParser/cmFortranParserTokens.h @@ -130,7 +130,7 @@ extern int cmFortran_yydebug; union YYSTYPE { -#line 70 "cmFortranParser.y" /* yacc.c:1909 */ +#line 73 "cmFortranParser.y" /* yacc.c:1909 */ char* string; diff --git a/Source/cmAddLinkOptionsCommand.cxx b/Source/cmAddLinkOptionsCommand.cxx new file mode 100644 index 0000000..10ebd12 --- /dev/null +++ b/Source/cmAddLinkOptionsCommand.cxx @@ -0,0 +1,20 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmAddLinkOptionsCommand.h" + +#include "cmMakefile.h" + +class cmExecutionStatus; + +bool cmAddLinkOptionsCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus&) +{ + if (args.empty()) { + return true; + } + + for (std::string const& i : args) { + this->Makefile->AddLinkOption(i); + } + return true; +} diff --git a/Source/cmAddLinkOptionsCommand.h b/Source/cmAddLinkOptionsCommand.h new file mode 100644 index 0000000..30fff00 --- /dev/null +++ b/Source/cmAddLinkOptionsCommand.h @@ -0,0 +1,31 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmAddLinkOptionsCommand_h +#define cmAddLinkOptionsCommand_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> +#include <vector> + +#include "cmCommand.h" + +class cmExecutionStatus; + +class cmAddLinkOptionsCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + cmCommand* Clone() override { return new cmAddLinkOptionsCommand; } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) override; +}; + +#endif diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 1dd7734..6031781 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -10,6 +10,7 @@ #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" #include <iostream> +#include <sstream> #include <string.h> #include <time.h> @@ -94,13 +95,25 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, return; } break; - case CompressGZip: + case CompressGZip: { if (archive_write_add_filter_gzip(this->Archive) != ARCHIVE_OK) { this->Error = "archive_write_add_filter_gzip: "; this->Error += cm_archive_error_string(this->Archive); return; } - break; + std::string source_date_epoch; + cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); + if (!source_date_epoch.empty()) { + // We're not able to specify an arbitrary timestamp for gzip. + // The next best thing is to omit the timestamp entirely. + if (archive_write_set_filter_option(this->Archive, "gzip", "timestamp", + nullptr) != ARCHIVE_OK) { + this->Error = "archive_write_set_filter_option: "; + this->Error += cm_archive_error_string(this->Archive); + return; + } + } + } break; case CompressBZip2: if (archive_write_add_filter_bzip2(this->Archive) != ARCHIVE_OK) { this->Error = "archive_write_add_filter_bzip2: "; @@ -243,6 +256,17 @@ bool cmArchiveWrite::AddFile(const char* file, size_t skip, const char* prefix) return false; } archive_entry_set_mtime(e, t, 0); + } else { + std::string source_date_epoch; + cmSystemTools::GetEnv("SOURCE_DATE_EPOCH", source_date_epoch); + if (!source_date_epoch.empty()) { + std::istringstream iss(source_date_epoch); + time_t epochTime; + iss >> epochTime; + if (iss.eof() && !iss.fail()) { + archive_entry_set_mtime(e, epochTime, 0); + } + } } // manages the uid/guid of the entry (if any) diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 5f54338..ddff686 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -40,8 +40,8 @@ bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args, cmSystemTools::RunSingleCommand("uname -a", &buildname, &buildname); if (!buildname.empty()) { std::string RegExp = "([^ ]*) [^ ]* ([^ ]*) "; - cmsys::RegularExpression reg(RegExp.c_str()); - if (reg.find(buildname.c_str())) { + cmsys::RegularExpression reg(RegExp); + if (reg.find(buildname)) { buildname = reg.match(1) + "-" + reg.match(2); } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d0e668d..3d3d526 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -9,7 +9,6 @@ #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/Process.h" -#include "cmsys/String.hxx" #include "cmsys/SystemInformation.hxx" #include <algorithm> #include <chrono> @@ -819,7 +818,7 @@ bool cmCTest::OpenOutputFile(const std::string& path, const std::string& name, } } std::string filename = testingDir + "/" + name; - stream.Open(filename.c_str()); + stream.Open(filename); if (!stream) { cmCTestLog(this, ERROR_MESSAGE, "Problem opening file: " << filename << std::endl); @@ -1491,7 +1490,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, this->AddSiteProperties(xml); xml.StartElement("Notes"); - for (cmsys::String const& file : files) { + for (std::string const& file : files) { cmCTestLog(this, OUTPUT, "\tAdd file: " << file << std::endl); std::string note_time = this->CurrentTime(); xml.StartElement("Note"); @@ -1595,7 +1594,7 @@ std::string cmCTest::Base64EncodeFile(std::string const& file) bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files) { - for (cmsys::String const& file : files) { + for (std::string const& file : files) { if (!cmSystemTools::FileExists(file)) { cmCTestLog(this, ERROR_MESSAGE, "Cannot find extra file: " << file << " to submit." diff --git a/Source/cmCTest.h b/Source/cmCTest.h index ddeab1a..c6ece98 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -7,7 +7,7 @@ #include "cmDuration.h" #include "cmProcessOutput.h" -#include "cmsys/String.hxx" + #include <chrono> #include <map> #include <set> @@ -93,7 +93,7 @@ public: if the string does not name a valid part. */ Part GetPartFromName(const char* name); - typedef std::vector<cmsys::String> VectorOfStrings; + typedef std::vector<std::string> VectorOfStrings; typedef std::set<std::string> SetOfStrings; /** Process Command line arguments */ diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index c6a1cff..5091c97 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -234,7 +234,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger) { std::string cacheFile = path; cacheFile += "/CMakeCache.txt"; - cmGeneratedFileStream fout(cacheFile.c_str()); + cmGeneratedFileStream fout(cacheFile); fout.SetCopyIfDifferent(true); if (!fout) { cmSystemTools::Error("Unable to open cache file for save. ", diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index ccb4f88..c7210b4 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -172,7 +172,7 @@ void cmCommandArgumentParserHelper::AllocateParserType( return; } char* out = new char[len + 1]; - strncpy(out, str, len); + memcpy(out, str, len); out[len] = 0; pt->str = out; this->Variables.push_back(out); diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index dc9318e..15fbd40 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -82,6 +82,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include "cmAddCompileOptionsCommand.h" +# include "cmAddLinkOptionsCommand.h" # include "cmAuxSourceDirectoryCommand.h" # include "cmBuildNameCommand.h" # include "cmCMakeHostSystemInformationCommand.h" @@ -100,6 +101,7 @@ # include "cmRemoveDefinitionsCommand.h" # include "cmSourceGroupCommand.h" # include "cmSubdirDependsCommand.h" +# include "cmTargetLinkOptionsCommand.h" # include "cmUseMangledMesaCommand.h" # include "cmUtilitySourceCommand.h" # include "cmVariableRequiresCommand.h" @@ -272,7 +274,10 @@ void GetProjectCommands(cmState* state) state->AddBuiltinCommand("include_external_msproject", new cmIncludeExternalMSProjectCommand); state->AddBuiltinCommand("install_programs", new cmInstallProgramsCommand); + state->AddBuiltinCommand("add_link_options", new cmAddLinkOptionsCommand); state->AddBuiltinCommand("link_libraries", new cmLinkLibrariesCommand); + state->AddBuiltinCommand("target_link_options", + new cmTargetLinkOptionsCommand); state->AddBuiltinCommand("load_cache", new cmLoadCacheCommand); state->AddBuiltinCommand("qt_wrap_cpp", new cmQTWrapCPPCommand); state->AddBuiltinCommand("qt_wrap_ui", new cmQTWrapUICommand); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 34c0e94..f7dd33b 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -174,7 +174,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // Complain if the file cannot be found and matches the complain // regex. if (fullName.empty() && - this->IncludeRegexComplain.find(current.FileName.c_str())) { + this->IncludeRegexComplain.find(current.FileName)) { cmSystemTools::Error("Cannot find file \"", current.FileName.c_str(), "\"."); return false; @@ -359,7 +359,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory, } // Match include directives. - if (this->IncludeRegexLine.find(line.c_str())) { + if (this->IncludeRegexLine.find(line)) { // Get the file being included. UnscannedEntry entry; entry.FileName = this->IncludeRegexLine.match(2); @@ -383,7 +383,7 @@ void cmDependsC::Scan(std::istream& is, const char* directory, // file their own directory by simply using "filename.h" (#12619) // This kind of problem will be fixed when a more // preprocessor-like implementation of this scanner is created. - if (this->IncludeRegexScan.find(entry.FileName.c_str())) { + if (this->IncludeRegexScan.find(entry.FileName)) { newCacheEntry->UnscannedEntries.push_back(entry); if (this->Encountered.find(entry.FileName) == this->Encountered.end()) { @@ -449,7 +449,7 @@ void cmDependsC::ParseTransform(std::string const& xform) void cmDependsC::TransformLine(std::string& line) { // Check for a transform rule match. Return if none. - if (!this->IncludeRegexTransform.find(line.c_str())) { + if (!this->IncludeRegexTransform.find(line)) { return; } TransformRulesType::const_iterator tri = diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index dbea15a..a04cee7 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -178,7 +178,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, // Store the list of modules provided by this target. std::string fiName = this->TargetDirectory; fiName += "/fortran.internal"; - cmGeneratedFileStream fiStream(fiName.c_str()); + cmGeneratedFileStream fiStream(fiName); fiStream << "# The fortran modules provided by this target.\n"; fiStream << "provides\n"; std::set<std::string> const& provides = this->Internal->TargetProvides; @@ -190,7 +190,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, if (!provides.empty()) { std::string fcName = this->TargetDirectory; fcName += "/cmake_clean_Fortran.cmake"; - cmGeneratedFileStream fcStream(fcName.c_str()); + cmGeneratedFileStream fcStream(fcName); fcStream << "# Remove fortran modules provided by this target.\n"; fcStream << "FILE(REMOVE"; std::string currentBinDir = diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index 0ceac85..bb370c4 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -7,6 +7,7 @@ #include <sstream> #include <utility> +#include "cmAlgorithms.h" #include "cmGeneratorExpression.h" #include "cmGeneratorExpressionDAGChecker.h" #include "cmGeneratorTarget.h" @@ -169,6 +170,11 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( end = "\\\n"; } os << "\n"; + } else if (property.first == "INTERFACE_LINK_OPTIONS") { + os << "LOCAL_EXPORT_LDFLAGS := "; + std::vector<std::string> linkFlagsList; + cmSystemTools::ExpandListArgument(property.second, linkFlagsList); + os << cmJoin(linkFlagsList, " ") << "\n"; } else { os << "# " << property.first << " " << (property.second) << "\n"; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 47636cd..7f42035 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -95,6 +95,12 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gte, cmGeneratorExpression::BuildInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gte, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_DEPENDS", gte, + cmGeneratorExpression::BuildInterface, + properties, missingTargets); this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE", gte, properties); diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 4e1d771..c6ec5bf 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -237,7 +237,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) } const char* packageExpr = "^[A-Za-z0-9_.-]+$"; cmsys::RegularExpression packageRegex(packageExpr); - if (!packageRegex.find(package.c_str())) { + if (!packageRegex.find(package)) { std::ostringstream e; e << "PACKAGE given invalid package name \"" << package << "\". " << "Package names must match \"" << packageExpr << "\"."; @@ -339,7 +339,7 @@ void cmExportCommand::StorePackageRegistryDir(std::string const& package, fname += "/"; fname += hash; if (!cmSystemTools::FileExists(fname)) { - cmGeneratedFileStream entry(fname.c_str(), true); + cmGeneratedFileStream entry(fname, true); if (entry) { entry << content << "\n"; } else { diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 5f61571..002fae6 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -75,7 +75,7 @@ bool cmExportFileGenerator::GenerateImportFile() } else { // Generate atomically and with copy-if-different. std::unique_ptr<cmGeneratedFileStream> ap( - new cmGeneratedFileStream(this->MainImportFile.c_str(), true)); + new cmGeneratedFileStream(this->MainImportFile, true)); ap->SetCopyIfDifferent(true); foutPtr = std::move(ap); } @@ -420,6 +420,37 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface( } } +void cmExportFileGenerator::PopulateLinkDependsInterface( + cmTargetExport* tei, cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector<std::string>& missingTargets) +{ + cmGeneratorTarget* gt = tei->Target; + assert(preprocessRule == cmGeneratorExpression::InstallInterface); + + const char* propName = "INTERFACE_LINK_DEPENDS"; + const char* input = gt->GetProperty(propName); + + if (!input) { + return; + } + + if (!*input) { + properties[propName].clear(); + return; + } + + std::string prepro = + cmGeneratorExpression::Preprocess(input, preprocessRule, true); + if (!prepro.empty()) { + this->ResolveTargetsInGeneratorExpressions(prepro, gt, missingTargets); + + if (!checkInterfaceDirs(prepro, gt, propName)) { + return; + } + properties[propName] = prepro; + } +} + void cmExportFileGenerator::PopulateInterfaceProperty( const std::string& propName, cmGeneratorTarget* target, cmGeneratorExpression::PreprocessContext preprocessRule, diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 954e6c5..6ca2e07 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -147,6 +147,10 @@ protected: cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, ImportPropertyMap& properties, std::vector<std::string>& missingTargets); + void PopulateLinkDependsInterface( + cmTargetExport* target, + cmGeneratorExpression::PreprocessContext preprocessRule, + ImportPropertyMap& properties, std::vector<std::string>& missingTargets); void SetImportLinkInterface( const std::string& config, std::string const& suffix, diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 02686f3..bfb7a05 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -103,6 +103,11 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->PopulateInterfaceProperty("INTERFACE_COMPILE_FEATURES", gt, cmGeneratorExpression::InstallInterface, properties, missingTargets); + this->PopulateInterfaceProperty("INTERFACE_LINK_OPTIONS", gt, + cmGeneratorExpression::InstallInterface, + properties, missingTargets); + this->PopulateLinkDependsInterface( + te, cmGeneratorExpression::InstallInterface, properties, missingTargets); std::string errorMessage; if (!this->PopulateExportProperties(gt, properties, errorMessage)) { @@ -283,7 +288,7 @@ bool cmExportInstallFileGenerator::GenerateImportFileConfig( fileName += this->FileExt; // Open the output file to generate it. - cmGeneratedFileStream exportFileStream(fileName.c_str(), true); + cmGeneratedFileStream exportFileStream(fileName, true); if (!exportFileStream) { std::string se = cmSystemTools::GetLastSystemError(); std::ostringstream e; diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index 50f8cb0..b4b2962 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -54,7 +54,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const cm::make_unique<cmsys::ofstream>(this->Filename.c_str(), std::ios::app); } else { std::unique_ptr<cmGeneratedFileStream> ap( - new cmGeneratedFileStream(this->Filename.c_str(), true)); + new cmGeneratedFileStream(this->Filename, true)); ap->SetCopyIfDifferent(true); foutPtr = std::move(ap); } diff --git a/Source/cmExprParserHelper.cxx b/Source/cmExprParserHelper.cxx index fe7159a..8d3dad7 100644 --- a/Source/cmExprParserHelper.cxx +++ b/Source/cmExprParserHelper.cxx @@ -6,6 +6,8 @@ #include <iostream> #include <sstream> +#include <stdexcept> +#include <utility> int cmExpr_yyparse(yyscan_t yyscanner); // @@ -13,11 +15,11 @@ cmExprParserHelper::cmExprParserHelper() { this->FileLine = -1; this->FileName = nullptr; + this->Result = 0; } cmExprParserHelper::~cmExprParserHelper() { - this->CleanupParser(); } int cmExprParserHelper::ParseString(const char* str, int verb) @@ -37,16 +39,34 @@ int cmExprParserHelper::ParseString(const char* str, int verb) yyscan_t yyscanner; cmExpr_yylex_init(&yyscanner); cmExpr_yyset_extra(this, yyscanner); - int res = cmExpr_yyparse(yyscanner); + + try { + int res = cmExpr_yyparse(yyscanner); + if (res != 0) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\": "; + e += ErrorString; + e += "."; + this->SetError(std::move(e)); + } + } catch (std::runtime_error const& fail) { + std::string e = + "cannot evaluate the expression: \"" + InputBuffer + "\": "; + e += fail.what(); + e += "."; + this->SetError(std::move(e)); + } catch (std::out_of_range const&) { + std::string e = "cannot evaluate the expression: \"" + InputBuffer + + "\": a numeric value is out of range."; + this->SetError(std::move(e)); + } catch (...) { + std::string e = "cannot parse the expression: \"" + InputBuffer + "\"."; + this->SetError(std::move(e)); + } cmExpr_yylex_destroy(yyscanner); - if (res != 0) { - // str << "CAL_Parser returned: " << res << std::endl; - // std::cerr << "When parsing: [" << str << "]" << std::endl; + if (!this->ErrorString.empty()) { return 0; } - this->CleanupParser(); - if (Verbose) { std::cerr << "Expanding [" << str << "] produced: [" << this->Result << "]" << std::endl; @@ -54,10 +74,6 @@ int cmExprParserHelper::ParseString(const char* str, int verb) return 1; } -void cmExprParserHelper::CleanupParser() -{ -} - int cmExprParserHelper::LexInput(char* buf, int maxlen) { // std::cout << "JPLexInput "; @@ -85,7 +101,21 @@ void cmExprParserHelper::Error(const char* str) this->ErrorString = ostr.str(); } -void cmExprParserHelper::SetResult(int value) +void cmExprParserHelper::UnexpectedChar(char c) +{ + unsigned long pos = static_cast<unsigned long>(this->InputBufferPos); + std::ostringstream ostr; + ostr << "Unexpected character in expression at position " << pos << ": " << c + << "\n"; + this->WarningString += ostr.str(); +} + +void cmExprParserHelper::SetResult(KWIML_INT_int64_t value) { this->Result = value; } + +void cmExprParserHelper::SetError(std::string errorString) +{ + this->ErrorString = std::move(errorString); +} diff --git a/Source/cmExprParserHelper.h b/Source/cmExprParserHelper.h index dcdaca9..42c460a 100644 --- a/Source/cmExprParserHelper.h +++ b/Source/cmExprParserHelper.h @@ -5,6 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include "cm_kwiml.h" + #include <string> #include <vector> @@ -13,7 +15,7 @@ class cmExprParserHelper public: struct ParserType { - int Number; + KWIML_INT_int64_t Number; }; cmExprParserHelper(); @@ -24,12 +26,16 @@ public: int LexInput(char* buf, int maxlen); void Error(const char* str); - void SetResult(int value); + void SetResult(KWIML_INT_int64_t value); - int GetResult() { return this->Result; } + KWIML_INT_int64_t GetResult() { return this->Result; } const char* GetError() { return this->ErrorString.c_str(); } + void UnexpectedChar(char c); + + std::string const& GetWarning() const { return this->WarningString; } + private: std::string::size_type InputBufferPos; std::string InputBuffer; @@ -39,12 +45,13 @@ private: void Print(const char* place, const char* str); - void CleanupParser(); + void SetError(std::string errorString); - int Result; + KWIML_INT_int64_t Result; const char* FileName; long FileLine; std::string ErrorString; + std::string WarningString; }; #define YYSTYPE cmExprParserHelper::ParserType diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index b636c73..fbf6560 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -199,7 +199,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( const std::vector<cmLocalGenerator*>& lgs, const std::string& filename) { const cmMakefile* mf = lgs[0]->GetMakefile(); - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } @@ -476,7 +476,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( filename += "/"; filename += target->GetName(); filename += ".objlib"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (fout) { /* clang-format off */ fout << "# This is a dummy file for the OBJECT library " diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index b76efb2..582a2e7 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -77,7 +77,7 @@ void cmExtraCodeLiteGenerator::Generate() } } - cmGeneratedFileStream fout(workspaceFileName.c_str()); + cmGeneratedFileStream fout(workspaceFileName); cmXMLWriter xml(fout); xml.StartDocument("utf-8"); @@ -249,7 +249,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( const std::vector<cmLocalGenerator*>& lgs, const std::string& filename) { const cmMakefile* mf = lgs[0]->GetMakefile(); - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } @@ -547,7 +547,7 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( const cmGeneratorTarget* gt, const std::string& filename) { const cmMakefile* mf = gt->Makefile; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 14448f5..313d46b 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -98,7 +98,7 @@ void cmExtraEclipseCDT4Generator::Generate() std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION"); cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*"); - if (regex.find(eclipseVersion.c_str())) { + if (regex.find(eclipseVersion)) { unsigned int majorVersion = 0; unsigned int minorVersion = 0; int res = @@ -176,7 +176,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() this->GetPathBasename(this->HomeDirectory)); const std::string filename = this->HomeDirectory + "/.project"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } @@ -261,7 +261,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() const std::string filename = this->HomeOutputDirectory + "/.project"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } @@ -555,7 +555,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories( // Frameworks/ part has to be stripped // /System/Library/Frameworks/GLUT.framework/Headers cmsys::RegularExpression frameworkRx("(.+/Frameworks)/.+\\.framework/"); - if (frameworkRx.find(dir.c_str())) { + if (frameworkRx.find(dir)) { dir = frameworkRx.match(1); } @@ -582,7 +582,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const std::string filename = this->HomeOutputDirectory + "/.cproject"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index df18715..f5c4c93 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -58,7 +58,7 @@ void cmExtraKateGenerator::CreateKateProjectFile( { std::string filename = lg->GetBinaryDirectory(); filename += "/.kateproject"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } @@ -215,7 +215,7 @@ void cmExtraKateGenerator::CreateDummyKateProjectFile( filename += "/"; filename += this->ProjectName; filename += ".kateproject"; - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index fb85a68..14e7927 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -91,7 +91,7 @@ void cmExtraSublimeTextGenerator::CreateNewProjectFile( { const cmMakefile* mf = lgs[0]->GetMakefile(); - cmGeneratedFileStream fout(filename.c_str()); + cmGeneratedFileStream fout(filename); if (!fout) { return; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index dcb79f7..0c80319 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -7,9 +7,10 @@ #include "cmsys/FStream.hxx" #include "cmsys/Glob.hxx" #include "cmsys/RegularExpression.hxx" -#include "cmsys/String.hxx" + #include <algorithm> #include <assert.h> +#include <ctype.h> #include <memory> // IWYU pragma: keep #include <sstream> #include <stdio.h> @@ -207,16 +208,20 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, cmSystemTools::MakeDirectory(dir); mode_t mode = 0; + bool writable = false; // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { - cmSystemTools::SetPermissions(fileName.c_str(), #if defined(_MSC_VER) || defined(__MINGW32__) - mode | S_IWRITE + writable = mode & S_IWRITE; + mode_t newMode = mode | S_IWRITE; #else - mode | S_IWUSR | S_IWGRP + writable = mode & S_IWUSR; + mode_t newMode = mode | S_IWUSR | S_IWGRP; #endif - ); + if (!writable) { + cmSystemTools::SetPermissions(fileName.c_str(), newMode); + } } // If GetPermissions fails, pretend like it is ok. File open will fail if // the file is not writable @@ -241,7 +246,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, return false; } file.close(); - if (mode) { + if (mode && !writable) { cmSystemTools::SetPermissions(fileName.c_str(), mode); } return true; @@ -609,8 +614,8 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) continue; } - if ((c >= 0x20 && c < 0x7F) || c == '\t' || - (c == '\n' && newline_consume)) { + if (c >= 0 && c <= 0xFF && + (isprint(c) || c == '\t' || (c == '\n' && newline_consume))) { // This is an ASCII character that may be part of a string. // Cast added to avoid compiler warning. Cast is ok because // c is guaranteed to fit in char by the above if... @@ -658,7 +663,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) // The current line has been terminated. Check if the current // string matches the requirements. The length may now be as // low as zero since blank lines are allowed. - if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) { + if (s.length() >= minlen && (!have_regex || regex.find(s))) { output_size += static_cast<int>(s.size()) + 1; if (limit_output >= 0 && output_size >= limit_output) { s.clear(); @@ -674,7 +679,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) // string matches the requirements. We require that the length // be at least one no matter what the user specified. if (s.length() >= minlen && !s.empty() && - (!have_regex || regex.find(s.c_str()))) { + (!have_regex || regex.find(s))) { output_size += static_cast<int>(s.size()) + 1; if (limit_output >= 0 && output_size >= limit_output) { s.clear(); @@ -691,7 +696,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) if (maxlen > 0 && s.size() == maxlen) { // Terminate a string if the maximum length is reached. - if (s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) { + if (s.length() >= minlen && (!have_regex || regex.find(s))) { output_size += static_cast<int>(s.size()) + 1; if (limit_output >= 0 && output_size >= limit_output) { s.clear(); @@ -707,7 +712,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) // input file or the input size limit. Check if the current string // matches the requirements. if ((!limit_count || strings.size() < limit_count) && !s.empty() && - s.length() >= minlen && (!have_regex || regex.find(s.c_str()))) { + s.length() >= minlen && (!have_regex || regex.find(s))) { output_size += static_cast<int>(s.size()) + 1; if (limit_output < 0 || output_size < limit_output) { strings.push_back(s); @@ -2484,11 +2489,11 @@ bool cmFileCommand::HandleCMakePathCommand( #else char pathSep = ':'; #endif - std::vector<cmsys::String> path = cmSystemTools::SplitString(*i, pathSep); + std::vector<std::string> path = cmSystemTools::SplitString(*i, pathSep); i++; const char* var = i->c_str(); std::string value; - for (std::vector<cmsys::String>::iterator j = path.begin(); j != path.end(); + for (std::vector<std::string>::iterator j = path.begin(); j != path.end(); ++j) { if (j != path.begin()) { value += ";"; @@ -2498,7 +2503,7 @@ bool cmFileCommand::HandleCMakePathCommand( } else { *j = cmSystemTools::ConvertToOutputPath(*j); // remove double quotes in the path - cmsys::String& s = *j; + std::string& s = *j; if (s.size() > 1 && s[0] == '\"' && s[s.size() - 1] == '\"') { s = s.substr(1, s.size() - 2); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7ac0cdf..598b9b6 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -337,7 +337,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args, return false; } this->Configs.push_back(args[i]); - } else if (!haveVersion && version.find(args[i].c_str())) { + } else if (!haveVersion && version.find(args[i])) { haveVersion = true; this->Version = args[i]; } else { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index d8c7ab3..48f17ef 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -7,6 +7,7 @@ #include "cm_kwiml.h" #include <cstddef> +#include <functional> #include <map> #include <set> #include <string> @@ -15,14 +16,12 @@ // IWYU insists we should forward-declare instead of including <functional>, // but we cannot forward-declare reliably because some C++ standard libraries // put the template in an inline namespace. -#ifdef CMAKE_IWYU +#ifdef CMAKE_IWYU_FORWARD_STD_HASH /* clang-format off */ namespace std { template <class T> struct hash; } /* clang-format on */ -#else -# include <functional> #endif #include "cmFindCommon.h" diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 13a18e2..db34077 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -34,6 +34,9 @@ struct cmFindProgramHelper // Current names under consideration. std::vector<std::string> Names; + // Current name with extension under consideration. + std::string TestNameExt; + // Current full path under consideration. std::string TestPath; @@ -43,6 +46,19 @@ struct cmFindProgramHelper this->Names.clear(); this->AddName(name); } + bool CheckCompoundNames() + { + for (std::string const& n : this->Names) { + // Only perform search relative to current directory if the file name + // contains a directory separator. + if (n.find('/') != std::string::npos) { + if (this->CheckDirectoryForName("", n)) { + return true; + } + } + } + return false; + } bool CheckDirectory(std::string const& path) { for (std::string const& n : this->Names) { @@ -55,14 +71,16 @@ struct cmFindProgramHelper bool CheckDirectoryForName(std::string const& path, std::string const& name) { for (std::string const& ext : this->Extensions) { - this->TestPath = path; - this->TestPath += name; if (!ext.empty() && cmSystemTools::StringEndsWith(name, ext.c_str())) { continue; } - this->TestPath += ext; + this->TestNameExt = name; + this->TestNameExt += ext; + this->TestPath = + cmSystemTools::CollapseCombinedPath(path, this->TestNameExt); + if (cmSystemTools::FileExists(this->TestPath, true)) { - this->BestPath = cmSystemTools::CollapseFullPath(this->TestPath); + this->BestPath = this->TestPath; return true; } } @@ -145,8 +163,8 @@ std::string cmFindProgramCommand::FindNormalProgramNamesPerDir() helper.AddName(n); } - // Check for the names themselves (e.g. absolute paths). - if (helper.CheckDirectory(std::string())) { + // Check for the names themselves if they contain a directory separator. + if (helper.CheckCompoundNames()) { return helper.BestPath; } @@ -168,8 +186,8 @@ std::string cmFindProgramCommand::FindNormalProgramDirsPerName() // Switch to searching for this name. helper.SetName(n); - // Check for the name by itself (e.g. an absolute path). - if (helper.CheckDirectory(std::string())) { + // Check for the names themselves if they contain a directory separator. + if (helper.CheckCompoundNames()) { return helper.BestPath; } diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx index 6bdf3a4..186ec8c 100644 --- a/Source/cmGeneratedFileStream.cxx +++ b/Source/cmGeneratedFileStream.cxx @@ -24,8 +24,8 @@ cmGeneratedFileStream::cmGeneratedFileStream(Encoding encoding) #endif } -cmGeneratedFileStream::cmGeneratedFileStream(const char* name, bool quiet, - Encoding encoding) +cmGeneratedFileStream::cmGeneratedFileStream(std::string const& name, + bool quiet, Encoding encoding) : cmGeneratedFileStreamBase(name) , Stream(TempName.c_str()) { @@ -54,7 +54,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream() this->Okay = !this->fail(); } -cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name, +cmGeneratedFileStream& cmGeneratedFileStream::Open(std::string const& name, bool quiet, bool binaryFlag) { // Store the file name and construct the temporary file name. @@ -114,7 +114,7 @@ cmGeneratedFileStreamBase::cmGeneratedFileStreamBase() { } -cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(const char* name) +cmGeneratedFileStreamBase::cmGeneratedFileStreamBase(std::string const& name) : Name() , TempName() , CopyIfDifferent(false) @@ -130,7 +130,7 @@ cmGeneratedFileStreamBase::~cmGeneratedFileStreamBase() this->Close(); } -void cmGeneratedFileStreamBase::Open(const char* name) +void cmGeneratedFileStreamBase::Open(std::string const& name) { // Save the original name of the file. this->Name = name; @@ -168,12 +168,12 @@ bool cmGeneratedFileStreamBase::Close() // destination atomically. if (this->Compress) { std::string gzname = this->TempName + ".temp.gz"; - if (this->CompressFile(this->TempName.c_str(), gzname.c_str())) { - this->RenameFile(gzname.c_str(), resname.c_str()); + if (this->CompressFile(this->TempName, gzname)) { + this->RenameFile(gzname, resname); } cmSystemTools::RemoveFile(gzname); } else { - this->RenameFile(this->TempName.c_str(), resname.c_str()); + this->RenameFile(this->TempName, resname); } replaced = true; @@ -188,10 +188,10 @@ bool cmGeneratedFileStreamBase::Close() } #ifdef CMAKE_BUILD_WITH_CMAKE -int cmGeneratedFileStreamBase::CompressFile(const char* oldname, - const char* newname) +int cmGeneratedFileStreamBase::CompressFile(std::string const& oldname, + std::string const& newname) { - gzFile gf = gzopen(newname, "w"); + gzFile gf = gzopen(newname.c_str(), "w"); if (!gf) { return 0; } @@ -214,16 +214,17 @@ int cmGeneratedFileStreamBase::CompressFile(const char* oldname, return 1; } #else -int cmGeneratedFileStreamBase::CompressFile(const char*, const char*) +int cmGeneratedFileStreamBase::CompressFile(std::string const&, + std::string const&) { return 0; } #endif -int cmGeneratedFileStreamBase::RenameFile(const char* oldname, - const char* newname) +int cmGeneratedFileStreamBase::RenameFile(std::string const& oldname, + std::string const& newname) { - return cmSystemTools::RenameFile(oldname, newname); + return cmSystemTools::RenameFile(oldname.c_str(), newname.c_str()); } void cmGeneratedFileStream::SetName(const std::string& fname) diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h index 48f93c5..dacd166 100644 --- a/Source/cmGeneratedFileStream.h +++ b/Source/cmGeneratedFileStream.h @@ -20,7 +20,7 @@ protected: cmGeneratedFileStreamBase(); // This constructor prepares the temporary output file. - cmGeneratedFileStreamBase(const char* name); + cmGeneratedFileStreamBase(std::string const& name); // The destructor renames the temporary output file to the real name. ~cmGeneratedFileStreamBase(); @@ -29,14 +29,14 @@ protected: // called before the real stream is opened. Close is always called // after the real stream is closed and Okay is set to whether the // real stream was still valid for writing when it was closed. - void Open(const char* name); + void Open(std::string const& name); bool Close(); // Internal file replacement implementation. - int RenameFile(const char* oldname, const char* newname); + int RenameFile(std::string const& oldname, std::string const& newname); // Internal file compression implementation. - int CompressFile(const char* oldname, const char* newname); + int CompressFile(std::string const& oldname, std::string const& newname); // The name of the final destination file for the output. std::string Name; @@ -87,7 +87,7 @@ public: * file cannot be opened an error message is produced unless the * second argument is set to true. */ - cmGeneratedFileStream(const char* name, bool quiet = false, + cmGeneratedFileStream(std::string const& name, bool quiet = false, Encoding encoding = codecvt::None); /** @@ -103,7 +103,7 @@ public: * temporary file. If the file cannot be opened an error message is * produced unless the second argument is set to true. */ - cmGeneratedFileStream& Open(const char* name, bool quiet = false, + cmGeneratedFileStream& Open(std::string const& name, bool quiet = false, bool binaryFlag = false); /** diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h index a3a8f69..cd23904 100644 --- a/Source/cmGeneratorExpressionDAGChecker.h +++ b/Source/cmGeneratorExpressionDAGChecker.h @@ -25,7 +25,9 @@ struct cmGeneratorExpressionContext; SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS) \ SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS) \ SELECT(F, EvaluatingSources, SOURCES) \ - SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) + SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \ + SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \ + SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS) #define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \ CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH) diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 99b9261..a094fa5 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -85,7 +85,7 @@ void cmGeneratorExpressionEvaluationFile::Generate( this->Files.push_back(outputFileName); outputFiles[outputFileName] = outputContent; - cmGeneratedFileStream fout(outputFileName.c_str()); + cmGeneratedFileStream fout(outputFileName); fout.SetCopyIfDifferent(true); fout << outputContent; if (fout.Close() && perm) { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 1594904..3381e6d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1126,7 +1126,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode std::string targetName = parameters.front(); propertyName = parameters[1]; if (!cmGeneratorExpression::IsValidTargetName(targetName)) { - if (!propertyNameValidator.find(propertyName.c_str())) { + if (!propertyNameValidator.find(propertyName)) { ::reportError(context, content->GetOriginalExpression(), "Target name and property name not supported."); return std::string(); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b223c5e..c20fd13 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -102,6 +102,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) , DebugCompileOptionsDone(false) , DebugCompileFeaturesDone(false) , DebugCompileDefinitionsDone(false) + , DebugLinkOptionsDone(false) , DebugSourcesDone(false) , LinkImplementationLanguageIsContextDependent(true) , UtilityItemsDone(false) @@ -128,6 +129,10 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) t->GetCompileDefinitionsBacktraces(), this->CompileDefinitionsEntries); + CreatePropertyGeneratorExpressions(t->GetLinkOptionsEntries(), + t->GetLinkOptionsBacktraces(), + this->LinkOptionsEntries); + CreatePropertyGeneratorExpressions(t->GetSourceEntries(), t->GetSourceBacktraces(), this->SourceEntries, true); @@ -145,6 +150,7 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileOptionsEntries); cmDeleteAll(this->CompileFeaturesEntries); cmDeleteAll(this->CompileDefinitionsEntries); + cmDeleteAll(this->LinkOptionsEntries); cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); } @@ -215,6 +221,15 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const return this->Target->GetProperty(prop); } +const char* cmGeneratorTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + const char* cmGeneratorTarget::GetOutputTargetType( cmStateEnums::ArtifactType artifact) const { @@ -1124,7 +1139,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files, std::string cppFileName = xaml + ".cpp"; files.ExpectedXamlHeaders.insert(hFileName); files.ExpectedXamlSources.insert(cppFileName); - } else if (header_regex.find(sf->GetFullPath().c_str())) { + } else if (header_regex.find(sf->GetFullPath())) { kind = SourceKindHeader; } else { kind = SourceKindExtra; @@ -2633,7 +2648,7 @@ enum class OptionsParse Shell }; -static void processCompileOptionsInternal( +static void processOptionsInternal( cmGeneratorTarget const* tgt, const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, std::vector<std::string>& options, @@ -2665,7 +2680,7 @@ static void processCompileOptionsInternal( if (!usedOptions.empty()) { tgt->GetLocalGenerator()->GetCMakeInstance()->IssueMessage( cmake::LOG, - std::string("Used compile ") + logName + std::string(" for target ") + + std::string("Used ") + logName + std::string(" for target ") + tgt->GetName() + ":\n" + usedOptions, entry->ge->GetBacktrace()); } @@ -2680,9 +2695,9 @@ static void processCompileOptions( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions, std::string const& language) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "options", - language, OptionsParse::Shell); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile options", language, + OptionsParse::Shell); } void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result, @@ -2734,9 +2749,9 @@ static void processCompileFeatures( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features", - std::string(), OptionsParse::None); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile features", + std::string(), OptionsParse::None); } void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result, @@ -2784,9 +2799,9 @@ static void processCompileDefinitions( cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, bool debugOptions, std::string const& language) { - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, - "definitions", language, OptionsParse::None); + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "compile definitions", language, + OptionsParse::None); } void cmGeneratorTarget::GetCompileDefinitions( @@ -2855,6 +2870,195 @@ void cmGeneratorTarget::GetCompileDefinitions( cmDeleteAll(linkInterfaceCompileDefinitionsEntries); } +namespace { +void processLinkOptions( + cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, + std::vector<std::string>& options, + std::unordered_set<std::string>& uniqueOptions, + cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, + bool debugOptions, std::string const& language) +{ + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, debugOptions, "link options", language, + OptionsParse::Shell); +} +} + +void cmGeneratorTarget::GetLinkOptions(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const +{ + std::unordered_set<std::string> uniqueOptions; + + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_OPTIONS", + nullptr, nullptr); + + std::vector<std::string> debugProperties; + const char* debugProp = + this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); + if (debugProp) { + cmSystemTools::ExpandListArgument(debugProp, debugProperties); + } + + bool debugOptions = !this->DebugLinkOptionsDone && + std::find(debugProperties.begin(), debugProperties.end(), + "LINK_OPTIONS") != debugProperties.end(); + + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { + this->DebugLinkOptionsDone = true; + } + + processLinkOptions(this, this->LinkOptionsEntries, result, uniqueOptions, + &dagChecker, config, debugOptions, language); + + std::vector<cmGeneratorTarget::TargetPropertyEntry*> + linkInterfaceLinkOptionsEntries; + + AddInterfaceEntries(this, config, "INTERFACE_LINK_OPTIONS", + linkInterfaceLinkOptionsEntries); + + processLinkOptions(this, linkInterfaceLinkOptionsEntries, result, + uniqueOptions, &dagChecker, config, debugOptions, + language); + + cmDeleteAll(linkInterfaceLinkOptionsEntries); + + // Last step: replace "LINKER:" prefixed elements by + // actual linker wrapper + const std::string wrapper(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_LINKER_WRAPPER_FLAG")); + std::vector<std::string> wrapperFlag; + cmSystemTools::ExpandListArgument(wrapper, wrapperFlag); + const std::string wrapperSep(this->Makefile->GetSafeDefinition( + "CMAKE_" + language + "_LINKER_WRAPPER_FLAG_SEP")); + bool concatFlagAndArgs = true; + if (!wrapperFlag.empty() && wrapperFlag.back() == " ") { + concatFlagAndArgs = false; + wrapperFlag.pop_back(); + } + + const std::string LINKER{ "LINKER:" }; + const std::string SHELL{ "SHELL:" }; + const std::string LINKER_SHELL = LINKER + SHELL; + + std::vector<std::string>::iterator entry; + while ((entry = std::find_if(result.begin(), result.end(), + [&LINKER](const std::string& item) -> bool { + return item.compare(0, LINKER.length(), + LINKER) == 0; + })) != result.end()) { + std::vector<std::string> linkerOptions; + if (entry->compare(0, LINKER_SHELL.length(), LINKER_SHELL) == 0) { + cmSystemTools::ParseUnixCommandLine( + entry->c_str() + LINKER_SHELL.length(), linkerOptions); + } else { + linkerOptions = + cmSystemTools::tokenize(entry->substr(LINKER.length()), ","); + } + entry = result.erase(entry); + + if (linkerOptions.empty() || + (linkerOptions.size() == 1 && linkerOptions.front().empty())) { + continue; + } + + // for now, raise an error if prefix SHELL: is part of arguments + if (std::find_if(linkerOptions.begin(), linkerOptions.end(), + [&SHELL](const std::string& item) -> bool { + return item.find(SHELL) != std::string::npos; + }) != linkerOptions.end()) { + this->LocalGenerator->GetCMakeInstance()->IssueMessage( + cmake::FATAL_ERROR, + "'SHELL:' prefix is not supported as part of 'LINKER:' arguments.", + this->GetBacktrace()); + return; + } + + if (wrapperFlag.empty()) { + // nothing specified, insert elements as is + result.insert(entry, linkerOptions.begin(), linkerOptions.end()); + } else { + std::vector<std::string> options; + + if (!wrapperSep.empty()) { + if (concatFlagAndArgs) { + // insert flag elements except last one + options.insert(options.end(), wrapperFlag.begin(), + wrapperFlag.end() - 1); + // concatenate last flag element and all LINKER list values + // in one option + options.push_back(wrapperFlag.back() + + cmJoin(linkerOptions, wrapperSep)); + } else { + options.insert(options.end(), wrapperFlag.begin(), + wrapperFlag.end()); + // concatenate all LINKER list values in one option + options.push_back(cmJoin(linkerOptions, wrapperSep)); + } + } else { + // prefix each element of LINKER list with wrapper + if (concatFlagAndArgs) { + std::transform( + linkerOptions.begin(), linkerOptions.end(), linkerOptions.begin(), + [&wrapperFlag](const std::string& value) -> std::string { + return wrapperFlag.back() + value; + }); + } + for (const auto& value : linkerOptions) { + options.insert(options.end(), wrapperFlag.begin(), + concatFlagAndArgs ? wrapperFlag.end() - 1 + : wrapperFlag.end()); + options.push_back(value); + } + } + result.insert(entry, options.begin(), options.end()); + } + } +} + +namespace { +void processLinkDepends( + cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries, + std::vector<std::string>& options, + std::unordered_set<std::string>& uniqueOptions, + cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config, + std::string const& language) +{ + processOptionsInternal(tgt, entries, options, uniqueOptions, dagChecker, + config, false, "link depends", language, + OptionsParse::None); +} +} + +void cmGeneratorTarget::GetLinkDepends(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const +{ + std::vector<cmGeneratorTarget::TargetPropertyEntry*> linkDependsEntries; + std::unordered_set<std::string> uniqueOptions; + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "LINK_DEPENDS", + nullptr, nullptr); + + if (const char* linkDepends = this->GetProperty("LINK_DEPENDS")) { + std::vector<std::string> depends; + cmGeneratorExpression ge; + cmSystemTools::ExpandListArgument(linkDepends, depends); + for (const auto& depend : depends) { + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(depend); + linkDependsEntries.push_back( + new cmGeneratorTarget::TargetPropertyEntry(std::move(cge))); + } + } + AddInterfaceEntries(this, config, "INTERFACE_LINK_DEPENDS", + linkDependsEntries); + processLinkDepends(this, linkDependsEntries, result, uniqueOptions, + &dagChecker, config, language); + + cmDeleteAll(linkDependsEntries); +} + void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const { if (this->IsImported()) { @@ -3154,14 +3358,12 @@ std::string cmGeneratorTarget::GetFullNameInternal( return prefix + base + suffix; } -const char* cmGeneratorTarget::ImportedGetLocation( +std::string cmGeneratorTarget::ImportedGetLocation( const std::string& config) const { - static std::string location; assert(this->IsImported()); - location = this->Target->ImportedGetFullPath( + return this->Target->ImportedGetFullPath( config, cmStateEnums::RuntimeBinaryArtifact); - return location.c_str(); } std::string cmGeneratorTarget::GetFullNameImported( diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 2132b15..6c1f931 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -68,7 +68,10 @@ public: std::string GetExportName() const; std::vector<std::string> GetPropertyKeys() const; + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void GetSourceFiles(std::vector<cmSourceFile*>& files, const std::string& config) const; @@ -418,6 +421,14 @@ public: const std::string& config, const std::string& language) const; + void GetLinkOptions(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const; + + void GetLinkDepends(std::vector<std::string>& result, + const std::string& config, + const std::string& language) const; + bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config, const std::string& language) const; @@ -647,7 +658,7 @@ public: no soname at all. */ bool IsImportedSharedLibWithoutSOName(const std::string& config) const; - const char* ImportedGetLocation(const std::string& config) const; + std::string ImportedGetLocation(const std::string& config) const; /** Get the target major and minor version numbers interpreted from the VERSION property. Version 0 is returned if the property is @@ -803,6 +814,7 @@ private: std::vector<TargetPropertyEntry*> CompileOptionsEntries; std::vector<TargetPropertyEntry*> CompileFeaturesEntries; std::vector<TargetPropertyEntry*> CompileDefinitionsEntries; + std::vector<TargetPropertyEntry*> LinkOptionsEntries; std::vector<TargetPropertyEntry*> SourceEntries; mutable std::set<std::string> LinkImplicitNullProperties; @@ -851,6 +863,7 @@ private: mutable bool DebugCompileOptionsDone; mutable bool DebugCompileFeaturesDone; mutable bool DebugCompileDefinitionsDone; + mutable bool DebugLinkOptionsDone; mutable bool DebugSourcesDone; mutable bool LinkImplementationLanguageIsContextDependent; mutable bool UtilityItemsDone; diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx index e23b6ea..d8c854c 100644 --- a/Source/cmGlobVerificationManager.cxx +++ b/Source/cmGlobVerificationManager.cxx @@ -23,7 +23,7 @@ bool cmGlobVerificationManager::SaveVerificationScript(const std::string& path) cmSystemTools::MakeDirectory(scriptFile); scriptFile += "/VerifyGlobs.cmake"; stampFile += "/cmake.verify_globs"; - cmGeneratedFileStream verifyScriptFile(scriptFile.c_str()); + cmGeneratedFileStream verifyScriptFile(scriptFile); verifyScriptFile.SetCopyIfDifferent(true); if (!verifyScriptFile) { cmSystemTools::Error("Unable to open verification script file for save. ", diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 2872831..324b56a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1313,14 +1313,10 @@ bool cmGlobalGenerator::Compute() // so create the map from project name to vector of local generators this->FillProjectMap(); -#ifdef CMAKE_BUILD_WITH_CMAKE - // Iterate through all targets and set up automoc for those which have - // the AUTOMOC, AUTOUIC or AUTORCC property set - auto autogenInits = this->CreateQtAutoGenInitializers(); - for (auto& autoGen : autogenInits) { - autoGen->InitCustomTargets(); + // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC + if (!this->QtAutoGen()) { + return false; } -#endif // Add generator specific helper commands for (cmLocalGenerator* localGen : this->LocalGenerators) { @@ -1339,14 +1335,6 @@ bool cmGlobalGenerator::Compute() } } -#ifdef CMAKE_BUILD_WITH_CMAKE - for (auto& autoGen : autogenInits) { - autoGen->SetupCustomTargets(); - autoGen.reset(nullptr); - } - autogenInits.clear(); -#endif - for (cmLocalGenerator* localGen : this->LocalGenerators) { cmMakefile* mf = localGen->GetMakefile(); for (cmInstallGenerator* g : mf->GetInstallGenerators()) { @@ -1476,12 +1464,11 @@ bool cmGlobalGenerator::ComputeTargetDepends() return true; } -std::vector<std::unique_ptr<cmQtAutoGenInitializer>> -cmGlobalGenerator::CreateQtAutoGenInitializers() +bool cmGlobalGenerator::QtAutoGen() { +#ifdef CMAKE_BUILD_WITH_CMAKE std::vector<std::unique_ptr<cmQtAutoGenInitializer>> autogenInits; -#ifdef CMAKE_BUILD_WITH_CMAKE for (cmLocalGenerator* localGen : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& targets = localGen->GetGeneratorTargets(); @@ -1515,12 +1502,30 @@ cmGlobalGenerator::CreateQtAutoGenInitializers() continue; } - autogenInits.emplace_back(new cmQtAutoGenInitializer( + autogenInits.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( target, mocEnabled, uicEnabled, rccEnabled, qtVersionMajor)); } } + + if (!autogenInits.empty()) { + // Initialize custom targets + for (auto& autoGen : autogenInits) { + if (!autoGen->InitCustomTargets()) { + return false; + } + } + + // Setup custom targets + for (auto& autoGen : autogenInits) { + if (!autoGen->SetupCustomTargets()) { + return false; + } + autoGen.reset(nullptr); + } + } #endif - return autogenInits; + + return true; } cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer( @@ -2886,7 +2891,7 @@ void cmGlobalGenerator::CheckRuleHashes(std::string const& pfile, std::string fpath = cmSystemTools::CollapseFullPath(fname, home.c_str()); if (cmSystemTools::FileExists(fpath)) { RuleHash hash; - strncpy(hash.Data, line.c_str(), 32); + memcpy(hash.Data, line.c_str(), 32); this->RuleHashes[fname] = hash; } } @@ -2899,7 +2904,7 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile) if (this->RuleHashes.empty()) { cmSystemTools::RemoveFile(pfile); } else { - cmGeneratedFileStream fout(pfile.c_str()); + cmGeneratedFileStream fout(pfile); fout << "# Hashes of file build rules.\n"; for (auto const& rh : this->RuleHashes) { fout.write(rh.second.Data, 32); @@ -2914,7 +2919,7 @@ void cmGlobalGenerator::WriteSummary() std::string fname = this->CMakeInstance->GetHomeOutputDirectory(); fname += cmake::GetCMakeFilesDirectory(); fname += "/TargetDirectories.txt"; - cmGeneratedFileStream fout(fname.c_str()); + cmGeneratedFileStream fout(fname); for (cmLocalGenerator* lg : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& tgts = lg->GetGeneratorTargets(); @@ -2951,7 +2956,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) Json::Value& lj_sources = lj_root["sources"] = Json::arrayValue; cmSystemTools::MakeDirectory(dir); - cmGeneratedFileStream fout(file.c_str()); + cmGeneratedFileStream fout(file); std::vector<std::string> labels; @@ -3025,7 +3030,7 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) } } } - cmGeneratedFileStream json_fout(json_file.c_str()); + cmGeneratedFileStream json_fout(json_file); json_fout << lj_root; } else #endif @@ -3100,7 +3105,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile() return true; } - cmGeneratedFileStream file(path.c_str()); + cmGeneratedFileStream file(path); file << "# CPack properties\n"; for (auto const& i : installedFiles) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index a50cc3b..1ed070e 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -33,7 +33,6 @@ class cmLinkLineComputer; class cmLocalGenerator; class cmMakefile; class cmOutputConverter; -class cmQtAutoGenInitializer; class cmSourceFile; class cmStateDirectory; class cmake; @@ -354,6 +353,8 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ virtual bool IsMultiConfig() const { return false; } + virtual bool IsXcode() const { return false; } + /** Return true if we know the exact location of object files. If false, store the reason in the given string. This is meaningful only after EnableLanguage has been called. */ @@ -441,9 +442,9 @@ protected: virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const; - // Qt auto generators - std::vector<std::unique_ptr<cmQtAutoGenInitializer>> - CreateQtAutoGenInitializers(); + /// @brief Qt AUTOMOC/UIC/RCC target generation + /// @return true on success + bool QtAutoGen(); std::string SelectMakeProgram(const std::string& makeProgram, const std::string& makeDefault = "") const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 0328991..a9742c5 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -14,13 +14,13 @@ #include "cmVersion.h" const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj"; -const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe"; +const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs"; cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm) : cmGlobalGenerator(cm) , OSDirRelative(false) { - this->GhsBuildCommandInitialized = false; } cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() @@ -41,133 +41,153 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry) "Generates Green Hills MULTI files (experimental, work-in-progress)."; } -void cmGlobalGhsMultiGenerator::EnableLanguage( - std::vector<std::string> const& l, cmMakefile* mf, bool optional) +bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts, + cmMakefile* mf) { - mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); - mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM"); - - const std::string ghsCompRoot(GetCompRoot()); - mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str()); - std::string ghsCompRootStart = - 0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/"; - mf->AddDefinition("CMAKE_C_COMPILER", - std::string(ghsCompRootStart + "ccarm.exe").c_str()); + std::string tsp; /* toolset path */ + std::string tsn = ts; /* toolset name */ + + GetToolset(mf, tsp, tsn); + + /* no toolset was found */ + if (tsn.empty()) { + return false; + } else if (ts.empty()) { + std::string message; + message = + "Green Hills MULTI: -T <toolset> not specified; defaulting to \""; + message += tsn; + message += "\""; + cmSystemTools::Message(message.c_str()); + + /* store the toolset for later use + * -- already done if -T<toolset> was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(), + "Name of generator toolset.", + cmStateEnums::INTERNAL); + } + + /* set the build tool to use */ + const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM"); + std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM); + + /* check if the toolset changed from last generate */ + if (prevTool != NULL && (gbuild != prevTool)) { + std::string message = "generator toolset: "; + message += gbuild; + message += "\nDoes not match the toolset used previously: "; + message += prevTool; + message += "\nEither remove the CMakeCache.txt file and CMakeFiles " + "directory or choose a different binary directory."; + cmSystemTools::Error(message.c_str()); + } else { + /* store the toolset that is being used for this build */ + mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(), + "build program to use", cmStateEnums::INTERNAL, + true); + } + + mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str()); + + // FIXME: compiler detection not implemented + // gbuild uses the primaryTarget setting in the top-level project + // file to determine which compiler to use. Because compiler + // detection is not implemented these variables must be + // set to skip past these tests. However cmake will verify that + // the executable pointed to by CMAKE_<LANG>_COMPILER exists. + // To pass this additional check gbuild is used as a place holder for the + // actual compiler. + mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str()); mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE"); mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE"); - mf->AddDefinition("CMAKE_CXX_COMPILER", - std::string(ghsCompRootStart + "cxarm.exe").c_str()); + mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str()); mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE"); mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS"); mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE"); - if (!ghsCompRoot.empty()) { - static const char* compPreFix = "comp_"; - std::string compFilename = - cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix); - cmsys::SystemTools::ReplaceString(compFilename, compPreFix, ""); - mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str()); - } - - mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files - this->cmGlobalGenerator::EnableLanguage(l, mf, optional); + return true; } -bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf) +bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p, + cmMakefile* mf) { - // The GHS generator knows how to lookup its build tool - // directly instead of needing a helper module to do it, so we - // do not actually need to put CMAKE_MAKE_PROGRAM into the cache. - if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) { - mf->AddDefinition("CMAKE_MAKE_PROGRAM", - this->GetGhsBuildCommand().c_str()); + if (p == "") { + cmSystemTools::Message( + "Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\""); + std::string arch = "arm"; + + /* store the platform name for later use + * -- already done if -A<arch> was specified + */ + mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(), + "Name of generator platform.", + cmStateEnums::INTERNAL); } - return true; -} -std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand() -{ - if (!this->GhsBuildCommandInitialized) { - this->GhsBuildCommandInitialized = true; - this->GhsBuildCommand = this->FindGhsBuildCommand(); + const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM"); + if (tgtPlatform == nullptr) { + tgtPlatform = "integrity"; } - return this->GhsBuildCommand; + + /* store the platform name for later use */ + mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform, + "Name of GHS target platform.", + cmStateEnums::INTERNAL); + + return true; } -std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand() +void cmGlobalGhsMultiGenerator::EnableLanguage( + std::vector<std::string> const& l, cmMakefile* mf, bool optional) { - std::vector<std::string> userPaths; - userPaths.push_back(this->GetCompRoot()); - std::string makeProgram = - cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths); - if (makeProgram.empty()) { - makeProgram = DEFAULT_MAKE_PROGRAM; - } - return makeProgram; + mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI"); + + mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files + this->cmGlobalGenerator::EnableLanguage(l, mf, optional); } -std::string cmGlobalGhsMultiGenerator::GetCompRoot() +bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/) { - std::string output; - - const std::vector<std::string> potentialDirsHardPaths( - GetCompRootHardPaths()); - const std::vector<std::string> potentialDirsRegistry(GetCompRootRegistry()); - - std::vector<std::string> potentialDirsComplete; - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsHardPaths.begin(), - potentialDirsHardPaths.end()); - potentialDirsComplete.insert(potentialDirsComplete.end(), - potentialDirsRegistry.begin(), - potentialDirsRegistry.end()); - - // Use latest version - std::string outputDirName; - for (std::vector<std::string>::const_iterator potentialDirsCompleteIt = - potentialDirsComplete.begin(); - potentialDirsCompleteIt != potentialDirsComplete.end(); - ++potentialDirsCompleteIt) { - const std::string dirName( - cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt)); - if (dirName.compare(outputDirName) > 0) { - output = *potentialDirsCompleteIt; - outputDirName = dirName; - } - } + // The GHS generator only knows how to lookup its build tool + // during generation of the project files, but this + // can only be done after the toolset is specified. - return output; + return true; } -std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootHardPaths() +void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, + std::string& ts) { - std::vector<std::string> output; - cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output); - for (std::vector<std::string>::iterator outputIt = output.begin(); - outputIt != output.end(); ++outputIt) { - *outputIt = "C:/ghs/" + *outputIt; + const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT"); + + if (!ghsRoot) { + ghsRoot = DEFAULT_TOOLSET_ROOT; } - return output; -} + tsd = ghsRoot; -std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootRegistry() -{ - std::vector<std::string> output(2); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftwared771f1b4;InstallLocation", - output[0]); - cmsys::SystemTools::ReadRegistryValue( - "HKEY_LOCAL_" - "MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\" - "Windows\\CurrentVersion\\Uninstall\\" - "GreenHillsSoftware9881cef6;InstallLocation", - output[1]); - return output; + if (ts.empty()) { + std::vector<std::string> output; + + // Use latest? version + cmSystemTools::Glob(tsd, "comp_[^;]+", output); + + if (output.empty()) { + cmSystemTools::Error("GHS toolset not found in ", tsd.c_str()); + ts = ""; + } else { + ts = output.back(); + } + } else { + std::string tryPath = tsd + std::string("/") + ts; + if (!cmSystemTools::FileExists(tryPath)) { + cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ", + tsd.c_str()); + ts = ""; + } + } } void cmGlobalGhsMultiGenerator::OpenBuildFileStream( @@ -216,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream() this->OSDirRelative = true; } - char const* bspName = + std::string bspName; + char const* bspCache = this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME"); - if (NULL == bspName) { - bspName = ""; - cmSystemTools::Error("GHS_BSP_NAME cache variable must be set"); - } else { + if (bspCache) { + bspName = bspCache; this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME"); } - std::string fBspName(this->trimQuotes(bspName)); - std::replace(fBspName.begin(), fBspName.end(), '\\', '/'); + if (bspName.empty() || bspName.compare("IGNORE") == 0) { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + bspName = "sim"; + bspName += (a ? a : ""); + } + this->WriteMacros(); this->WriteHighLevelDirectives(); GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream()); this->WriteDisclaimer(this->GetBuildFileStream()); *this->GetBuildFileStream() << "# Top Level Project File" << std::endl; - if (!fBspName.empty()) { - *this->GetBuildFileStream() << " -bsp " << fBspName << std::endl; - } + *this->GetBuildFileStream() << " -bsp " << bspName << std::endl; + this->WriteCompilerOptions(fOSDir); } @@ -275,8 +298,10 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand( const std::string& targetName, const std::string& /*config*/, bool /*fast*/, int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions) { + const char* gbuild = + this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); makeCommand.push_back( - this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand())); + this->SelectMakeProgram(makeProgram, (std::string)gbuild)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { makeCommand.push_back("-parallel"); @@ -313,8 +338,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros() void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives() { - *this->GetBuildFileStream() - << "primaryTarget=arm_integrity.tgt" << std::endl; + /* set primary target */ + std::string tgt; + const char* t = + this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET"); + if (t) { + tgt = t; + this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET"); + } else { + const char* a = + this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM"); + const char* p = + this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM"); + tgt = (a ? a : ""); + tgt += "_"; + tgt += (p ? p : ""); + tgt += ".tgt"; + } + + *this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl; + char const* const customization = this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION"); if (NULL != customization && strlen(customization) > 0) { @@ -348,16 +391,14 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPath( { std::string workingPath(path); cmSystemTools::ConvertToUnixSlashes(workingPath); - std::vector<cmsys::String> splitPath = - cmSystemTools::SplitString(workingPath); + std::vector<std::string> splitPath = cmSystemTools::SplitString(workingPath); std::string workingRelPath(relPath); cmSystemTools::ConvertToUnixSlashes(workingRelPath); if (!workingRelPath.empty()) { workingRelPath += "/"; } std::string pathUpTo; - for (std::vector<cmsys::String>::const_iterator splitPathI = - splitPath.begin(); + for (std::vector<std::string>::const_iterator splitPathI = splitPath.begin(); splitPath.end() != splitPathI; ++splitPathI) { pathUpTo += *splitPathI; if (targetFolderBuildStreams->end() == @@ -415,11 +456,11 @@ void cmGlobalGhsMultiGenerator::AddFilesUpToPathNewBuildFile( void cmGlobalGhsMultiGenerator::AddFilesUpToPathAppendNextFile( std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams, std::string const& pathUpTo, - std::vector<cmsys::String>::const_iterator splitPathI, - std::vector<cmsys::String>::const_iterator end, + std::vector<std::string>::const_iterator splitPathI, + std::vector<std::string>::const_iterator end, GhsMultiGpj::Types const projType) { - std::vector<cmsys::String>::const_iterator splitPathNextI = splitPathI + 1; + std::vector<std::string>::const_iterator splitPathNextI = splitPathI + 1; if (end != splitPathNextI && targetFolderBuildStreams->end() == targetFolderBuildStreams->find(pathUpTo + "/" + *splitPathNextI)) { @@ -436,7 +477,7 @@ std::string cmGlobalGhsMultiGenerator::GetFileNameFromPath( std::string output(path); if (!path.empty()) { cmSystemTools::ConvertToUnixSlashes(output); - std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(output); + std::vector<std::string> splitPath = cmSystemTools::SplitString(output); output += "/" + splitPath.back() + FILE_EXTENSION; } return output; @@ -457,7 +498,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles( this->GetCMakeInstance()->GetHomeOutputDirectory().c_str(), folderName, GhsMultiGpj::PROJECT); } - std::vector<cmsys::String> splitPath = cmSystemTools::SplitString( + std::vector<std::string> splitPath = cmSystemTools::SplitString( cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt)); std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" + splitPath.back()); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 30d4d3b..13c5113 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -40,13 +40,17 @@ public: * Utilized by the generator factory to determine if this generator * supports toolsets. */ - static bool SupportsToolset() { return false; } + static bool SupportsToolset() { return true; } /** * Utilized by the generator factory to determine if this generator * supports platforms. */ - static bool SupportsPlatform() { return false; } + static bool SupportsPlatform() { return true; } + + // Toolset / Platform Support + virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); + virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf); /** * Try to determine system information such as shared library @@ -93,11 +97,7 @@ protected: std::vector<std::string> const& makeOptions = std::vector<std::string>()); private: - std::string const& GetGhsBuildCommand(); - std::string FindGhsBuildCommand(); - std::string GetCompRoot(); - std::vector<std::string> GetCompRootHardPaths(); - std::vector<std::string> GetCompRootRegistry(); + void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts); void OpenBuildFileStream(); void WriteMacros(); @@ -112,9 +112,8 @@ private: static void AddFilesUpToPathAppendNextFile( std::map<std::string, cmGeneratedFileStream*>* targetFolderBuildStreams, std::string const& pathUpTo, - std::vector<cmsys::String>::const_iterator splitPathI, - std::vector<cmsys::String>::const_iterator end, - GhsMultiGpj::Types projType); + std::vector<std::string>::const_iterator splitPathI, + std::vector<std::string>::const_iterator end, GhsMultiGpj::Types projType); static std::string GetFileNameFromPath(std::string const& path); void UpdateBuildFiles(const std::vector<cmGeneratorTarget*>& tgts); bool IsTgtForBuild(const cmGeneratorTarget* tgt); @@ -125,9 +124,8 @@ private: std::vector<std::string> LibDirs; bool OSDirRelative; - bool GhsBuildCommandInitialized; - std::string GhsBuildCommand; - static const char* DEFAULT_MAKE_PROGRAM; + static const char* DEFAULT_BUILD_PROGRAM; + static const char* DEFAULT_TOOLSET_ROOT; }; #endif diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 6f7e82a..8ba38df 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -763,7 +763,7 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream() // Get a stream where to generate things. if (!this->BuildFileStream) { this->BuildFileStream = new cmGeneratedFileStream( - buildFilePath.c_str(), false, this->GetMakefileEncoding()); + buildFilePath, false, this->GetMakefileEncoding()); if (!this->BuildFileStream) { // An error message is generated by the constructor if it cannot // open the file. @@ -801,7 +801,7 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream() // Get a stream where to generate things. if (!this->RulesFileStream) { this->RulesFileStream = new cmGeneratedFileStream( - rulesFilePath.c_str(), false, this->GetMakefileEncoding()); + rulesFilePath, false, this->GetMakefileEncoding()); if (!this->RulesFileStream) { // An error message is generated by the constructor if it cannot // open the file. @@ -883,8 +883,7 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( } // Get a stream where to generate things. - this->CompileCommandsStream = - new cmGeneratedFileStream(buildFilePath.c_str()); + this->CompileCommandsStream = new cmGeneratedFileStream(buildFilePath); *this->CompileCommandsStream << "["; } else { *this->CompileCommandsStream << "," << std::endl; @@ -1700,7 +1699,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, } { - cmGeneratedFileStream depfile(arg_dep.c_str()); + cmGeneratedFileStream depfile(arg_dep); depfile << cmSystemTools::ConvertToUnixOutputPath(arg_pp) << ":"; for (std::string const& include : info.Includes) { depfile << " \\\n " << cmSystemTools::ConvertToUnixOutputPath(include); @@ -1723,7 +1722,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg, } } - cmGeneratedFileStream ddif(arg_ddi.c_str()); + cmGeneratedFileStream ddif(arg_ddi); ddif << ddi; if (!ddif) { cmSystemTools::Error("-E cmake_ninja_depends failed to write ", @@ -1827,7 +1826,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( } } - cmGeneratedFileStream ddf(arg_dd.c_str()); + cmGeneratedFileStream ddf(arg_dd); ddf << "ninja_dyndep_version = 1.0\n"; for (cmFortranObjectInfo const& object : objects) { @@ -1862,7 +1861,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( // use by dependents that reference this target in linked-target-dirs. std::string const target_mods_file = cmSystemTools::GetFilenamePath(arg_dd) + "/FortranModules.json"; - cmGeneratedFileStream tmf(target_mods_file.c_str()); + cmGeneratedFileStream tmf(target_mods_file); tmf << tm; return true; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 61c42be..db72353 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -147,7 +147,7 @@ void cmGlobalUnixMakefileGenerator3::Generate() markFileName += "/"; markFileName += cmake::GetCMakeFilesDirectory(); markFileName += "/progress.marks"; - cmGeneratedFileStream markFile(markFileName.c_str()); + cmGeneratedFileStream markFile(markFileName); markFile << this->CountProgressMarksInAll(lg) << "\n"; } @@ -170,8 +170,7 @@ void cmGlobalUnixMakefileGenerator3::AddCXXCompileCommand( std::string commandDatabaseName = std::string(this->GetCMakeInstance()->GetHomeOutputDirectory()) + "/compile_commands.json"; - this->CommandDatabase = - new cmGeneratedFileStream(commandDatabaseName.c_str()); + this->CommandDatabase = new cmGeneratedFileStream(commandDatabaseName); *this->CommandDatabase << "[" << std::endl; } else { *this->CommandDatabase << "," << std::endl; @@ -198,7 +197,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() this->GetCMakeInstance()->GetHomeOutputDirectory(); makefileName += cmake::GetCMakeFilesDirectory(); makefileName += "/Makefile2"; - cmGeneratedFileStream makefileStream(makefileName.c_str(), false, + cmGeneratedFileStream makefileStream(makefileName, false, this->GetMakefileEncoding()); if (!makefileStream) { return; @@ -270,7 +269,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() this->GetCMakeInstance()->GetHomeOutputDirectory(); cmakefileName += cmake::GetCMakeFilesDirectory(); cmakefileName += "/Makefile.cmake"; - cmGeneratedFileStream cmakefileStream(cmakefileName.c_str()); + cmGeneratedFileStream cmakefileStream(cmakefileName); if (!cmakefileStream) { return; } @@ -876,7 +875,7 @@ void cmGlobalUnixMakefileGenerator3::RecordTargetProgress( void cmGlobalUnixMakefileGenerator3::TargetProgress::WriteProgressVariables( unsigned long total, unsigned long& current) { - cmGeneratedFileStream fout(this->VariableFile.c_str()); + cmGeneratedFileStream fout(this->VariableFile); for (unsigned long i = 1; i <= this->NumberOfActions; ++i) { fout << "CMAKE_PROGRESS_" << i << " = "; if (total <= 100) { diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 158f484..21121f2 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -397,12 +397,12 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if (written && this->UseFolderProperty()) { const std::string targetFolder = target->GetEffectiveFolderName(); if (!targetFolder.empty()) { - std::vector<cmsys::String> tokens = + std::vector<std::string> tokens = cmSystemTools::SplitString(targetFolder, '/', false); std::string cumulativePath; - for (cmsys::String const& iter : tokens) { + for (std::string const& iter : tokens) { if (!iter.size()) { continue; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e9a08bf..042ce41 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -386,12 +386,46 @@ void cmGlobalXCodeGenerator::AddExtraIDETargets() } } +void cmGlobalXCodeGenerator::ComputeTargetOrder() +{ + size_t index = 0; + auto const& lgens = this->GetLocalGenerators(); + for (cmLocalGenerator* lgen : lgens) { + auto const& targets = lgen->GetGeneratorTargets(); + for (cmGeneratorTarget const* gt : targets) { + this->ComputeTargetOrder(gt, index); + } + } + assert(index == this->TargetOrderIndex.size()); +} + +void cmGlobalXCodeGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt, + size_t& index) +{ + std::map<cmGeneratorTarget const*, size_t>::value_type value(gt, 0); + auto insertion = this->TargetOrderIndex.insert(value); + if (!insertion.second) { + return; + } + auto entry = insertion.first; + + auto& deps = this->GetTargetDirectDepends(gt); + for (auto& d : deps) { + this->ComputeTargetOrder(d, index); + } + + entry->second = index++; +} + void cmGlobalXCodeGenerator::Generate() { this->cmGlobalGenerator::Generate(); if (cmSystemTools::GetErrorOccuredFlag()) { return; } + + this->ComputeTargetOrder(); + for (auto keyVal : this->ProjectMap) { cmLocalGenerator* root = keyVal.second[0]; @@ -1031,15 +1065,17 @@ struct cmSourceFilePathCompare struct cmCompareTargets { - bool operator()(std::string const& a, std::string const& b) const + bool operator()(cmXCodeObject* l, cmXCodeObject* r) const { + std::string const& a = l->GetTarget()->GetName(); + std::string const& b = r->GetTarget()->GetName(); if (a == "ALL_BUILD") { return true; } if (b == "ALL_BUILD") { return false; } - return strcmp(a.c_str(), b.c_str()) < 0; + return a < b; } }; @@ -1047,274 +1083,279 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( cmLocalGenerator* gen, std::vector<cmXCodeObject*>& targets) { this->SetCurrentLocalGenerator(gen); - typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets> - cmSortedTargets; - cmSortedTargets sortedTargets; - for (auto tgt : this->CurrentLocalGenerator->GetGeneratorTargets()) { - sortedTargets[tgt->GetName()] = tgt; + std::vector<cmGeneratorTarget*> gts = + this->CurrentLocalGenerator->GetGeneratorTargets(); + std::sort(gts.begin(), gts.end(), + [this](cmGeneratorTarget const* l, cmGeneratorTarget const* r) { + return this->TargetOrderIndex[l] < this->TargetOrderIndex[r]; + }); + for (auto gtgt : gts) { + if (!this->CreateXCodeTarget(gtgt, targets)) { + return false; + } } - for (auto& sortedTarget : sortedTargets) { - cmGeneratorTarget* gtgt = sortedTarget.second; - - std::string targetName = gtgt->GetName(); + std::sort(targets.begin(), targets.end(), cmCompareTargets()); + return true; +} - // make sure ALL_BUILD, INSTALL, etc are only done once - if (this->SpecialTargetEmitted(targetName)) { - continue; - } +bool cmGlobalXCodeGenerator::CreateXCodeTarget( + cmGeneratorTarget* gtgt, std::vector<cmXCodeObject*>& targets) +{ + std::string targetName = gtgt->GetName(); - if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { - continue; - } + // make sure ALL_BUILD, INSTALL, etc are only done once + if (this->SpecialTargetEmitted(targetName)) { + return true; + } - if (gtgt->GetType() == cmStateEnums::UTILITY || - gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { - cmXCodeObject* t = this->CreateUtilityTarget(gtgt); - if (!t) { - return false; - } - targets.push_back(t); - continue; - } + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { + return true; + } - // organize the sources - std::vector<cmSourceFile*> classes; - if (!gtgt->GetConfigCommonSourceFiles(classes)) { + if (gtgt->GetType() == cmStateEnums::UTILITY || + gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { + cmXCodeObject* t = this->CreateUtilityTarget(gtgt); + if (!t) { return false; } + targets.push_back(t); + return true; + } - // Add CMakeLists.txt file for user convenience. - this->AddXCodeProjBuildRule(gtgt, classes); + // organize the sources + std::vector<cmSourceFile*> classes; + if (!gtgt->GetConfigCommonSourceFiles(classes)) { + return false; + } - std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); + // Add CMakeLists.txt file for user convenience. + this->AddXCodeProjBuildRule(gtgt, classes); - gtgt->ComputeObjectMapping(); + std::sort(classes.begin(), classes.end(), cmSourceFilePathCompare()); - std::vector<cmXCodeObject*> externalObjFiles; - std::vector<cmXCodeObject*> headerFiles; - std::vector<cmXCodeObject*> resourceFiles; - std::vector<cmXCodeObject*> sourceFiles; - for (auto sourceFile : classes) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - cmXCodeObject* fr = xsf->GetObject("fileRef"); - cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); + gtgt->ComputeObjectMapping(); - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); + std::vector<cmXCodeObject*> externalObjFiles; + std::vector<cmXCodeObject*> headerFiles; + std::vector<cmXCodeObject*> resourceFiles; + std::vector<cmXCodeObject*> sourceFiles; + for (auto sourceFile : classes) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + cmXCodeObject* fr = xsf->GetObject("fileRef"); + cmXCodeObject* filetype = fr->GetObject()->GetObject("explicitFileType"); - if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { - if (sourceFile->GetObjectLibrary().empty()) { - externalObjFiles.push_back(xsf); - } - } else if (this->IsHeaderFile(sourceFile) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePrivateHeader) || - (tsFlags.Type == - cmGeneratorTarget::SourceFileTypePublicHeader)) { - headerFiles.push_back(xsf); - } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { - resourceFiles.push_back(xsf); - } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { - // Include this file in the build if it has a known language - // and has not been listed as an ignored extension for this - // generator. - if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) - .empty() && - !this->IgnoreFile(sourceFile->GetExtension().c_str())) { - sourceFiles.push_back(xsf); - } - } - } + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); - if (this->XcodeVersion < 50) { - // Add object library contents as external objects. (Equivalent to - // the externalObjFiles above, except each one is not a cmSourceFile - // within the target.) - std::vector<cmSourceFile const*> objs; - gtgt->GetExternalObjects(objs, ""); - for (auto sourceFile : objs) { - if (sourceFile->GetObjectLibrary().empty()) { - continue; - } - std::string const& obj = sourceFile->GetFullPath(); - cmXCodeObject* xsf = - this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + if (filetype && filetype->GetString() == "compiled.mach-o.objfile") { + if (sourceFile->GetObjectLibrary().empty()) { externalObjFiles.push_back(xsf); } - } - - // some build phases only apply to bundles and/or frameworks - bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); - bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); - bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); - - cmXCodeObject* buildFiles = nullptr; - - // create source build phase - cmXCodeObject* sourceBuildPhase = nullptr; - if (!sourceFiles.empty()) { - sourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); - sourceBuildPhase->SetComment("Sources"); - sourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& sourceFile : sourceFiles) { - buildFiles->AddObject(sourceFile); + } else if (this->IsHeaderFile(sourceFile) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePrivateHeader) || + (tsFlags.Type == + cmGeneratorTarget::SourceFileTypePublicHeader)) { + headerFiles.push_back(xsf); + } else if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeResource) { + resourceFiles.push_back(xsf); + } else if (!sourceFile->GetPropertyAsBool("HEADER_FILE_ONLY")) { + // Include this file in the build if it has a known language + // and has not been listed as an ignored extension for this + // generator. + if (!this->CurrentLocalGenerator->GetSourceFileLanguage(*sourceFile) + .empty() && + !this->IgnoreFile(sourceFile->GetExtension().c_str())) { + sourceFiles.push_back(xsf); } - sourceBuildPhase->AddAttribute("files", buildFiles); - sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); } + } - // create header build phase - only for framework targets - cmXCodeObject* headerBuildPhase = nullptr; - if (!headerFiles.empty() && isFrameworkTarget) { - headerBuildPhase = - this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); - headerBuildPhase->SetComment("Headers"); - headerBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& headerFile : headerFiles) { - buildFiles->AddObject(headerFile); + if (this->XcodeVersion < 50) { + // Add object library contents as external objects. (Equivalent to + // the externalObjFiles above, except each one is not a cmSourceFile + // within the target.) + std::vector<cmSourceFile const*> objs; + gtgt->GetExternalObjects(objs, ""); + for (auto sourceFile : objs) { + if (sourceFile->GetObjectLibrary().empty()) { + continue; } - headerBuildPhase->AddAttribute("files", buildFiles); - headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + std::string const& obj = sourceFile->GetFullPath(); + cmXCodeObject* xsf = + this->CreateXCodeSourceFileFromPath(obj, gtgt, "", nullptr); + externalObjFiles.push_back(xsf); + } + } + + // some build phases only apply to bundles and/or frameworks + bool isFrameworkTarget = gtgt->IsFrameworkOnApple(); + bool isBundleTarget = gtgt->GetPropertyAsBool("MACOSX_BUNDLE"); + bool isCFBundleTarget = gtgt->IsCFBundleOnApple(); + + cmXCodeObject* buildFiles = nullptr; + + // create source build phase + cmXCodeObject* sourceBuildPhase = nullptr; + if (!sourceFiles.empty()) { + sourceBuildPhase = this->CreateObject(cmXCodeObject::PBXSourcesBuildPhase); + sourceBuildPhase->SetComment("Sources"); + sourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& sourceFile : sourceFiles) { + buildFiles->AddObject(sourceFile); + } + sourceBuildPhase->AddAttribute("files", buildFiles); + sourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create header build phase - only for framework targets + cmXCodeObject* headerBuildPhase = nullptr; + if (!headerFiles.empty() && isFrameworkTarget) { + headerBuildPhase = this->CreateObject(cmXCodeObject::PBXHeadersBuildPhase); + headerBuildPhase->SetComment("Headers"); + headerBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& headerFile : headerFiles) { + buildFiles->AddObject(headerFile); + } + headerBuildPhase->AddAttribute("files", buildFiles); + headerBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } + + // create resource build phase - only for framework or bundle targets + cmXCodeObject* resourceBuildPhase = nullptr; + if (!resourceFiles.empty() && + (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { + resourceBuildPhase = + this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); + resourceBuildPhase->SetComment("Resources"); + resourceBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + for (auto& resourceFile : resourceFiles) { + buildFiles->AddObject(resourceFile); } + resourceBuildPhase->AddAttribute("files", buildFiles); + resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create resource build phase - only for framework or bundle targets - cmXCodeObject* resourceBuildPhase = nullptr; - if (!resourceFiles.empty() && - (isFrameworkTarget || isBundleTarget || isCFBundleTarget)) { - resourceBuildPhase = - this->CreateObject(cmXCodeObject::PBXResourcesBuildPhase); - resourceBuildPhase->SetComment("Resources"); - resourceBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - for (auto& resourceFile : resourceFiles) { - buildFiles->AddObject(resourceFile); - } - resourceBuildPhase->AddAttribute("files", buildFiles); - resourceBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - } - - // create vector of "non-resource content file" build phases - only for - // framework or bundle targets - std::vector<cmXCodeObject*> contentBuildPhases; - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map<std::string, std::vector<cmSourceFile*>> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } + // create vector of "non-resource content file" build phases - only for + // framework or bundle targets + std::vector<cmXCodeObject*> contentBuildPhases; + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*>> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeMacContent) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("6")); - std::ostringstream ostr; - if (gtgt->IsFrameworkOnApple()) { - // dstPath in frameworks is relative to Versions/<version> + } + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("6")); + std::ostringstream ostr; + if (gtgt->IsFrameworkOnApple()) { + // dstPath in frameworks is relative to Versions/<version> + ostr << keySources.first; + } else if (keySources.first != "MacOS") { + if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { ostr << keySources.first; - } else if (keySources.first != "MacOS") { - if (gtgt->Target->GetMakefile()->PlatformIsAppleEmbedded()) { - ostr << keySources.first; - } else { - // dstPath in bundles is relative to Contents/MacOS - ostr << "../" << keySources.first; - } - } - copyFilesBuildPhase->AddAttribute("dstPath", - this->CreateString(ostr.str())); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); + } else { + // dstPath in bundles is relative to Contents/MacOS + ostr << "../" << keySources.first; } - contentBuildPhases.push_back(copyFilesBuildPhase); } + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(ostr.str())); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); + } + contentBuildPhases.push_back(copyFilesBuildPhase); } + } - // create vector of "resource content file" build phases - only for - // framework or bundle targets - if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { - typedef std::map<std::string, std::vector<cmSourceFile*>> - mapOfVectorOfSourceFiles; - mapOfVectorOfSourceFiles bundleFiles; - for (auto sourceFile : classes) { - cmGeneratorTarget::SourceFileFlags tsFlags = - gtgt->GetTargetSourceFileFlags(sourceFile); - if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { - bundleFiles[tsFlags.MacFolder].push_back(sourceFile); - } - } - for (auto keySources : bundleFiles) { - cmXCodeObject* copyFilesBuildPhase = - this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); - copyFilesBuildPhase->SetComment("Copy files"); - copyFilesBuildPhase->AddAttribute("buildActionMask", - this->CreateString("2147483647")); - copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", - this->CreateString("7")); - copyFilesBuildPhase->AddAttribute( - "dstPath", this->CreateString(keySources.first)); - copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); - buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - copyFilesBuildPhase->AddAttribute("files", buildFiles); - for (auto sourceFile : keySources.second) { - cmXCodeObject* xsf = this->CreateXCodeSourceFile( - this->CurrentLocalGenerator, sourceFile, gtgt); - buildFiles->AddObject(xsf); - } - contentBuildPhases.push_back(copyFilesBuildPhase); + // create vector of "resource content file" build phases - only for + // framework or bundle targets + if (isFrameworkTarget || isBundleTarget || isCFBundleTarget) { + typedef std::map<std::string, std::vector<cmSourceFile*>> + mapOfVectorOfSourceFiles; + mapOfVectorOfSourceFiles bundleFiles; + for (auto sourceFile : classes) { + cmGeneratorTarget::SourceFileFlags tsFlags = + gtgt->GetTargetSourceFileFlags(sourceFile); + if (tsFlags.Type == cmGeneratorTarget::SourceFileTypeDeepResource) { + bundleFiles[tsFlags.MacFolder].push_back(sourceFile); } } - - // create framework build phase - cmXCodeObject* frameworkBuildPhase = nullptr; - if (!externalObjFiles.empty()) { - frameworkBuildPhase = - this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); - frameworkBuildPhase->SetComment("Frameworks"); - frameworkBuildPhase->AddAttribute("buildActionMask", + for (auto keySources : bundleFiles) { + cmXCodeObject* copyFilesBuildPhase = + this->CreateObject(cmXCodeObject::PBXCopyFilesBuildPhase); + copyFilesBuildPhase->SetComment("Copy files"); + copyFilesBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); + copyFilesBuildPhase->AddAttribute("dstSubfolderSpec", + this->CreateString("7")); + copyFilesBuildPhase->AddAttribute("dstPath", + this->CreateString(keySources.first)); + copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); - frameworkBuildPhase->AddAttribute("files", buildFiles); - for (auto& externalObjFile : externalObjFiles) { - buildFiles->AddObject(externalObjFile); + copyFilesBuildPhase->AddAttribute("files", buildFiles); + for (auto sourceFile : keySources.second) { + cmXCodeObject* xsf = this->CreateXCodeSourceFile( + this->CurrentLocalGenerator, sourceFile, gtgt); + buildFiles->AddObject(xsf); } - frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", - this->CreateString("0")); + contentBuildPhases.push_back(copyFilesBuildPhase); + } + } + + // create framework build phase + cmXCodeObject* frameworkBuildPhase = nullptr; + if (!externalObjFiles.empty()) { + frameworkBuildPhase = + this->CreateObject(cmXCodeObject::PBXFrameworksBuildPhase); + frameworkBuildPhase->SetComment("Frameworks"); + frameworkBuildPhase->AddAttribute("buildActionMask", + this->CreateString("2147483647")); + buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); + frameworkBuildPhase->AddAttribute("files", buildFiles); + for (auto& externalObjFile : externalObjFiles) { + buildFiles->AddObject(externalObjFile); } + frameworkBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing", + this->CreateString("0")); + } - // create list of build phases and create the Xcode target - cmXCodeObject* buildPhases = - this->CreateObject(cmXCodeObject::OBJECT_LIST); + // create list of build phases and create the Xcode target + cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); - this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, - resourceBuildPhase, contentBuildPhases, - frameworkBuildPhase, gtgt); + this->CreateCustomCommands(buildPhases, sourceBuildPhase, headerBuildPhase, + resourceBuildPhase, contentBuildPhases, + frameworkBuildPhase, gtgt); - targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); - } + targets.push_back(this->CreateXCodeTarget(gtgt, buildPhases)); return true; } @@ -1817,6 +1858,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CurrentLocalGenerator->AppendFlags(extraLinkOptions, linkFlags); } } + std::vector<std::string> opts; + gtgt->GetLinkOptions(opts, configName, llang); + // LINK_OPTIONS are escaped. + this->CurrentLocalGenerator->AppendCompileOptions(extraLinkOptions, opts); } // Set target-specific architectures. @@ -3315,13 +3360,6 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( if (generators.empty()) { return; } - // Skip local generators that are excluded from this project. - for (auto generator : generators) { - if (this->IsExcluded(root, generator)) { - continue; - } - } - if (!this->CreateXCodeObjects(root, generators)) { return; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ccef6e2..62f7030 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -96,6 +96,8 @@ public: i.e. "Can I build Debug and Release in the same tree?" */ bool IsMultiConfig() const override; + bool IsXcode() const override { return true; } + bool HasKnownObjectFileLocation(std::string* reason) const override; bool IsIPOSupported() const override { return true; } @@ -109,6 +111,8 @@ public: protected: void AddExtraIDETargets() override; + void ComputeTargetOrder(); + void ComputeTargetOrder(cmGeneratorTarget const* gt, size_t& index); void Generate() override; private: @@ -204,6 +208,8 @@ private: void AddXCodeProjBuildRule(cmGeneratorTarget* target, std::vector<cmSourceFile*>& sources) const; bool CreateXCodeTargets(cmLocalGenerator* gen, std::vector<cmXCodeObject*>&); + bool CreateXCodeTarget(cmGeneratorTarget* gtgt, + std::vector<cmXCodeObject*>&); bool IsHeaderFile(cmSourceFile*); void AddDependTarget(cmXCodeObject* target, cmXCodeObject* dependTarget); void CreateXCodeDependHackTarget(std::vector<cmXCodeObject*>& targets); @@ -286,6 +292,7 @@ private: std::string ObjectDirArchDefault; std::string ObjectDirArch; std::string GeneratorToolset; + std::map<cmGeneratorTarget const*, size_t> TargetOrderIndex; }; #endif diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 1bbfbe0..fcdf03f 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -257,7 +257,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) currentFilename += ptr.first; currentFilename += ".dependers"; - cmGeneratedFileStream str(currentFilename.c_str()); + cmGeneratedFileStream str(currentFilename); if (!str) { return; } @@ -300,7 +300,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) std::string currentFilename = fileName; currentFilename += "."; currentFilename += ptr.first; - cmGeneratedFileStream str(currentFilename.c_str()); + cmGeneratedFileStream str(currentFilename); if (!str) { return; } diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 8deb8c1..4e29f39 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmHexFileConverter.h" +#include <ctype.h> #include <stdio.h> #include <string.h> @@ -12,13 +13,6 @@ #define MOTOROLA_SREC_MIN_LINE_LENGTH (2 + 2 + 4 + 2) #define MOTOROLA_SREC_MAX_LINE_LENGTH (2 + 2 + 8 + (256 * 2) + 2) -// might go to SystemTools ? -static bool cm_IsHexChar(char c) -{ - return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F'))); -} - static unsigned int ChompStrlen(const char* line) { if (line == nullptr) { @@ -169,7 +163,7 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( } for (unsigned int i = 1; i < slen; i++) { - if (!cm_IsHexChar(buf[i])) { + if (!isxdigit(buf[i])) { return Binary; } } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 87dcb18..99409c2 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -362,7 +362,12 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) return false; } // Lookup this target in the current directory. - if (cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt)) { + cmTarget* target = this->Makefile->FindLocalNonAliasTarget(tgt); + if (!target) { + // If no local target has been found, find it in the global scope. + target = this->Makefile->GetGlobalGenerator()->FindTarget(tgt, true); + } + if (target) { // Found the target. Check its type. if (target->GetType() != cmStateEnums::EXECUTABLE && target->GetType() != cmStateEnums::STATIC_LIBRARY && @@ -381,8 +386,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) } else { // Did not find the target. std::ostringstream e; - e << "TARGETS given target \"" << tgt - << "\" which does not exist in this directory."; + e << "TARGETS given target \"" << tgt << "\" which does not exist."; this->SetError(e.str()); return false; } diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index f7e6e44..3a90f4c 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallScriptGenerator.h" +#include "cmGeneratorExpression.h" #include "cmScriptGenerator.h" #include <ostream> @@ -16,24 +17,47 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, , Script(script) , Code(code) { + // We need per-config actions if the script has generator expressions. + if (cmGeneratorExpression::Find(Script) != std::string::npos) { + this->ActionsPerConfig = true; + } } cmInstallScriptGenerator::~cmInstallScriptGenerator() { } -void cmInstallScriptGenerator::GenerateScript(std::ostream& os) +void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) { - Indent indent; - std::string component_test = - this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); - os << indent << "if(" << component_test << ")\n"; + this->LocalGenerator = lg; +} +void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, + Indent indent, + std::string const& script) +{ if (this->Code) { - os << indent.Next() << this->Script << "\n"; + os << indent.Next() << script << "\n"; + } else { + os << indent.Next() << "include(\"" << script << "\")\n"; + } +} + +void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, + Indent indent) +{ + if (this->ActionsPerConfig) { + this->cmInstallGenerator::GenerateScriptActions(os, indent); } else { - os << indent.Next() << "include(\"" << this->Script << "\")\n"; + this->AddScriptInstallRule(os, indent, this->Script); } +} - os << indent << "endif()\n\n"; +void cmInstallScriptGenerator::GenerateScriptForConfig( + std::ostream& os, const std::string& config, Indent indent) +{ + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script); + this->AddScriptInstallRule(os, indent, + cge->Evaluate(this->LocalGenerator, config)); } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index fe0f7c6..534bc1d 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -6,10 +6,13 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmInstallGenerator.h" +#include "cmScriptGenerator.h" #include <iosfwd> #include <string> +class cmLocalGenerator; + /** \class cmInstallScriptGenerator * \brief Generate target installation rules. */ @@ -20,10 +23,18 @@ public: const char* component, bool exclude_from_all); ~cmInstallScriptGenerator() override; + void Compute(cmLocalGenerator* lg) override; + protected: - void GenerateScript(std::ostream& os) override; + void GenerateScriptActions(std::ostream& os, Indent indent) override; + void GenerateScriptForConfig(std::ostream& os, const std::string& config, + Indent indent) override; + void AddScriptInstallRule(std::ostream& os, Indent indent, + std::string const& script); + std::string Script; bool Code; + cmLocalGenerator* LocalGenerator; }; #endif diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index e0afa2d..8b8f79b 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -440,7 +440,13 @@ std::string cmInstallTargetGenerator::GetInstallFilename( void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) { + // Lookup this target in the current directory. this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName); + if (!this->Target) { + // If no local target has been found, find it in the global scope. + this->Target = + lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName); + } } void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 557fa41..c9bbde1 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -3,7 +3,9 @@ #include "cmLinkLineDeviceComputer.h" +#include <set> #include <sstream> +#include <utility> #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" @@ -28,6 +30,12 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( { // Write the library flags to the build rule. std::ostringstream fout; + + // Generate the unique set of link items when device linking. + // The nvcc device linker is designed so that each static library + // with device symbols only needs to be listed once as it doesn't + // care about link order. + std::set<std::string> emitted; typedef cmComputeLinkInformation::ItemVector ItemVector; ItemVector const& items = cli.GetItems(); std::string config = cli.GetConfig(); @@ -50,20 +58,24 @@ std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( } } + std::string out; if (item.IsPath) { // nvcc understands absolute paths to libraries ending in '.a' should // be passed to nvlink. Other extensions like '.so' or '.dylib' are // rejected by the nvcc front-end even though nvlink knows to ignore // them. Bypass the front-end via '-Xnvlink'. if (!cmHasLiteralSuffix(item.Value, ".a")) { - fout << "-Xnvlink "; + out += "-Xnvlink "; } - fout << this->ConvertToOutputFormat( - this->ConvertToLinkReference(item.Value)); + out += + this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value)); } else { - fout << item.Value; + out += item.Value; + } + + if (emitted.insert(out).second) { + fout << out << " "; } - fout << " "; } if (!stdLibString.empty()) { diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 1ac2cc2..d7de2fa 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -289,12 +289,10 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) if (item < 0) { item = static_cast<int>(nitem) + item; } - if (item < 0 || nitem <= static_cast<size_t>(item)) { + if (item < 0 || nitem < static_cast<size_t>(item)) { std::ostringstream str; str << "index: " << item << " out of range (-" << varArgsExpanded.size() - << ", " - << (varArgsExpanded.empty() ? 0 : (varArgsExpanded.size() - 1)) - << ")"; + << ", " << varArgsExpanded.size() << ")"; this->SetError(str.str()); return false; } @@ -963,14 +961,193 @@ bool cmListCommand::HandleTransformCommand( return true; } +class cmStringSorter +{ +public: + enum class Order + { + UNINITIALIZED, + ASCENDING, + DESCENDING, + }; + + enum class Compare + { + UNINITIALIZED, + STRING, + FILE_BASENAME, + }; + enum class CaseSensitivity + { + UNINITIALIZED, + SENSITIVE, + INSENSITIVE, + }; + +protected: + typedef std::string (*StringFilter)(const std::string& in); + StringFilter GetCompareFilter(Compare compare) + { + return (compare == Compare::FILE_BASENAME) ? cmSystemTools::GetFilenameName + : nullptr; + } + + StringFilter GetCaseFilter(CaseSensitivity sensitivity) + { + return (sensitivity == CaseSensitivity::INSENSITIVE) + ? cmSystemTools::LowerCase + : nullptr; + } + +public: + cmStringSorter(Compare compare, CaseSensitivity caseSensitivity, + Order desc = Order::ASCENDING) + : filters{ GetCompareFilter(compare), GetCaseFilter(caseSensitivity) } + , descending(desc == Order::DESCENDING) + { + } + + std::string ApplyFilter(const std::string& argument) + { + std::string result = argument; + for (auto filter : filters) { + if (filter != nullptr) { + result = filter(result); + } + } + return result; + } + + bool operator()(const std::string& a, const std::string& b) + { + std::string af = ApplyFilter(a); + std::string bf = ApplyFilter(b); + bool result; + if (descending) { + result = bf < af; + } else { + result = af < bf; + } + return result; + } + +protected: + StringFilter filters[2] = { nullptr, nullptr }; + bool descending; +}; + bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args) { assert(args.size() >= 2); - if (args.size() > 2) { - this->SetError("sub-command SORT only takes one argument."); + if (args.size() > 8) { + this->SetError("sub-command SORT only takes up to six arguments."); return false; } + auto sortCompare = cmStringSorter::Compare::UNINITIALIZED; + auto sortCaseSensitivity = cmStringSorter::CaseSensitivity::UNINITIALIZED; + auto sortOrder = cmStringSorter::Order::UNINITIALIZED; + + size_t argumentIndex = 2; + const std::string messageHint = "sub-command SORT "; + + while (argumentIndex < args.size()) { + const std::string option = args[argumentIndex++]; + if (option == "COMPARE") { + if (sortCompare != cmStringSorter::Compare::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "STRING") { + sortCompare = cmStringSorter::Compare::STRING; + } else if (argument == "FILE_BASENAME") { + sortCompare = cmStringSorter::Compare::FILE_BASENAME; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else if (option == "CASE") { + if (sortCaseSensitivity != + cmStringSorter::CaseSensitivity::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "SENSITIVE") { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE; + } else if (argument == "INSENSITIVE") { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::INSENSITIVE; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else if (option == "ORDER") { + + if (sortOrder != cmStringSorter::Order::UNINITIALIZED) { + std::string error = messageHint + "option \"" + option + + "\" has been specified multiple times."; + this->SetError(error); + return false; + } + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "ASCENDING") { + sortOrder = cmStringSorter::Order::ASCENDING; + } else if (argument == "DESCENDING") { + sortOrder = cmStringSorter::Order::DESCENDING; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "option \"" + option + "\" is unknown."; + this->SetError(error); + return false; + } + } + // set Default Values if Option is not given + if (sortCompare == cmStringSorter::Compare::UNINITIALIZED) { + sortCompare = cmStringSorter::Compare::STRING; + } + if (sortCaseSensitivity == cmStringSorter::CaseSensitivity::UNINITIALIZED) { + sortCaseSensitivity = cmStringSorter::CaseSensitivity::SENSITIVE; + } + if (sortOrder == cmStringSorter::Order::UNINITIALIZED) { + sortOrder = cmStringSorter::Order::ASCENDING; + } + const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; @@ -979,7 +1156,14 @@ bool cmListCommand::HandleSortCommand(std::vector<std::string> const& args) return false; } - std::sort(varArgsExpanded.begin(), varArgsExpanded.end()); + if ((sortCompare == cmStringSorter::Compare::STRING) && + (sortCaseSensitivity == cmStringSorter::CaseSensitivity::SENSITIVE) && + (sortOrder == cmStringSorter::Order::ASCENDING)) { + std::sort(varArgsExpanded.begin(), varArgsExpanded.end()); + } else { + cmStringSorter sorter(sortCompare, sortCaseSensitivity, sortOrder); + std::sort(varArgsExpanded.begin(), varArgsExpanded.end(), sorter); + } std::string value = cmJoin(varArgsExpanded, ";"); this->Makefile->AddDefinition(listName, value.c_str()); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index a3f4a8f..d265cab 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -253,7 +253,7 @@ void cmLocalGenerator::GenerateTestFiles() file += "/"; file += "CTestTestfile.cmake"; - cmGeneratedFileStream fout(file.c_str()); + cmGeneratedFileStream fout(file); fout.SetCopyIfDifferent(true); fout << "# CMake generated Testfile for " << std::endl @@ -429,7 +429,7 @@ void cmLocalGenerator::GenerateInstallRules() toplevel_install = 1; } file += "/cmake_install.cmake"; - cmGeneratedFileStream fout(file.c_str()); + cmGeneratedFileStream fout(file); fout.SetCopyIfDifferent(true); // Write the header. @@ -844,12 +844,11 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, cmGeneratorTarget const* target, const std::string& lang, const std::string& config, - bool stripImplicitInclDirs) const + bool stripImplicitDirs, + bool appendAllImplicitDirs) const { - // Need to decide whether to automatically include the source and - // binary directories at the beginning of the include path. - bool includeSourceDir = false; - bool includeBinaryDir = false; + // Do not repeat an include path. + std::set<std::string> emitted; // When automatic include directories are requested for a build then // include the source and binary directories at the beginning of the @@ -859,26 +858,21 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, // cannot fix this because not all native build tools support // per-source-file include paths. if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR")) { - includeSourceDir = true; - includeBinaryDir = true; - } - - // Do not repeat an include path. - std::set<std::string> emitted; - - // Store the automatic include paths. - if (includeBinaryDir) { - std::string binDir = this->StateSnapshot.GetDirectory().GetCurrentBinary(); - if (emitted.find(binDir) == emitted.end()) { - dirs.push_back(binDir); - emitted.insert(binDir); + // Current binary directory + { + std::string binDir = + this->StateSnapshot.GetDirectory().GetCurrentBinary(); + if (emitted.insert(binDir).second) { + dirs.push_back(std::move(binDir)); + } } - } - if (includeSourceDir) { - std::string srcDir = this->StateSnapshot.GetDirectory().GetCurrentSource(); - if (emitted.find(srcDir) == emitted.end()) { - dirs.push_back(srcDir); - emitted.insert(srcDir); + // Current source directory + { + std::string srcDir = + this->StateSnapshot.GetDirectory().GetCurrentSource(); + if (emitted.insert(srcDir).second) { + dirs.push_back(std::move(srcDir)); + } } } @@ -886,43 +880,45 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, return; } - std::string rootPath; - if (const char* sysrootCompile = - this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { - rootPath = sysrootCompile; - } else { - rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); - } - + // Implicit include directories std::vector<std::string> implicitDirs; - // Load implicit include directories for this language. - std::string impDirVar = "CMAKE_"; - impDirVar += lang; - impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; - if (const char* value = this->Makefile->GetDefinition(impDirVar)) { - std::vector<std::string> impDirVec; - cmSystemTools::ExpandListArgument(value, impDirVec); - for (std::string const& i : impDirVec) { - std::string d = rootPath + i; - cmSystemTools::ConvertToUnixSlashes(d); - emitted.insert(std::move(d)); - if (!stripImplicitInclDirs) { + { + std::string rootPath; + if (const char* sysrootCompile = + this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { + rootPath = sysrootCompile; + } else { + rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); + } + + // Load implicit include directories for this language. + std::string key = "CMAKE_"; + key += lang; + key += "_IMPLICIT_INCLUDE_DIRECTORIES"; + if (const char* value = this->Makefile->GetDefinition(key)) { + std::vector<std::string> impDirVec; + cmSystemTools::ExpandListArgument(value, impDirVec); + for (std::string const& i : impDirVec) { + { + std::string d = rootPath + i; + cmSystemTools::ConvertToUnixSlashes(d); + emitted.insert(std::move(d)); + } implicitDirs.push_back(i); } } } // Get the target-specific include directories. - std::vector<std::string> includes; - - includes = target->GetIncludeDirectories(config, lang); + std::vector<std::string> userDirs = + target->GetIncludeDirectories(config, lang); // Support putting all the in-project include directories first if // it is requested by the project. if (this->Makefile->IsOn("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")) { std::string const &topSourceDir = this->GetState()->GetSourceDirectory(), &topBinaryDir = this->GetState()->GetBinaryDirectory(); - for (std::string const& i : includes) { + for (std::string const& i : userDirs) { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. if (cmSystemTools::ComparePath(i, topSourceDir) || @@ -937,7 +933,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, } // Construct the final ordered include directory list. - for (std::string const& i : includes) { + for (std::string const& i : userDirs) { if (emitted.insert(i).second) { dirs.push_back(i); } @@ -946,22 +942,37 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, this->MoveSystemIncludesToEnd(dirs, config, lang, target); // Add standard include directories for this language. - // We do not filter out implicit directories here. - std::string const standardIncludesVar = - "CMAKE_" + lang + "_STANDARD_INCLUDE_DIRECTORIES"; - std::string const standardIncludes = - this->Makefile->GetSafeDefinition(standardIncludesVar); - std::vector<std::string>::size_type const before = includes.size(); - cmSystemTools::ExpandListArgument(standardIncludes, includes); - for (std::vector<std::string>::iterator i = includes.begin() + before; - i != includes.end(); ++i) { - cmSystemTools::ConvertToUnixSlashes(*i); - dirs.push_back(*i); - } - - for (std::string const& i : implicitDirs) { - if (std::find(includes.begin(), includes.end(), i) != includes.end()) { - dirs.push_back(i); + { + std::vector<std::string>::size_type const before = userDirs.size(); + { + std::string key = "CMAKE_"; + key += lang; + key += "_STANDARD_INCLUDE_DIRECTORIES"; + std::string const value = this->Makefile->GetSafeDefinition(key); + cmSystemTools::ExpandListArgument(value, userDirs); + } + for (std::vector<std::string>::iterator i = userDirs.begin() + before, + ie = userDirs.end(); + i != ie; ++i) { + cmSystemTools::ConvertToUnixSlashes(*i); + dirs.push_back(*i); + } + } + + if (!stripImplicitDirs) { + // Append only implicit directories that were requested by the user + for (std::string const& i : implicitDirs) { + if (std::find(userDirs.begin(), userDirs.end(), i) != userDirs.end()) { + dirs.push_back(i); + } + } + // Append remaining implicit directories on demand + if (appendAllImplicitDirs) { + for (std::string const& i : implicitDirs) { + if (std::find(dirs.begin(), dirs.end(), i) == dirs.end()) { + dirs.push_back(i); + } + } } } } @@ -1042,6 +1053,10 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; + target->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(linkFlags, opts); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1113,6 +1128,10 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += " "; } } + std::vector<std::string> opts; + target->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(linkFlags, opts); } break; default: break; @@ -1952,7 +1971,7 @@ void cmLocalGenerator::AppendCompileOptions( cmsys::RegularExpression r(regex); for (std::string const& opt : options_vec) { - if (r.find(opt.c_str())) { + if (r.find(opt)) { this->AppendFlagEscape(options, opt); } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 9ba62cc..52f0396 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -237,12 +237,18 @@ public: return true; } - /** Get the include flags for the current makefile and language. */ + /** @brief Get the include directories for the current makefile and language. + * @arg stripImplicitDirs Strip all directories found in + * CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES from the result. + * @arg appendAllImplicitDirs Append all directories found in + * CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to the result. + */ void GetIncludeDirectories(std::vector<std::string>& dirs, cmGeneratorTarget const* target, const std::string& lang = "C", const std::string& config = "", - bool stripImplicitInclDirs = true) const; + bool stripImplicitDirs = true, + bool appendAllImplicitDirs = false) const; void AddCompileOptions(std::string& flags, cmGeneratorTarget* target, const std::string& lang, const std::string& config); void AddCompileDefinitions(std::set<std::string>& defines, diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9fd2ddb..bc83ce2 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -211,8 +211,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile() // rules may depend on this file itself. std::string ruleFileNameFull = this->ConvertToFullPath(ruleFileName); cmGeneratedFileStream ruleFileStream( - ruleFileNameFull.c_str(), false, - this->GlobalGenerator->GetMakefileEncoding()); + ruleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); if (!ruleFileStream) { return; } @@ -433,7 +432,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() infoFileName += "/CMakeDirectoryInformation.cmake"; // Open the output file. - cmGeneratedFileStream infoFileStream(infoFileName.c_str()); + cmGeneratedFileStream infoFileStream(infoFileName); if (!infoFileStream) { return; } @@ -1403,8 +1402,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( std::string ruleFileNameFull = dir; ruleFileNameFull += "/depend.make"; cmGeneratedFileStream ruleFileStream( - ruleFileNameFull.c_str(), false, - this->GlobalGenerator->GetMakefileEncoding()); + ruleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); ruleFileStream.SetCopyIfDifferent(true); if (!ruleFileStream) { return false; @@ -1416,7 +1414,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies( std::string internalRuleFileNameFull = dir; internalRuleFileNameFull += "/depend.internal"; cmGeneratedFileStream internalRuleFileStream( - internalRuleFileNameFull.c_str(), false, + internalRuleFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); if (!internalRuleFileStream) { return false; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 3460289..c90c5b8 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -977,6 +977,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( extraLinkOptions += " "; extraLinkOptions += targetLinkFlags; } + + std::vector<std::string> opts; + target->GetLinkOptions(opts, configName, + target->GetLinkerLanguage(configName)); + // LINK_OPTIONS are escaped. + this->AppendCompileOptions(extraLinkOptions, opts); + Options linkOptions(this, Options::Linker); if (this->FortranProject) { linkOptions.AddTable(cmLocalVisualStudio7GeneratorFortranLinkFlagTable); @@ -1226,30 +1233,56 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } } +static std::string cmLocalVisualStudio7GeneratorEscapeForXML( + const std::string& s) +{ + std::string ret = s; + cmSystemTools::ReplaceString(ret, "&", "&"); + cmSystemTools::ReplaceString(ret, "\"", """); + cmSystemTools::ReplaceString(ret, "<", "<"); + cmSystemTools::ReplaceString(ret, ">", ">"); + cmSystemTools::ReplaceString(ret, "\n", "
"); + return ret; +} + +static std::string GetEscapedPropertyIfValueNotNULL(const char* propertyValue) +{ + return propertyValue == nullptr + ? std::string() + : cmLocalVisualStudio7GeneratorEscapeForXML(propertyValue); +} + void cmLocalVisualStudio7Generator::OutputDeploymentDebuggerTool( std::ostream& fout, std::string const& config, cmGeneratorTarget* target) { if (this->WindowsCEProject) { - if (const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY")) { - /* clang-format off */ - fout << - "\t\t\t<DeploymentTool\n" - "\t\t\t\tForceDirty=\"-1\"\n" - "\t\t\t\tRemoteDirectory=\"" << this->EscapeForXML(dir) << "\"\n" - "\t\t\t\tRegisterOutput=\"0\"\n" - "\t\t\t\tAdditionalFiles=\"\"/>\n" - ; - /* clang-format on */ + const char* dir = target->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY"); + const char* additionalFiles = + target->GetProperty("DEPLOYMENT_ADDITIONAL_FILES"); + + if (dir == nullptr && additionalFiles == nullptr) { + return; + } + + fout << "\t\t\t<DeploymentTool\n" + "\t\t\t\tForceDirty=\"-1\"\n" + "\t\t\t\tRemoteDirectory=\"" + << GetEscapedPropertyIfValueNotNULL(dir) + << "\"\n" + "\t\t\t\tRegisterOutput=\"0\"\n" + "\t\t\t\tAdditionalFiles=\"" + << GetEscapedPropertyIfValueNotNULL(additionalFiles) << "\"/>\n"; + + if (dir != nullptr) { std::string const exe = dir + std::string("\\") + target->GetFullName(config); - /* clang-format off */ - fout << - "\t\t\t<DebuggerTool\n" - "\t\t\t\tRemoteExecutable=\"" << this->EscapeForXML(exe) << "\"\n" - "\t\t\t\tArguments=\"\"\n" - "\t\t\t/>\n" - ; - /* clang-format on */ + + fout << "\t\t\t<DebuggerTool\n" + "\t\t\t\tRemoteExecutable=\"" + << this->EscapeForXML(exe) + << "\"\n" + "\t\t\t\tArguments=\"\"\n" + "\t\t\t/>\n"; } } } @@ -2049,17 +2082,6 @@ void cmLocalVisualStudio7Generator::WriteVCProjFooter( << "</VisualStudioProject>\n"; } -std::string cmLocalVisualStudio7GeneratorEscapeForXML(const std::string& s) -{ - std::string ret = s; - cmSystemTools::ReplaceString(ret, "&", "&"); - cmSystemTools::ReplaceString(ret, "\"", """); - cmSystemTools::ReplaceString(ret, "<", "<"); - cmSystemTools::ReplaceString(ret, ">", ">"); - cmSystemTools::ReplaceString(ret, "\n", "
"); - return ret; -} - std::string cmLocalVisualStudio7Generator::EscapeForXML(const std::string& s) { return cmLocalVisualStudio7GeneratorEscapeForXML(s); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index af97f80..c868159 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -216,6 +216,16 @@ cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const .GetCompileDefinitionsEntryBacktraces(); } +cmStringRange cmMakefile::GetLinkOptionsEntries() const +{ + return this->StateSnapshot.GetDirectory().GetLinkOptionsEntries(); +} + +cmBacktraceRange cmMakefile::GetLinkOptionsBacktraces() const +{ + return this->StateSnapshot.GetDirectory().GetLinkOptionsEntryBacktraces(); +} + cmListFileBacktrace cmMakefile::GetBacktrace() const { return this->Backtrace; @@ -1205,6 +1215,11 @@ void cmMakefile::AddCompileOption(std::string const& option) this->AppendProperty("COMPILE_OPTIONS", option.c_str()); } +void cmMakefile::AddLinkOption(std::string const& option) +{ + this->AppendProperty("LINK_OPTIONS", option.c_str()); +} + bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) { // Create a regular expression to match valid definitions. diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index a7c8df5..616a37f 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -171,6 +171,7 @@ public: void RemoveDefineFlag(std::string const& definition); void AddCompileDefinition(std::string const& definition); void AddCompileOption(std::string const& option); + void AddLinkOption(std::string const& option); /** Create a new imported target with the name and type given. */ cmTarget* AddImportedTarget(const std::string& name, @@ -788,6 +789,8 @@ public: cmBacktraceRange GetCompileOptionsBacktraces() const; cmStringRange GetCompileDefinitionsEntries() const; cmBacktraceRange GetCompileDefinitionsBacktraces() const; + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsBacktraces() const; std::set<std::string> const& GetSystemIncludeDirectories() const { diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 1e59f44..b9845ba 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -97,15 +97,15 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + // Get the name of the device object to generate. std::string const targetOutputReal = this->GeneratorTarget->ObjectDirectory + "cmake_device_link" + objExt; @@ -154,12 +154,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( linkLanguage, this->ConfigName); // Add target-specific linker flags. - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(linkFlags, linkLanguage); // Construct a list of files associated with this executable that // may need to be cleaned. @@ -299,13 +294,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the name of the executable to generate. std::string targetName; std::string targetNameReal; @@ -383,6 +371,13 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) return; } + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + this->NumberOfProgressActions++; if (!this->NoRuleMessages) { cmLocalUnixMakefileGenerator3::EchoProgress progress; @@ -437,12 +432,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) linkLanguage, this->ConfigName); // Add target-specific linker flags. - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - linkFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(linkFlags, linkLanguage); { std::unique_ptr<cmLinkLineComputer> linkLineComputer( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index c538992..571e74b 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -137,10 +137,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() this->GeneratorTarget->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS"); if (hasCUDA && resolveDeviceSymbols) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, false); + this->WriteDeviceLibraryRules(linkRuleVar, false); } std::string linkLanguage = @@ -173,10 +170,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -187,13 +181,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_LIBRARY"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); - + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); @@ -223,10 +211,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) cuda_lang) != closure->Languages.end()); if (hasCUDA) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; - std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - this->WriteDeviceLibraryRules(linkRuleVar, extraFlags, relink); + this->WriteDeviceLibraryRules(linkRuleVar, relink); } } @@ -237,12 +222,7 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) linkRuleVar += "_CREATE_SHARED_MODULE"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); @@ -265,12 +245,7 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) linkRuleVar += "_CREATE_MACOSX_FRAMEWORK"; std::string extraFlags; - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); - std::string linkFlagsConfig = "LINK_FLAGS_"; - linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); - this->LocalGenerator->AppendFlags( - extraFlags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + this->GetTargetLinkFlags(extraFlags, linkLanguage); this->LocalGenerator->AddConfigVariableFlags( extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); @@ -278,25 +253,25 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) } void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( - const std::string& linkRuleVar, const std::string& extraFlags, bool relink) + const std::string& linkRuleVar, bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE // TODO: Merge the methods that call this method to avoid // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - // Get the language to use for linking this library. std::string linkLanguage = "CUDA"; std::string const objExt = this->Makefile->GetSafeDefinition("CMAKE_CUDA_OUTPUT_EXTENSION"); + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + // Create set of linking flags. std::string linkFlags; - this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->GetTargetLinkFlags(linkFlags, linkLanguage); // Get the name of the device object to generate. std::string const targetOutputReal = @@ -458,7 +433,6 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( this->WriteTargetDriverRule(targetOutputReal, relink); #else static_cast<void>(linkRuleVar); - static_cast<void>(extraFlags); static_cast<void>(relink); #endif } @@ -470,13 +444,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // code duplication. std::vector<std::string> commands; - // Build list of dependencies. - std::vector<std::string> depends; - this->AppendLinkDepends(depends); - if (!this->DeviceLinkObject.empty()) { - depends.push_back(this->DeviceLinkObject); - } - // Get the language to use for linking this library. std::string linkLanguage = this->GeneratorTarget->GetLinkerLanguage(this->ConfigName); @@ -488,6 +455,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( return; } + // Build list of dependencies. + std::vector<std::string> depends; + this->AppendLinkDepends(depends, linkLanguage); + if (!this->DeviceLinkObject.empty()) { + depends.push_back(this->DeviceLinkObject); + } + // Create set of linking flags. std::string linkFlags; this->LocalGenerator->AppendFlags(linkFlags, extraFlags); diff --git a/Source/cmMakefileLibraryTargetGenerator.h b/Source/cmMakefileLibraryTargetGenerator.h index 02fa029..35e4327 100644 --- a/Source/cmMakefileLibraryTargetGenerator.h +++ b/Source/cmMakefileLibraryTargetGenerator.h @@ -27,8 +27,7 @@ protected: void WriteSharedLibraryRules(bool relink); void WriteModuleLibraryRules(bool relink); - void WriteDeviceLibraryRules(const std::string& linkRule, - const std::string& extraFlags, bool relink); + void WriteDeviceLibraryRules(const std::string& linkRule, bool relink); void WriteLibraryRules(const std::string& linkRule, const std::string& extraFlags, bool relink); // MacOSX Framework support methods diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 1f65f08..79baca6 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -82,6 +82,23 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New( return result; } +void cmMakefileTargetGenerator::GetTargetLinkFlags( + std::string& flags, const std::string& linkLanguage) +{ + this->LocalGenerator->AppendFlags( + flags, this->GeneratorTarget->GetProperty("LINK_FLAGS")); + + std::string linkFlagsConfig = "LINK_FLAGS_"; + linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); + this->LocalGenerator->AppendFlags( + flags, this->GeneratorTarget->GetProperty(linkFlagsConfig)); + + std::vector<std::string> opts; + this->GeneratorTarget->GetLinkOptions(opts, this->ConfigName, linkLanguage); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(flags, opts); +} + void cmMakefileTargetGenerator::CreateRuleFile() { // Create a directory for this target. @@ -107,7 +124,7 @@ void cmMakefileTargetGenerator::CreateRuleFile() // Open the rule file. This should be copy-if-different because the // rules may depend on this file itself. this->BuildFileStream = - new cmGeneratedFileStream(this->BuildFileNameFull.c_str(), false, + new cmGeneratedFileStream(this->BuildFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); this->BuildFileStream->SetCopyIfDifferent(true); if (!this->BuildFileStream) { @@ -220,8 +237,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() if (!cmSystemTools::FileExists(dependFileNameFull)) { // Write an empty dependency file. cmGeneratedFileStream depFileStream( - dependFileNameFull.c_str(), false, - this->GlobalGenerator->GetMakefileEncoding()); + dependFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); depFileStream << "# Empty dependencies file for " << this->GeneratorTarget->GetName() << ".\n" << "# This may be replaced when dependencies are built." @@ -233,7 +249,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() this->FlagFileNameFull = this->TargetBuildDirectoryFull; this->FlagFileNameFull += "/flags.make"; this->FlagFileStream = - new cmGeneratedFileStream(this->FlagFileNameFull.c_str(), false, + new cmGeneratedFileStream(this->FlagFileNameFull, false, this->GlobalGenerator->GetMakefileEncoding()); this->FlagFileStream->SetCopyIfDifferent(true); if (!this->FlagFileStream) { @@ -957,8 +973,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() this->InfoFileNameFull += "/DependInfo.cmake"; this->InfoFileNameFull = this->LocalGenerator->ConvertToFullPath(this->InfoFileNameFull); - this->InfoFileStream = - new cmGeneratedFileStream(this->InfoFileNameFull.c_str()); + this->InfoFileStream = new cmGeneratedFileStream(this->InfoFileNameFull); this->InfoFileStream->SetCopyIfDifferent(true); if (!*this->InfoFileStream) { return; @@ -1370,7 +1385,7 @@ void cmMakefileTargetGenerator::AppendObjectDepends( } void cmMakefileTargetGenerator::AppendLinkDepends( - std::vector<std::string>& depends) + std::vector<std::string>& depends, const std::string& linkLanguage) { this->AppendObjectDepends(depends); @@ -1394,10 +1409,8 @@ void cmMakefileTargetGenerator::AppendLinkDepends( } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - cmSystemTools::ExpandListArgument(linkDepends, depends); - } + this->GeneratorTarget->GetLinkDepends(depends, this->ConfigName, + linkLanguage); } std::string cmMakefileTargetGenerator::GetLinkRule( @@ -1431,7 +1444,7 @@ void cmMakefileTargetGenerator::CreateLinkScript( std::string linkScriptName = this->TargetBuildDirectoryFull; linkScriptName += "/"; linkScriptName += name; - cmGeneratedFileStream linkScriptStream(linkScriptName.c_str()); + cmGeneratedFileStream linkScriptStream(linkScriptName); linkScriptStream.SetCopyIfDifferent(true); for (std::string const& link_command : link_commands) { // Do not write out empty commands or commands beginning in the @@ -1515,7 +1528,7 @@ std::string cmMakefileTargetGenerator::CreateResponseFile( std::string responseFileNameFull = this->TargetBuildDirectoryFull; responseFileNameFull += "/"; responseFileNameFull += name; - cmGeneratedFileStream responseStream(responseFileNameFull.c_str()); + cmGeneratedFileStream responseStream(responseFileNameFull); responseStream.SetCopyIfDifferent(true); responseStream << options << "\n"; @@ -1703,7 +1716,7 @@ void cmMakefileTargetGenerator::GenDefFile( cmOutputConverter::SHELL); real_link_commands.insert(real_link_commands.begin(), cmd); // create a list of obj files for the -E __create_def to read - cmGeneratedFileStream fout(objlist_file.c_str()); + cmGeneratedFileStream fout(objlist_file); if (mdi->WindowsExportAllSymbols) { for (std::string const& obj : this->Objects) { diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 7af3cf3..f21362a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -52,6 +52,8 @@ public: cmGeneratorTarget* GetGeneratorTarget() { return this->GeneratorTarget; } protected: + void GetTargetLinkFlags(std::string& flags, const std::string& linkLanguage); + // create the file and directory etc void CreateRuleFile(); @@ -126,7 +128,8 @@ protected: void AppendObjectDepends(std::vector<std::string>& depends); // Append link rule dependencies (objects, etc.). - void AppendLinkDepends(std::vector<std::string>& depends); + void AppendLinkDepends(std::vector<std::string>& depends, + const std::string& linkLanguage); // Lookup the link rule for this target. std::string GetLinkRule(const std::string& linkRuleVar); diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index c1cd1b6..a50e5fc 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -2,10 +2,12 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmMathCommand.h" -#include <stdio.h> - #include "cmExprParserHelper.h" #include "cmMakefile.h" +#include "cm_kwiml.h" +#include "cmake.h" + +#include <stdio.h> class cmExecutionStatus; @@ -27,24 +29,83 @@ bool cmMathCommand::InitialPass(std::vector<std::string> const& args, bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args) { - if (args.size() != 3) { + if ((args.size() != 3) && (args.size() != 5)) { this->SetError("EXPR called with incorrect arguments."); return false; } + enum class NumericFormat + { + UNINITIALIZED, + DECIMAL, + HEXADECIMAL, + }; + const std::string& outputVariable = args[1]; const std::string& expression = args[2]; + size_t argumentIndex = 3; + NumericFormat outputFormat = NumericFormat::UNINITIALIZED; + + this->Makefile->AddDefinition(outputVariable, "ERROR"); + + if (argumentIndex < args.size()) { + const std::string messageHint = "sub-command EXPR "; + const std::string option = args[argumentIndex++]; + if (option == "OUTPUT_FORMAT") { + if (argumentIndex < args.size()) { + const std::string argument = args[argumentIndex++]; + if (argument == "DECIMAL") { + outputFormat = NumericFormat::DECIMAL; + } else if (argument == "HEXADECIMAL") { + outputFormat = NumericFormat::HEXADECIMAL; + } else { + std::string error = messageHint + "value \"" + argument + + "\" for option \"" + option + "\" is invalid."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "missing argument for option \"" + option + "\"."; + this->SetError(error); + return false; + } + } else { + std::string error = + messageHint + "option \"" + option + "\" is unknown."; + this->SetError(error); + return false; + } + } + + if (outputFormat == NumericFormat::UNINITIALIZED) { + outputFormat = NumericFormat::DECIMAL; + } cmExprParserHelper helper; if (!helper.ParseString(expression.c_str(), 0)) { - std::string e = "cannot parse the expression: \"" + expression + "\": "; - e += helper.GetError(); - this->SetError(e); + this->SetError(helper.GetError()); return false; } char buffer[1024]; - sprintf(buffer, "%d", helper.GetResult()); + const char* fmt; + switch (outputFormat) { + case NumericFormat::HEXADECIMAL: + fmt = "0x%" KWIML_INT_PRIx64; + break; + case NumericFormat::DECIMAL: + CM_FALLTHROUGH; + default: + fmt = "%" KWIML_INT_PRId64; + break; + } + sprintf(buffer, fmt, helper.GetResult()); + + std::string const& w = helper.GetWarning(); + if (!w.empty()) { + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w); + } this->Makefile->AddDefinition(outputVariable, buffer); return true; diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 7394188..b634b0a 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -625,7 +625,7 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() outputs.push_back(targetOutputReal); // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); std::string frameworkPath; std::string linkPath; @@ -794,7 +794,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute specific libraries to link with. cmNinjaDeps explicitDeps = this->GetObjects(); - cmNinjaDeps implicitDeps = this->ComputeLinkDeps(); + cmNinjaDeps implicitDeps = this->ComputeLinkDeps(this->TargetLinkLanguage); if (!this->DeviceLinkObject.empty()) { explicitDeps.push_back(this->DeviceLinkObject); @@ -956,7 +956,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() preLinkCmdLines.push_back(std::move(cmd)); // create a list of obj files for the -E __create_def to read - cmGeneratedFileStream fout(obj_list_file.c_str()); + cmGeneratedFileStream fout(obj_list_file); if (mdi->WindowsExportAllSymbols) { cmNinjaDeps objs = this->GetObjects(); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 9d41948..1cfaac5 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -235,7 +235,8 @@ std::string cmNinjaTargetGenerator::ComputeIncludes( return includesString; } -cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const +cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps( + const std::string& linkLanguage) const { // Static libraries never depend on other targets for linking. if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || @@ -270,13 +271,11 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const } // Add user-specified dependencies. - if (const char* linkDepends = - this->GeneratorTarget->GetProperty("LINK_DEPENDS")) { - std::vector<std::string> linkDeps; - cmSystemTools::ExpandListArgument(linkDepends, linkDeps); - std::transform(linkDeps.begin(), linkDeps.end(), - std::back_inserter(result), MapToNinjaPath()); - } + std::vector<std::string> linkDeps; + this->GeneratorTarget->GetLinkDepends(linkDeps, this->ConfigName, + linkLanguage); + std::transform(linkDeps.begin(), linkDeps.end(), std::back_inserter(result), + MapToNinjaPath()); return result; } @@ -1134,7 +1133,7 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang) } std::string const tdin = this->GetTargetDependInfoPath(lang); - cmGeneratedFileStream tdif(tdin.c_str()); + cmGeneratedFileStream tdif(tdin); tdif << tdi; } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 4660a3a..e58a8a0 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -95,7 +95,7 @@ protected: } /// @return the list of link dependency for the given target @a target. - cmNinjaDeps ComputeLinkDeps() const; + cmNinjaDeps ComputeLinkDeps(const std::string& linkLanguage) const; /// @return the source file path for the given @a source. std::string GetSourceFilePath(cmSourceFile const* source) const; diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 00a2d2b..239cd00 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -2,11 +2,16 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmOptionCommand.h" +#include <sstream> + #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmPolicies.h" #include "cmState.h" +#include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" +#include "cmake.h" class cmExecutionStatus; @@ -14,19 +19,7 @@ class cmExecutionStatus; bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) { - bool argError = false; - if (args.size() < 2) { - argError = true; - } - // for VTK 4.0 we have to support the option command with more than 3 - // arguments if CMAKE_MINIMUM_REQUIRED_VERSION is not defined, if - // CMAKE_MINIMUM_REQUIRED_VERSION is defined, then we can have stricter - // checking. - if (this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION")) { - if (args.size() > 3) { - argError = true; - } - } + const bool argError = (args.size() < 2) || (args.size() > 3); if (argError) { std::string m = "called with incorrect number of arguments: "; m += cmJoin(args, " "); @@ -34,23 +27,62 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args, return false; } - std::string initialValue = "Off"; - // Now check and see if the value has been stored in the cache - // already, if so use that value and don't look for the program + // Determine the state of the option policy + bool checkAndWarn = false; + { + auto status = this->Makefile->GetPolicyStatus(cmPolicies::CMP0077); + const char* existsBeforeSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + switch (status) { + case cmPolicies::WARN: + checkAndWarn = (existsBeforeSet != nullptr); + break; + case cmPolicies::OLD: + // OLD behavior does not warn. + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: { + // See if a local variable with this name already exists. + // If so we ignore the option command. + if (existsBeforeSet) { + return true; + } + } break; + } + } + + // See if a cache variable with this name already exists + // If so just make sure the doc state is correct cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(args[0]); - if (existingValue) { - if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) { - state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); - return true; - } - initialValue = existingValue; + if (existingValue && + (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED)) { + state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); + return true; } + + // Nothing in the cache so add it + std::string initialValue = existingValue ? existingValue : "Off"; if (args.size() == 3) { initialValue = args[2]; } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF", args[1].c_str(), cmStateEnums::BOOL); + + if (checkAndWarn) { + const char* existsAfterSet = + this->Makefile->GetStateSnapshot().GetDefinition(args[0]); + if (!existsAfterSet) { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0077) + << "\n" + "For compatibility with older versions of CMake, option " + "is clearing the normal variable '" + << args[0] << "'."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + } return true; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index bdb98ca..e2de3f9 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -356,8 +356,7 @@ protected: if (!found) { // Couldn't find any dependency information. - if (this->ComplainFileRegularExpression.find( - info->IncludeName.c_str())) { + if (this->ComplainFileRegularExpression.find(info->IncludeName)) { cmSystemTools::Error("error cannot find dependencies for ", path); } else { // Destroy the name of the file so that it won't be output as a diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 1ef1813..91ed924 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -223,6 +223,13 @@ class cmMakefile; 3, 12, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0075, \ "Include file check macros honor CMAKE_REQUIRED_LIBRARIES.", 3, 12, \ + 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0076, \ + "target_sources() command converts relative paths to absolute.", 3, \ + 13, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0077, "option() honors normal variables.", 3, 13, 0, \ + cmPolicies::WARN) \ + SELECT(POLICY, CMP0078, "UseSWIG generates standard target names.", 3, 13, \ 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) @@ -248,7 +255,8 @@ class cmMakefile; F(CMP0065) \ F(CMP0068) \ F(CMP0069) \ - F(CMP0073) + F(CMP0073) \ + F(CMP0076) /** \class cmPolicies * \brief Handles changes in CMake behavior and policies diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 34196d9..72ae09a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -37,23 +37,6 @@ #include <utility> #include <vector> -inline static const char* SafeString(const char* value) -{ - return (value != nullptr) ? value : ""; -} - -inline static std::string GetSafeProperty(cmGeneratorTarget const* target, - const char* key) -{ - return std::string(SafeString(target->GetProperty(key))); -} - -inline static std::string GetSafeProperty(cmSourceFile const* sf, - const char* key) -{ - return std::string(SafeString(sf->GetProperty(key))); -} - static std::size_t GetParallelCPUCount() { static std::size_t count = 0; @@ -194,22 +177,34 @@ cmQtAutoGenInitializer::cmQtAutoGenInitializer( cmGeneratorTarget* target, bool mocEnabled, bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor) : Target(target) - , MocEnabled(mocEnabled) - , UicEnabled(uicEnabled) - , RccEnabled(rccEnabled) , MultiConfig(false) , QtVersionMajor(qtVersionMajor) { + Moc.Enabled = mocEnabled; + Uic.Enabled = uicEnabled; + Rcc.Enabled = rccEnabled; + this->QtVersionMinor = cmQtAutoGenInitializer::GetQtMinorVersion(target, this->QtVersionMajor); } -void cmQtAutoGenInitializer::InitCustomTargets() +bool cmQtAutoGenInitializer::InitCustomTargets() { cmMakefile* makefile = this->Target->Target->GetMakefile(); cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); + // Verbosity + this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); + if (!this->Verbosity.empty()) { + unsigned long iVerb = 0; + if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { + // Non numeric verbosity + this->Verbosity = + cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0"; + } + } + // Configurations this->MultiConfig = globalGen->IsMultiConfig(); this->ConfigDefault = makefile->GetConfigurations(this->ConfigsList); @@ -217,6 +212,13 @@ void cmQtAutoGenInitializer::InitCustomTargets() this->ConfigsList.push_back(this->ConfigDefault); } + // Parallel processing + this->Parallel = this->Target->GetSafeProperty("AUTOGEN_PARALLEL"); + if (this->Parallel.empty() || (this->Parallel == "AUTO")) { + // Autodetect number of CPUs + this->Parallel = std::to_string(GetParallelCPUCount()); + } + // Autogen target name this->AutogenTargetName = this->Target->GetName(); this->AutogenTargetName += "_autogen"; @@ -236,26 +238,53 @@ void cmQtAutoGenInitializer::InitCustomTargets() cmSystemTools::ConvertToUnixSlashes(this->DirInfo); // Autogen build dir - this->DirBuild = GetSafeProperty(this->Target, "AUTOGEN_BUILD_DIR"); + this->DirBuild = this->Target->GetSafeProperty("AUTOGEN_BUILD_DIR"); if (this->DirBuild.empty()) { this->DirBuild = cbd; this->DirBuild += '/'; this->DirBuild += this->AutogenTargetName; } cmSystemTools::ConvertToUnixSlashes(this->DirBuild); + // Remove build directories on cleanup + AddCleanFile(makefile, this->DirBuild); // Working directory this->DirWork = cbd; cmSystemTools::ConvertToUnixSlashes(this->DirWork); + + // Include directory + this->DirInclude = this->DirBuild; + this->DirInclude += "/include"; + if (this->MultiConfig) { + this->DirInclude += "_$<CONFIG>"; + } + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string& dir = this->DirConfigInclude[cfg]; + dir = this->DirBuild; + dir += "/include_"; + dir += cfg; + } + } } - // Autogen files + // Autogen info and settings files { this->AutogenInfoFile = this->DirInfo; this->AutogenInfoFile += "/AutogenInfo.cmake"; this->AutogenSettingsFile = this->DirInfo; this->AutogenSettingsFile += "/AutogenOldSettings.txt"; + + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string& filename = this->AutogenConfigSettingsFile[cfg]; + filename = AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); + AddCleanFile(makefile, filename); + } + } else { + AddCleanFile(makefile, this->AutogenSettingsFile); + } } // Autogen target FOLDER property @@ -268,107 +297,237 @@ void cmQtAutoGenInitializer::InitCustomTargets() } // Inherit FOLDER property from target (#13688) if (folder == nullptr) { - folder = SafeString(this->Target->Target->GetProperty("FOLDER")); + folder = this->Target->GetProperty("FOLDER"); } if (folder != nullptr) { this->AutogenFolder = folder; } } - std::set<std::string> autogenDependFiles; - std::set<cmTarget*> autogenDependTargets; - std::vector<std::string> autogenProvides; + if (this->Moc.Enabled || this->Uic.Enabled) { + // Init moc specific settings + if (this->Moc.Enabled && !InitMoc()) { + return false; + } + // Init uic specific settings + if (this->Uic.Enabled && !InitUic()) { + return false; + } + + // Autogen target: Compute user defined dependencies + { + std::string const deps = + this->Target->GetSafeProperty("AUTOGEN_TARGET_DEPENDS"); + if (!deps.empty()) { + std::vector<std::string> extraDeps; + cmSystemTools::ExpandListArgument(deps, extraDeps); + for (std::string const& depName : extraDeps) { + // Allow target and file dependencies + auto* depTarget = makefile->FindTargetToUse(depName); + if (depTarget != nullptr) { + this->AutogenDependTargets.insert(depTarget); + } else { + this->AutogenDependFiles.insert(depName); + } + } + } + } + } + // Init rcc specific settings + if (this->Rcc.Enabled && !InitRcc()) { + return false; + } + + // Add autogen include directory to the origin target INCLUDE_DIRECTORIES + if (this->Moc.Enabled || this->Uic.Enabled || + (this->Rcc.Enabled && this->MultiConfig)) { + this->Target->AddIncludeDirectory(this->DirInclude, true); + } + + // Scan files + if (!this->InitScanFiles()) { + return false; + } + + // Create autogen target + if ((this->Moc.Enabled || this->Uic.Enabled) && !this->InitAutogenTarget()) { + return false; + } + + // Create rcc targets + if (this->Rcc.Enabled && !this->InitRccTargets()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitMoc() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + + // Mocs compilation file + this->Moc.MocsCompilation = this->DirBuild; + this->Moc.MocsCompilation += "/mocs_compilation.cpp"; + + // Moc predefs command + if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && + this->QtVersionGreaterOrEqual(5, 8)) { + this->Moc.PredefsCmd = + makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); + } - // Remove build directories on cleanup - AddCleanFile(makefile, this->DirBuild); - // Remove old settings on cleanup + // Moc includes { - std::string base = this->DirInfo; - base += "/AutogenOldSettings"; + bool const appendImplicit = (this->QtVersionMajor == "5"); + auto GetIncludeDirs = + [this, localGen, appendImplicit](std::string const& cfg) -> std::string { + // Get the include dirs for this target, without stripping the implicit + // include dirs off, see + // https://gitlab.kitware.com/cmake/cmake/issues/13667 + std::vector<std::string> dirs; + localGen->GetIncludeDirectories(dirs, this->Target, "CXX", cfg, false, + appendImplicit); + return cmJoin(dirs, ";"); + }; + + // Default configuration include directories + this->Moc.Includes = GetIncludeDirs(this->ConfigDefault); + // Other configuration settings if (this->MultiConfig) { for (std::string const& cfg : this->ConfigsList) { - std::string filename = base; - filename += '_'; - filename += cfg; - filename += ".cmake"; - AddCleanFile(makefile, filename); + std::string dirs = GetIncludeDirs(cfg); + if (dirs != this->Moc.Includes) { + this->Moc.ConfigIncludes[cfg] = std::move(dirs); + } } - } else { - AddCleanFile(makefile, base.append(".cmake")); } } - // Add moc compilation to generated files list - if (this->MocEnabled) { - std::string mocsComp = this->DirBuild + "/mocs_compilation.cpp"; - this->AddGeneratedSource(mocsComp, GeneratorT::MOC); - autogenProvides.push_back(std::move(mocsComp)); - } + // Moc compile definitions + { + auto GetCompileDefinitions = + [this, localGen](std::string const& cfg) -> std::string { + std::set<std::string> defines; + localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); + return cmJoin(defines, ";"); + }; - // Add autogen includes directory to the origin target INCLUDE_DIRECTORIES - if (this->MocEnabled || this->UicEnabled || - (this->RccEnabled && this->MultiConfig)) { - std::string includeDir = this->DirBuild; - includeDir += "/include"; + // Default configuration defines + this->Moc.Defines = GetCompileDefinitions(this->ConfigDefault); + // Other configuration defines if (this->MultiConfig) { - includeDir += "_$<CONFIG>"; + for (std::string const& cfg : this->ConfigsList) { + std::string defines = GetCompileDefinitions(cfg); + if (defines != this->Moc.Defines) { + this->Moc.ConfigDefines[cfg] = std::move(defines); + } + } } - this->Target->AddIncludeDirectory(includeDir, true); } - // Acquire rcc executable and features - if (this->RccEnabled) { - { - std::string err; - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt5::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt5::rcc target not found"; - } - } else if (QtVersionMajor == "4") { - cmGeneratorTarget* tgt = - localGen->FindGeneratorTargetToUse("Qt4::rcc"); - if (tgt != nullptr) { - this->RccExecutable = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTORCC: Qt4::rcc target not found"; - } - } else { - err = "The AUTORCC feature supports only Qt 4 and Qt 5"; + // Moc executable + if (!GetMocExecutable()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitUic() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + // Uic search paths + { + std::string const usp = + this->Target->GetSafeProperty("AUTOUIC_SEARCH_PATHS"); + if (!usp.empty()) { + cmSystemTools::ExpandListArgument(usp, this->Uic.SearchPaths); + std::string const srcDir = makefile->GetCurrentSourceDirectory(); + for (std::string& path : this->Uic.SearchPaths) { + path = cmSystemTools::CollapseFullPath(path, srcDir); } - if (!err.empty()) { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); + } + } + // Uic target options + { + auto UicGetOpts = [this](std::string const& cfg) -> std::string { + std::vector<std::string> opts; + this->Target->GetAutoUicOptions(opts, cfg); + return cmJoin(opts, ";"); + }; + + // Default settings + this->Uic.Options = UicGetOpts(this->ConfigDefault); + + // Configuration specific settings + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + std::string options = UicGetOpts(cfg); + if (options != this->Uic.Options) { + this->Uic.ConfigOptions[cfg] = std::move(options); + } } } - // Detect if rcc supports (-)-list - if (!this->RccExecutable.empty() && (this->QtVersionMajor == "5")) { - std::vector<std::string> command; - command.push_back(this->RccExecutable); - command.push_back("--help"); - std::string rccStdOut; - std::string rccStdErr; - int retVal = 0; - bool result = cmSystemTools::RunSingleCommand( - command, &rccStdOut, &rccStdErr, &retVal, nullptr, - cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); - if (result && retVal == 0 && - rccStdOut.find("--list") != std::string::npos) { - this->RccListOptions.push_back("--list"); - } else { - this->RccListOptions.push_back("-list"); + } + // .ui files skip and options + { + std::string const uiExt = "ui"; + std::string pathError; + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). + std::string const& fPath = sf->GetFullPath(&pathError); + if (!pathError.empty()) { + pathError.clear(); + continue; + } + if (sf->GetExtension() == uiExt) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + // Check if the .ui file should be skipped + if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || + sf->GetPropertyAsBool("SKIP_AUTOGEN")) { + this->Uic.Skip.insert(absFile); + } + // Check if the .ui file has uic options + std::string const uicOpts = sf->GetSafeProperty("AUTOUIC_OPTIONS"); + if (!uicOpts.empty()) { + // Check if file isn't skipped + if (this->Uic.Skip.count(absFile) == 0) { + this->Uic.FileFiles.push_back(absFile); + std::vector<std::string> optsVec; + cmSystemTools::ExpandListArgument(uicOpts, optsVec); + this->Uic.FileOptions.push_back(std::move(optsVec)); + } + } } } } - // Extract relevant source files - std::vector<std::string> generatedSources; - std::vector<std::string> generatedHeaders; + // Uic executable + if (!GetUicExecutable()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::InitRcc() +{ + if (!GetRccExecutable()) { + return false; + } + return true; +} + +bool cmQtAutoGenInitializer::InitScanFiles() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + // Scan through target files { std::string const qrcExt = "qrc"; std::vector<cmSourceFile*> srcFiles; @@ -381,34 +540,34 @@ void cmQtAutoGenInitializer::InitCustomTargets() std::string const& fPath = sf->GetFullPath(); std::string const& ext = sf->GetExtension(); // Register generated files that will be scanned by moc or uic - if (this->MocEnabled || this->UicEnabled) { + if (this->Moc.Enabled || this->Uic.Enabled) { cmSystemTools::FileFormat const fileType = cmSystemTools::GetFileFormat(ext.c_str()); if ((fileType == cmSystemTools::CXX_FILE_FORMAT) || (fileType == cmSystemTools::HEADER_FILE_FORMAT)) { std::string const absPath = cmSystemTools::GetRealPath(fPath); - if ((this->MocEnabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || - (this->UicEnabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { + if ((this->Moc.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOMOC")) || + (this->Uic.Enabled && !sf->GetPropertyAsBool("SKIP_AUTOUIC"))) { // Register source const bool generated = sf->GetPropertyAsBool("GENERATED"); if (fileType == cmSystemTools::HEADER_FILE_FORMAT) { if (generated) { - generatedHeaders.push_back(absPath); + this->MocUic.HeadersGenerated.push_back(absPath); } else { - this->Headers.push_back(absPath); + this->MocUic.Headers.push_back(absPath); } } else { if (generated) { - generatedSources.push_back(absPath); + this->MocUic.SourcesGenerated.push_back(absPath); } else { - this->Sources.push_back(absPath); + this->MocUic.Sources.push_back(absPath); } } } } } // Register rcc enabled files - if (this->RccEnabled && (ext == qrcExt) && + if (this->Rcc.Enabled && (ext == qrcExt) && !sf->GetPropertyAsBool("SKIP_AUTORCC")) { // Register qrc file { @@ -419,148 +578,149 @@ void cmQtAutoGenInitializer::InitCustomTargets() qrc.Generated = sf->GetPropertyAsBool("GENERATED"); // RCC options { - std::string const opts = GetSafeProperty(sf, "AUTORCC_OPTIONS"); + std::string const opts = sf->GetSafeProperty("AUTORCC_OPTIONS"); if (!opts.empty()) { cmSystemTools::ExpandListArgument(opts, qrc.Options); } } - this->Qrcs.push_back(std::move(qrc)); + this->Rcc.Qrcs.push_back(std::move(qrc)); } } } - // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's - // sources meta data cache. Clear it so that OBJECT library targets that - // are AUTOGEN initialized after this target get their added - // mocs_compilation.cpp source acknowledged by this target. - this->Target->ClearSourcesCache(); } - // Read skip files from makefile sources - if (this->MocEnabled || this->UicEnabled) { - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - cmSystemTools::FileFormat const fileType = - cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); - if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && - !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { - continue; - } - const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); - const bool mocSkip = - this->MocEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); - const bool uicSkip = - this->UicEnabled && (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); - if (mocSkip || uicSkip) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - if (mocSkip) { - this->MocSkip.insert(absFile); + // cmGeneratorTarget::GetConfigCommonSourceFiles computes the target's + // sources meta data cache. Clear it so that OBJECT library targets that + // are AUTOGEN initialized after this target get their added + // mocs_compilation.cpp source acknowledged by this target. + this->Target->ClearSourcesCache(); + + if (this->Moc.Enabled || this->Uic.Enabled) { + // Read skip files from makefile sources + { + std::string pathError; + for (cmSourceFile* sf : makefile->GetSourceFiles()) { + // sf->GetExtension() is only valid after sf->GetFullPath() ... + // Since we're iterating over source files that might be not in the + // target we need to check for path errors (not existing files). + std::string const& fPath = sf->GetFullPath(&pathError); + if (!pathError.empty()) { + pathError.clear(); + continue; } - if (uicSkip) { - this->UicSkip.insert(absFile); + cmSystemTools::FileFormat const fileType = + cmSystemTools::GetFileFormat(sf->GetExtension().c_str()); + if (!(fileType == cmSystemTools::CXX_FILE_FORMAT) && + !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) { + continue; + } + const bool skipAll = sf->GetPropertyAsBool("SKIP_AUTOGEN"); + const bool mocSkip = this->Moc.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOMOC")); + const bool uicSkip = this->Uic.Enabled && + (skipAll || sf->GetPropertyAsBool("SKIP_AUTOUIC")); + if (mocSkip || uicSkip) { + std::string const absFile = cmSystemTools::GetRealPath(fPath); + if (mocSkip) { + this->Moc.Skip.insert(absFile); + } + if (uicSkip) { + this->Uic.Skip.insert(absFile); + } } } } - } - // Process GENERATED sources and headers - if (!generatedSources.empty() || !generatedHeaders.empty()) { - // Check status of policy CMP0071 - bool policyAccept = false; - bool policyWarn = false; - cmPolicies::PolicyStatus const CMP0071_status = - makefile->GetPolicyStatus(cmPolicies::CMP0071); - switch (CMP0071_status) { - case cmPolicies::WARN: - policyWarn = true; - CM_FALLTHROUGH; - case cmPolicies::OLD: - // Ignore GENERATED file - break; - case cmPolicies::REQUIRED_IF_USED: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::NEW: - // Process GENERATED file - policyAccept = true; - break; - } - - if (policyAccept) { - // Accept GENERATED sources - for (std::string const& absFile : generatedHeaders) { - this->Headers.push_back(absFile); - autogenDependFiles.insert(absFile); - } - for (std::string const& absFile : generatedSources) { - this->Sources.push_back(absFile); - autogenDependFiles.insert(absFile); + // Process GENERATED sources and headers + if (!this->MocUic.SourcesGenerated.empty() || + !this->MocUic.HeadersGenerated.empty()) { + // Check status of policy CMP0071 + bool policyAccept = false; + bool policyWarn = false; + cmPolicies::PolicyStatus const CMP0071_status = + makefile->GetPolicyStatus(cmPolicies::CMP0071); + switch (CMP0071_status) { + case cmPolicies::WARN: + policyWarn = true; + CM_FALLTHROUGH; + case cmPolicies::OLD: + // Ignore GENERATED file + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::NEW: + // Process GENERATED file + policyAccept = true; + break; } - } else { - if (policyWarn) { - std::string msg; - msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071); - msg += "\n"; - std::string tools; - std::string property; - if (this->MocEnabled && this->UicEnabled) { - tools = "AUTOMOC and AUTOUIC"; - property = "SKIP_AUTOGEN"; - } else if (this->MocEnabled) { - tools = "AUTOMOC"; - property = "SKIP_AUTOMOC"; - } else if (this->UicEnabled) { - tools = "AUTOUIC"; - property = "SKIP_AUTOUIC"; + + if (policyAccept) { + // Accept GENERATED sources + for (std::string const& absFile : this->MocUic.HeadersGenerated) { + this->MocUic.Headers.push_back(absFile); + this->AutogenDependFiles.insert(absFile); } - msg += "For compatibility, CMake is excluding the GENERATED source " - "file(s):\n"; - for (const std::string& absFile : generatedHeaders) { - msg.append(" ").append(Quoted(absFile)).append("\n"); + for (std::string const& absFile : this->MocUic.SourcesGenerated) { + this->MocUic.Sources.push_back(absFile); + this->AutogenDependFiles.insert(absFile); } - for (const std::string& absFile : generatedSources) { - msg.append(" ").append(Quoted(absFile)).append("\n"); + } else { + if (policyWarn) { + std::string msg; + msg += cmPolicies::GetPolicyWarning(cmPolicies::CMP0071); + msg += "\n"; + std::string tools; + std::string property; + if (this->Moc.Enabled && this->Uic.Enabled) { + tools = "AUTOMOC and AUTOUIC"; + property = "SKIP_AUTOGEN"; + } else if (this->Moc.Enabled) { + tools = "AUTOMOC"; + property = "SKIP_AUTOMOC"; + } else if (this->Uic.Enabled) { + tools = "AUTOUIC"; + property = "SKIP_AUTOUIC"; + } + msg += "For compatibility, CMake is excluding the GENERATED source " + "file(s):\n"; + for (const std::string& absFile : this->MocUic.HeadersGenerated) { + msg.append(" ").append(Quoted(absFile)).append("\n"); + } + for (const std::string& absFile : this->MocUic.SourcesGenerated) { + msg.append(" ").append(Quoted(absFile)).append("\n"); + } + msg += "from processing by "; + msg += tools; + msg += + ". If any of the files should be processed, set CMP0071 to NEW. " + "If any of the files should not be processed, " + "explicitly exclude them by setting the source file property "; + msg += property; + msg += ":\n set_property(SOURCE file.h PROPERTY "; + msg += property; + msg += " ON)\n"; + makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } - msg += "from processing by "; - msg += tools; - msg += - ". If any of the files should be processed, set CMP0071 to NEW. " - "If any of the files should not be processed, " - "explicitly exclude them by setting the source file property "; - msg += property; - msg += ":\n set_property(SOURCE file.h PROPERTY "; - msg += property; - msg += " ON)\n"; - makefile->IssueMessage(cmake::AUTHOR_WARNING, msg); } } - // Clear lists - generatedSources.clear(); - generatedHeaders.clear(); - } - // Sort headers and sources - if (this->MocEnabled || this->UicEnabled) { - std::sort(this->Headers.begin(), this->Headers.end()); - std::sort(this->Sources.begin(), this->Sources.end()); + // Sort headers and sources + if (this->Moc.Enabled || this->Uic.Enabled) { + std::sort(this->MocUic.Headers.begin(), this->MocUic.Headers.end()); + std::sort(this->MocUic.Sources.begin(), this->MocUic.Sources.end()); + } } // Process qrc files - if (!this->Qrcs.empty()) { + if (!this->Rcc.Qrcs.empty()) { const bool QtV5 = (this->QtVersionMajor == "5"); // Target rcc options std::vector<std::string> optionsTarget; cmSystemTools::ExpandListArgument( - GetSafeProperty(this->Target, "AUTORCC_OPTIONS"), optionsTarget); + this->Target->GetSafeProperty("AUTORCC_OPTIONS"), optionsTarget); // Check if file name is unique - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.Unique = true; - for (Qrc const& qrc2 : this->Qrcs) { + for (Qrc const& qrc2 : this->Rcc.Qrcs) { if ((&qrc != &qrc2) && (qrc.QrcName == qrc2.QrcName)) { qrc.Unique = false; break; @@ -570,7 +730,7 @@ void cmQtAutoGenInitializer::InitCustomTargets() // Path checksum and file names { cmFilePathChecksum const fpathCheckSum(makefile); - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { qrc.PathChecksum = fpathCheckSum.getPart(qrc.QrcFile); // RCC output file name { @@ -597,11 +757,18 @@ void cmQtAutoGenInitializer::InitCustomTargets() qrc.SettingsFile = base; qrc.SettingsFile += "Settings.txt"; + + if (this->MultiConfig) { + for (std::string const& cfg : this->ConfigsList) { + qrc.ConfigSettingsFile[cfg] = + AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); + } + } } } } // RCC options - for (Qrc& qrc : this->Qrcs) { + for (Qrc& qrc : this->Rcc.Qrcs) { // Target options std::vector<std::string> opts = optionsTarget; // Merge computed "-name XYZ" option @@ -622,313 +789,407 @@ void cmQtAutoGenInitializer::InitCustomTargets() RccMergeOptions(opts, qrc.Options, QtV5); qrc.Options = std::move(opts); } - for (Qrc& qrc : this->Qrcs) { - // Register file at target - this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); - - std::vector<std::string> ccOutput; - ccOutput.push_back(qrc.RccFile); - - cmCustomCommandLines commandLines; - if (this->MultiConfig) { - // Build for all configurations - for (std::string const& config : this->ConfigsList) { - cmCustomCommandLine currentLine; - currentLine.push_back(cmSystemTools::GetCMakeCommand()); - currentLine.push_back("-E"); - currentLine.push_back("cmake_autorcc"); - currentLine.push_back(qrc.InfoFile); - currentLine.push_back(config); - commandLines.push_back(std::move(currentLine)); + // RCC resources + for (Qrc& qrc : this->Rcc.Qrcs) { + if (!qrc.Generated) { + std::string error; + if (!RccListInputs(qrc.QrcFile, qrc.Resources, error)) { + cmSystemTools::Error(error.c_str()); + return false; } - } else { - cmCustomCommandLine currentLine; - currentLine.push_back(cmSystemTools::GetCMakeCommand()); - currentLine.push_back("-E"); - currentLine.push_back("cmake_autorcc"); - currentLine.push_back(qrc.InfoFile); - currentLine.push_back("$<CONFIG>"); - commandLines.push_back(std::move(currentLine)); } - std::string ccComment = "Automatic RCC for "; - ccComment += FileProjectRelativePath(makefile, qrc.QrcFile); + } + } - if (qrc.Generated) { - // Create custom rcc target - std::string ccName; - { - ccName = this->Target->GetName(); - ccName += "_arcc_"; - ccName += qrc.QrcName; - if (!qrc.Unique) { - ccName += "_"; - ccName += qrc.PathChecksum; - } - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom target dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); - - cmTarget* autoRccTarget = makefile->AddUtilityCommand( - ccName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false, - ccComment.c_str()); - // Create autogen generator target - localGen->AddGeneratorTarget( - new cmGeneratorTarget(autoRccTarget, localGen)); - - // Set FOLDER property in autogen target - if (!this->AutogenFolder.empty()) { - autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); - } - } - // Add autogen target to the origin target dependencies - this->Target->Target->AddUtility(ccName, makefile); - } else { - // Create custom rcc command - { - std::vector<std::string> ccByproducts; - std::vector<std::string> ccDepends; - // Add the .qrc and info file to the custom command dependencies - ccDepends.push_back(qrc.QrcFile); - ccDepends.push_back(qrc.InfoFile); + return true; +} - // Add the resource files to the dependencies - { - std::string error; - if (RccListInputs(qrc.QrcFile, qrc.Resources, error)) { - for (std::string const& fileName : qrc.Resources) { - // Add resource file to the custom command dependencies - ccDepends.push_back(fileName); - } - } else { - cmSystemTools::Error(error.c_str()); - } - } - makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, - /*main_dependency*/ std::string(), - commandLines, ccComment.c_str(), - this->DirWork.c_str()); - } - // Reconfigure when .qrc file changes - makefile->AddCMakeDependFile(qrc.QrcFile); +bool cmQtAutoGenInitializer::InitAutogenTarget() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator(); + + // Register info file as generated by CMake + makefile->AddCMakeOutputFile(this->AutogenInfoFile); + + // Files provided by the autogen target + std::vector<std::string> autogenProvides; + if (this->Moc.Enabled) { + this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC); + autogenProvides.push_back(this->Moc.MocsCompilation); + } + + // Compose target comment + std::string autogenComment; + { + std::string tools; + if (this->Moc.Enabled) { + tools += "MOC"; + } + if (this->Uic.Enabled) { + if (!tools.empty()) { + tools += " and "; } + tools += "UIC"; } + autogenComment = "Automatic "; + autogenComment += tools; + autogenComment += " for target "; + autogenComment += this->Target->GetName(); } - // Create _autogen target - if (this->MocEnabled || this->UicEnabled) { - // Add user defined autogen target dependencies - { - std::string const deps = - GetSafeProperty(this->Target, "AUTOGEN_TARGET_DEPENDS"); - if (!deps.empty()) { - std::vector<std::string> extraDeps; - cmSystemTools::ExpandListArgument(deps, extraDeps); - for (std::string const& depName : extraDeps) { - // Allow target and file dependencies - auto* depTarget = makefile->FindTargetToUse(depName); - if (depTarget != nullptr) { - autogenDependTargets.insert(depTarget); - } else { - autogenDependFiles.insert(depName); - } - } - } + // Compose command lines + cmCustomCommandLines commandLines; + { + cmCustomCommandLine currentLine; + currentLine.push_back(cmSystemTools::GetCMakeCommand()); + currentLine.push_back("-E"); + currentLine.push_back("cmake_autogen"); + currentLine.push_back(this->AutogenInfoFile); + currentLine.push_back("$<CONFIGURATION>"); + commandLines.push_back(std::move(currentLine)); + } + + // Use PRE_BUILD on demand + bool usePRE_BUILD = false; + if (globalGen->GetName().find("Visual Studio") != std::string::npos) { + // Under VS use a PRE_BUILD event instead of a separate target to + // reduce the number of targets loaded into the IDE. + // This also works around a VS 11 bug that may skip updating the target: + // https://connect.microsoft.com/VisualStudio/feedback/details/769495 + usePRE_BUILD = true; + } + // Disable PRE_BUILD in some cases + if (usePRE_BUILD) { + // Cannot use PRE_BUILD with file depends + if (!this->AutogenDependFiles.empty()) { + usePRE_BUILD = false; + } + } + // Create the autogen target/command + if (usePRE_BUILD) { + // Add additional autogen target dependencies to origin target + for (cmTarget* depTarget : this->AutogenDependTargets) { + this->Target->Target->AddUtility(depTarget->GetName(), makefile); } - // Compose target comment - std::string autogenComment; + // Add the pre-build command directly to bypass the OBJECT_LIBRARY + // rejection in cmMakefile::AddCustomCommandToTarget because we know + // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. + // + // PRE_BUILD does not support file dependencies! + const std::vector<std::string> no_output; + const std::vector<std::string> no_deps; + cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps, + commandLines, autogenComment.c_str(), + this->DirWork.c_str()); + cc.SetEscapeOldStyle(false); + cc.SetEscapeAllowMakeVars(true); + this->Target->Target->AddPreBuildCommand(cc); + } else { + + // Add link library target dependencies to the autogen target + // dependencies { - std::string tools; - if (this->MocEnabled) { - tools += "MOC"; + // add_dependencies/addUtility do not support generator expressions. + // We depend only on the libraries found in all configs therefore. + std::map<cmGeneratorTarget const*, std::size_t> commonTargets; + for (std::string const& config : this->ConfigsList) { + cmLinkImplementationLibraries const* libs = + this->Target->GetLinkImplementationLibraries(config); + if (libs != nullptr) { + for (cmLinkItem const& item : libs->Libraries) { + cmGeneratorTarget const* libTarget = item.Target; + if ((libTarget != nullptr) && + !StaticLibraryCycle(this->Target, libTarget, config)) { + // Increment target config count + commonTargets[libTarget]++; + } + } + } } - if (this->UicEnabled) { - if (!tools.empty()) { - tools += " and "; + for (auto const& item : commonTargets) { + if (item.second == this->ConfigsList.size()) { + this->AutogenDependTargets.insert(item.first->Target); } - tools += "UIC"; } - autogenComment = "Automatic "; - autogenComment += tools; - autogenComment += " for target "; - autogenComment += this->Target->GetName(); } - // Compose command lines + // Create autogen target + cmTarget* autogenTarget = makefile->AddUtilityCommand( + this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), /*byproducts=*/autogenProvides, + std::vector<std::string>(this->AutogenDependFiles.begin(), + this->AutogenDependFiles.end()), + commandLines, false, autogenComment.c_str()); + // Create autogen generator target + localGen->AddGeneratorTarget( + new cmGeneratorTarget(autogenTarget, localGen)); + + // Forward origin utilities to autogen target + for (std::string const& depName : this->Target->Target->GetUtilities()) { + autogenTarget->AddUtility(depName, makefile); + } + // Add additional autogen target dependencies to autogen target + for (cmTarget* depTarget : this->AutogenDependTargets) { + autogenTarget->AddUtility(depTarget->GetName(), makefile); + } + + // Set FOLDER property in autogen target + if (!this->AutogenFolder.empty()) { + autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); + } + + // Add autogen target to the origin target dependencies + this->Target->Target->AddUtility(this->AutogenTargetName, makefile); + } + + return true; +} + +bool cmQtAutoGenInitializer::InitRccTargets() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + + for (Qrc const& qrc : this->Rcc.Qrcs) { + // Register info file as generated by CMake + makefile->AddCMakeOutputFile(qrc.InfoFile); + // Register file at target + this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC); + + std::vector<std::string> ccOutput; + ccOutput.push_back(qrc.RccFile); + cmCustomCommandLines commandLines; - { + if (this->MultiConfig) { + // Build for all configurations + for (std::string const& config : this->ConfigsList) { + cmCustomCommandLine currentLine; + currentLine.push_back(cmSystemTools::GetCMakeCommand()); + currentLine.push_back("-E"); + currentLine.push_back("cmake_autorcc"); + currentLine.push_back(qrc.InfoFile); + currentLine.push_back(config); + commandLines.push_back(std::move(currentLine)); + } + } else { cmCustomCommandLine currentLine; currentLine.push_back(cmSystemTools::GetCMakeCommand()); currentLine.push_back("-E"); - currentLine.push_back("cmake_autogen"); - currentLine.push_back(this->AutogenInfoFile); - currentLine.push_back("$<CONFIGURATION>"); + currentLine.push_back("cmake_autorcc"); + currentLine.push_back(qrc.InfoFile); + currentLine.push_back("$<CONFIG>"); commandLines.push_back(std::move(currentLine)); } + std::string ccComment = "Automatic RCC for "; + ccComment += FileProjectRelativePath(makefile, qrc.QrcFile); - // Use PRE_BUILD on demand - bool usePRE_BUILD = false; - if (globalGen->GetName().find("Visual Studio") != std::string::npos) { - // Under VS use a PRE_BUILD event instead of a separate target to - // reduce the number of targets loaded into the IDE. - // This also works around a VS 11 bug that may skip updating the target: - // https://connect.microsoft.com/VisualStudio/feedback/details/769495 - usePRE_BUILD = true; - } - // Disable PRE_BUILD in some cases - if (usePRE_BUILD) { - // Cannot use PRE_BUILD with file depends - if (!autogenDependFiles.empty()) { - usePRE_BUILD = false; - } - } - // Create the autogen target/command - if (usePRE_BUILD) { - // Add additional autogen target dependencies to origin target - for (cmTarget* depTarget : autogenDependTargets) { - this->Target->Target->AddUtility(depTarget->GetName(), makefile); - } - - // Add the pre-build command directly to bypass the OBJECT_LIBRARY - // rejection in cmMakefile::AddCustomCommandToTarget because we know - // PRE_BUILD will work for an OBJECT_LIBRARY in this specific case. - // - // PRE_BUILD does not support file dependencies! - const std::vector<std::string> no_output; - const std::vector<std::string> no_deps; - cmCustomCommand cc(makefile, no_output, autogenProvides, no_deps, - commandLines, autogenComment.c_str(), - this->DirWork.c_str()); - cc.SetEscapeOldStyle(false); - cc.SetEscapeAllowMakeVars(true); - this->Target->Target->AddPreBuildCommand(cc); - } else { - - // Add link library target dependencies to the autogen target - // dependencies + if (qrc.Generated) { + // Create custom rcc target + std::string ccName; { - // add_dependencies/addUtility do not support generator expressions. - // We depend only on the libraries found in all configs therefore. - std::map<cmGeneratorTarget const*, std::size_t> commonTargets; - for (std::string const& config : this->ConfigsList) { - cmLinkImplementationLibraries const* libs = - this->Target->GetLinkImplementationLibraries(config); - if (libs != nullptr) { - for (cmLinkItem const& item : libs->Libraries) { - cmGeneratorTarget const* libTarget = item.Target; - if ((libTarget != nullptr) && - !StaticLibraryCycle(this->Target, libTarget, config)) { - // Increment target config count - commonTargets[libTarget]++; - } - } - } + ccName = this->Target->GetName(); + ccName += "_arcc_"; + ccName += qrc.QrcName; + if (!qrc.Unique) { + ccName += "_"; + ccName += qrc.PathChecksum; } - for (auto const& item : commonTargets) { - if (item.second == this->ConfigsList.size()) { - autogenDependTargets.insert(item.first->Target); - } + std::vector<std::string> ccDepends; + // Add the .qrc and info file to the custom target dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + + cmTarget* autoRccTarget = makefile->AddUtilityCommand( + ccName, cmMakefile::TargetOrigin::Generator, true, + this->DirWork.c_str(), ccOutput, ccDepends, commandLines, false, + ccComment.c_str()); + // Create autogen generator target + localGen->AddGeneratorTarget( + new cmGeneratorTarget(autoRccTarget, localGen)); + + // Set FOLDER property in autogen target + if (!this->AutogenFolder.empty()) { + autoRccTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); } } - - // Create autogen target - cmTarget* autogenTarget = makefile->AddUtilityCommand( - this->AutogenTargetName, cmMakefile::TargetOrigin::Generator, true, - this->DirWork.c_str(), /*byproducts=*/autogenProvides, - std::vector<std::string>(autogenDependFiles.begin(), - autogenDependFiles.end()), - commandLines, false, autogenComment.c_str()); - // Create autogen generator target - localGen->AddGeneratorTarget( - new cmGeneratorTarget(autogenTarget, localGen)); - - // Forward origin utilities to autogen target - for (std::string const& depName : this->Target->Target->GetUtilities()) { - autogenTarget->AddUtility(depName, makefile); - } - // Add additional autogen target dependencies to autogen target - for (cmTarget* depTarget : autogenDependTargets) { - autogenTarget->AddUtility(depTarget->GetName(), makefile); - } - - // Set FOLDER property in autogen target - if (!this->AutogenFolder.empty()) { - autogenTarget->SetProperty("FOLDER", this->AutogenFolder.c_str()); - } - // Add autogen target to the origin target dependencies - this->Target->Target->AddUtility(this->AutogenTargetName, makefile); + this->Target->Target->AddUtility(ccName, makefile); + } else { + // Create custom rcc command + { + std::vector<std::string> ccByproducts; + std::vector<std::string> ccDepends; + // Add the .qrc and info file to the custom command dependencies + ccDepends.push_back(qrc.QrcFile); + ccDepends.push_back(qrc.InfoFile); + + // Add the resource files to the dependencies + for (std::string const& fileName : qrc.Resources) { + // Add resource file to the custom command dependencies + ccDepends.push_back(fileName); + } + makefile->AddCustomCommandToOutput(ccOutput, ccByproducts, ccDepends, + /*main_dependency*/ std::string(), + commandLines, ccComment.c_str(), + this->DirWork.c_str()); + } + // Reconfigure when .qrc file changes + makefile->AddCMakeDependFile(qrc.QrcFile); } } + + return true; } -void cmQtAutoGenInitializer::SetupCustomTargets() +bool cmQtAutoGenInitializer::SetupCustomTargets() { - cmMakefile* makefile = this->Target->Target->GetMakefile(); - // Create info directory on demand if (!cmSystemTools::MakeDirectory(this->DirInfo)) { - std::string emsg = ("Could not create directory: "); + std::string emsg = ("AutoGen: Could not create directory: "); emsg += Quoted(this->DirInfo); cmSystemTools::Error(emsg.c_str()); - } - - // Configuration include directories - std::string includeDir = "include"; - std::map<std::string, std::string> includeDirs; - for (std::string const& cfg : this->ConfigsList) { - std::string& dir = includeDirs[cfg]; - dir = "include_"; - dir += cfg; + return false; } // Generate autogen target info file - if (this->MocEnabled || this->UicEnabled) { - if (this->MocEnabled) { - this->SetupCustomTargetsMoc(); + if (this->Moc.Enabled || this->Uic.Enabled) { + // Write autogen target info files + if (!this->SetupWriteAutogenInfo()) { + return false; } - if (this->UicEnabled) { - this->SetupCustomTargetsUic(); + } + + // Write AUTORCC info files + if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) { + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() +{ + cmMakefile* makefile = this->Target->Target->GetMakefile(); + + cmGeneratedFileStream ofs; + ofs.SetCopyIfDifferent(true); + ofs.Open(this->AutogenInfoFile, false, true); + if (ofs) { + // Utility lambdas + auto CWrite = [&ofs](const char* key, std::string const& value) { + ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) + << ")\n"; + }; + auto CWriteList = [&CWrite](const char* key, + std::vector<std::string> const& list) { + CWrite(key, cmJoin(list, ";")); + }; + auto CWriteNestedLists = + [&CWrite](const char* key, + std::vector<std::vector<std::string>> const& lists) { + std::vector<std::string> seplist; + for (const std::vector<std::string>& list : lists) { + std::string blist = "{"; + blist += cmJoin(list, ";"); + blist += "}"; + seplist.push_back(std::move(blist)); + } + CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep)); + }; + auto CWriteSet = [&CWrite](const char* key, + std::set<std::string> const& list) { + CWrite(key, cmJoin(list, ";")); + }; + auto CWriteMap = [&ofs](const char* key, + std::map<std::string, std::string> const& map) { + for (auto const& item : map) { + ofs << "set(" << key << "_" << item.first << " " + << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; + } + }; + auto MfDef = [makefile](const char* key) { + return std::string(makefile->GetSafeDefinition(key)); + }; + + // Write + ofs << "# Meta\n"; + CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); + CWrite("AM_PARALLEL", this->Parallel); + CWrite("AM_VERBOSITY", this->Verbosity); + + ofs << "# Directories\n"; + CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); + CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR")); + CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR")); + CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR")); + CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", + MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); + CWrite("AM_BUILD_DIR", this->DirBuild); + CWrite("AM_INCLUDE_DIR", this->DirInclude); + CWriteMap("AM_INCLUDE_DIR", this->DirConfigInclude); + + ofs << "# Files\n"; + CWriteList("AM_SOURCES", this->MocUic.Sources); + CWriteList("AM_HEADERS", this->MocUic.Headers); + CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); + CWriteMap("AM_SETTINGS_FILE", this->AutogenConfigSettingsFile); + + ofs << "# Qt\n"; + CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); + CWrite("AM_QT_MOC_EXECUTABLE", this->Moc.Executable); + CWrite("AM_QT_UIC_EXECUTABLE", this->Uic.Executable); + + if (this->Moc.Enabled) { + ofs << "# MOC settings\n"; + CWriteSet("AM_MOC_SKIP", this->Moc.Skip); + CWrite("AM_MOC_DEFINITIONS", this->Moc.Defines); + CWriteMap("AM_MOC_DEFINITIONS", this->Moc.ConfigDefines); + CWrite("AM_MOC_INCLUDES", this->Moc.Includes); + CWriteMap("AM_MOC_INCLUDES", this->Moc.ConfigIncludes); + CWrite("AM_MOC_OPTIONS", + this->Target->GetSafeProperty("AUTOMOC_MOC_OPTIONS")); + CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); + CWrite("AM_MOC_MACRO_NAMES", + this->Target->GetSafeProperty("AUTOMOC_MACRO_NAMES")); + CWrite("AM_MOC_DEPEND_FILTERS", + this->Target->GetSafeProperty("AUTOMOC_DEPEND_FILTERS")); + CWrite("AM_MOC_PREDEFS_CMD", this->Moc.PredefsCmd); } - // Parallel processing - this->Parallel = GetSafeProperty(this->Target, "AUTOGEN_PARALLEL"); - if (this->Parallel.empty() || (this->Parallel == "AUTO")) { - // Autodetect number of CPUs - this->Parallel = std::to_string(GetParallelCPUCount()); + if (this->Uic.Enabled) { + ofs << "# UIC settings\n"; + CWriteSet("AM_UIC_SKIP", this->Uic.Skip); + CWrite("AM_UIC_TARGET_OPTIONS", this->Uic.Options); + CWriteMap("AM_UIC_TARGET_OPTIONS", this->Uic.ConfigOptions); + CWriteList("AM_UIC_OPTIONS_FILES", this->Uic.FileFiles); + CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->Uic.FileOptions); + CWriteList("AM_UIC_SEARCH_PATHS", this->Uic.SearchPaths); } + } else { + std::string err = "AutoGen: Could not write file "; + err += this->AutogenInfoFile; + cmSystemTools::Error(err.c_str()); + return false; + } + + return true; +} +bool cmQtAutoGenInitializer::SetupWriteRccInfo() +{ + for (Qrc const& qrc : this->Rcc.Qrcs) { cmGeneratedFileStream ofs; ofs.SetCopyIfDifferent(true); - ofs.Open(this->AutogenInfoFile.c_str(), false, true); + ofs.Open(qrc.InfoFile, false, true); if (ofs) { // Utility lambdas auto CWrite = [&ofs](const char* key, std::string const& value) { ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value) << ")\n"; }; - auto CWriteList = [&CWrite](const char* key, - std::vector<std::string> const& list) { - CWrite(key, cmJoin(list, ";")); - }; - auto CWriteNestedLists = - [&CWrite](const char* key, - std::vector<std::vector<std::string>> const& lists) { - std::vector<std::string> seplist; - for (const std::vector<std::string>& list : lists) { - std::string blist = "{"; - blist += cmJoin(list, ";"); - blist += "}"; - seplist.push_back(std::move(blist)); - } - CWrite(key, cmJoin(seplist, cmQtAutoGen::ListSep)); - }; - auto CWriteSet = [&CWrite](const char* key, - std::set<std::string> const& list) { - CWrite(key, cmJoin(list, ";")); - }; auto CWriteMap = [&ofs](const char* key, std::map<std::string, std::string> const& map) { for (auto const& item : map) { @@ -936,334 +1197,40 @@ void cmQtAutoGenInitializer::SetupCustomTargets() << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; } }; - auto MfDef = [makefile](const char* key) { - return std::string(makefile->GetSafeDefinition(key)); - }; // Write - ofs << "# Meta\n"; - CWrite("AM_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - CWrite("AM_PARALLEL", this->Parallel); + ofs << "# Configurations\n"; + CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); + CWrite("ARCC_VERBOSITY", this->Verbosity); + ofs << "# Settings file\n"; + CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); + CWriteMap("ARCC_SETTINGS_FILE", qrc.ConfigSettingsFile); ofs << "# Directories\n"; - CWrite("AM_CMAKE_SOURCE_DIR", MfDef("CMAKE_SOURCE_DIR")); - CWrite("AM_CMAKE_BINARY_DIR", MfDef("CMAKE_BINARY_DIR")); - CWrite("AM_CMAKE_CURRENT_SOURCE_DIR", MfDef("CMAKE_CURRENT_SOURCE_DIR")); - CWrite("AM_CMAKE_CURRENT_BINARY_DIR", MfDef("CMAKE_CURRENT_BINARY_DIR")); - CWrite("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE", - MfDef("CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE")); - CWrite("AM_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("AM_INCLUDE_DIR", includeDirs); - } else { - CWrite("AM_INCLUDE_DIR", includeDir); - } - - ofs << "# Files\n"; - CWriteList("AM_SOURCES", this->Sources); - CWriteList("AM_HEADERS", this->Headers); - if (this->MultiConfig) { - std::map<std::string, std::string> settingsFiles; - for (std::string const& cfg : this->ConfigsList) { - settingsFiles[cfg] = - AppendFilenameSuffix(this->AutogenSettingsFile, "_" + cfg); - } - CWriteMap("AM_SETTINGS_FILE", settingsFiles); - } else { - CWrite("AM_SETTINGS_FILE", this->AutogenSettingsFile); - } - - ofs << "# Qt\n"; - CWrite("AM_QT_VERSION_MAJOR", this->QtVersionMajor); - CWrite("AM_QT_MOC_EXECUTABLE", this->MocExecutable); - CWrite("AM_QT_UIC_EXECUTABLE", this->UicExecutable); - - if (this->MocEnabled) { - ofs << "# MOC settings\n"; - CWriteSet("AM_MOC_SKIP", this->MocSkip); - CWrite("AM_MOC_DEFINITIONS", this->MocDefines); - CWriteMap("AM_MOC_DEFINITIONS", this->MocDefinesConfig); - CWrite("AM_MOC_INCLUDES", this->MocIncludes); - CWriteMap("AM_MOC_INCLUDES", this->MocIncludesConfig); - CWrite("AM_MOC_OPTIONS", - GetSafeProperty(this->Target, "AUTOMOC_MOC_OPTIONS")); - CWrite("AM_MOC_RELAXED_MODE", MfDef("CMAKE_AUTOMOC_RELAXED_MODE")); - CWrite("AM_MOC_MACRO_NAMES", - GetSafeProperty(this->Target, "AUTOMOC_MACRO_NAMES")); - CWrite("AM_MOC_DEPEND_FILTERS", - GetSafeProperty(this->Target, "AUTOMOC_DEPEND_FILTERS")); - CWrite("AM_MOC_PREDEFS_CMD", this->MocPredefsCmd); - } - - if (this->UicEnabled) { - ofs << "# UIC settings\n"; - CWriteSet("AM_UIC_SKIP", this->UicSkip); - CWrite("AM_UIC_TARGET_OPTIONS", this->UicOptions); - CWriteMap("AM_UIC_TARGET_OPTIONS", this->UicOptionsConfig); - CWriteList("AM_UIC_OPTIONS_FILES", this->UicFileFiles); - CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions); - CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths); - } - } else { - return; - } - } - - // Generate auto RCC info files - if (this->RccEnabled) { - for (Qrc const& qrc : this->Qrcs) { - // Register rcc info file as generated - makefile->AddCMakeOutputFile(qrc.InfoFile); - - cmGeneratedFileStream ofs; - ofs.SetCopyIfDifferent(true); - ofs.Open(qrc.InfoFile.c_str(), false, true); - if (ofs) { - // Utility lambdas - auto CWrite = [&ofs](const char* key, std::string const& value) { - ofs << "set(" << key << " " - << cmOutputConverter::EscapeForCMake(value) << ")\n"; - }; - auto CWriteMap = - [&ofs](const char* key, - std::map<std::string, std::string> const& map) { - for (auto const& item : map) { - ofs << "set(" << key << "_" << item.first << " " - << cmOutputConverter::EscapeForCMake(item.second) << ")\n"; - } - }; - - // Write - ofs << "# Configurations\n"; - CWrite("ARCC_MULTI_CONFIG", this->MultiConfig ? "TRUE" : "FALSE"); - - ofs << "# Settings file\n"; - if (this->MultiConfig) { - std::map<std::string, std::string> settingsFiles; - for (std::string const& cfg : this->ConfigsList) { - settingsFiles[cfg] = - AppendFilenameSuffix(qrc.SettingsFile, "_" + cfg); - } - CWriteMap("ARCC_SETTINGS_FILE", settingsFiles); - } else { - CWrite("ARCC_SETTINGS_FILE", qrc.SettingsFile); - } - - ofs << "# Directories\n"; - CWrite("ARCC_BUILD_DIR", this->DirBuild); - if (this->MultiConfig) { - CWriteMap("ARCC_INCLUDE_DIR", includeDirs); - } else { - CWrite("ARCC_INCLUDE_DIR", includeDir); - } - - ofs << "# Rcc executable\n"; - CWrite("ARCC_RCC_EXECUTABLE", this->RccExecutable); - CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->RccListOptions, ";")); - - ofs << "# Rcc job\n"; - CWrite("ARCC_LOCK_FILE", qrc.LockFile); - CWrite("ARCC_SOURCE", qrc.QrcFile); - CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum); - CWrite("ARCC_OUTPUT_NAME", - cmSystemTools::GetFilenameName(qrc.RccFile)); - CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); - CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); - } else { - return; - } - } - } -} - -void cmQtAutoGenInitializer::SetupCustomTargetsMoc() -{ - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - cmMakefile* makefile = this->Target->Target->GetMakefile(); - - // Moc predefs command - if (this->Target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES") && - this->QtVersionGreaterOrEqual(5, 8)) { - this->MocPredefsCmd = - makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND"); - } - - // Moc includes and compile definitions - { - auto GetIncludeDirs = [this, - localGen](std::string const& cfg) -> std::string { - // Get the include dirs for this target, without stripping the implicit - // include dirs off, see - // https://gitlab.kitware.com/cmake/cmake/issues/13667 - std::vector<std::string> includeDirs; - localGen->GetIncludeDirectories(includeDirs, this->Target, "CXX", cfg, - false); - return cmJoin(includeDirs, ";"); - }; - auto GetCompileDefinitions = - [this, localGen](std::string const& cfg) -> std::string { - std::set<std::string> defines; - localGen->AddCompileDefinitions(defines, this->Target, cfg, "CXX"); - return cmJoin(defines, ";"); - }; - - // Default configuration settings - this->MocIncludes = GetIncludeDirs(this->ConfigDefault); - this->MocDefines = GetCompileDefinitions(this->ConfigDefault); - // Other configuration settings - for (std::string const& cfg : this->ConfigsList) { - { - std::string const configIncludeDirs = GetIncludeDirs(cfg); - if (configIncludeDirs != this->MocIncludes) { - this->MocIncludesConfig[cfg] = configIncludeDirs; - } - } - { - std::string const configCompileDefs = GetCompileDefinitions(cfg); - if (configCompileDefs != this->MocDefines) { - this->MocDefinesConfig[cfg] = configCompileDefs; - } - } - } - } - - // Moc executable - { - std::string mocExec; - std::string err; - - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt5::moc target not found"; - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::moc"); - if (tgt != nullptr) { - mocExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOMOC: Qt4::moc target not found"; - } + CWrite("ARCC_BUILD_DIR", this->DirBuild); + CWrite("ARCC_INCLUDE_DIR", this->DirInclude); + CWriteMap("ARCC_INCLUDE_DIR", this->DirConfigInclude); + + ofs << "# Rcc executable\n"; + CWrite("ARCC_RCC_EXECUTABLE", this->Rcc.Executable); + CWrite("ARCC_RCC_LIST_OPTIONS", cmJoin(this->Rcc.ListOptions, ";")); + + ofs << "# Rcc job\n"; + CWrite("ARCC_LOCK_FILE", qrc.LockFile); + CWrite("ARCC_SOURCE", qrc.QrcFile); + CWrite("ARCC_OUTPUT_CHECKSUM", qrc.PathChecksum); + CWrite("ARCC_OUTPUT_NAME", cmSystemTools::GetFilenameName(qrc.RccFile)); + CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";")); + CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";")); } else { - err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; - } - - if (err.empty()) { - this->MocExecutable = mocExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; + std::string err = "AutoRcc: Could not write file "; + err += qrc.InfoFile; cmSystemTools::Error(err.c_str()); + return false; } } -} - -void cmQtAutoGenInitializer::SetupCustomTargetsUic() -{ - cmMakefile* makefile = this->Target->Target->GetMakefile(); - - // Uic search paths - { - std::string const usp = - GetSafeProperty(this->Target, "AUTOUIC_SEARCH_PATHS"); - if (!usp.empty()) { - cmSystemTools::ExpandListArgument(usp, this->UicSearchPaths); - std::string const srcDir = makefile->GetCurrentSourceDirectory(); - for (std::string& path : this->UicSearchPaths) { - path = cmSystemTools::CollapseFullPath(path, srcDir); - } - } - } - // Uic target options - { - auto UicGetOpts = [this](std::string const& cfg) -> std::string { - std::vector<std::string> opts; - this->Target->GetAutoUicOptions(opts, cfg); - return cmJoin(opts, ";"); - }; - - // Default settings - this->UicOptions = UicGetOpts(this->ConfigDefault); - - // Configuration specific settings - for (std::string const& cfg : this->ConfigsList) { - std::string const configUicOpts = UicGetOpts(cfg); - if (configUicOpts != this->UicOptions) { - this->UicOptionsConfig[cfg] = configUicOpts; - } - } - } - // .ui files skip and options - { - std::string const uiExt = "ui"; - std::string pathError; - for (cmSourceFile* sf : makefile->GetSourceFiles()) { - // sf->GetExtension() is only valid after sf->GetFullPath() ... - // Since we're iterating over source files that might be not in the - // target we need to check for path errors (not existing files). - std::string const& fPath = sf->GetFullPath(&pathError); - if (!pathError.empty()) { - pathError.clear(); - continue; - } - if (sf->GetExtension() == uiExt) { - std::string const absFile = cmSystemTools::GetRealPath(fPath); - // Check if the .ui file should be skipped - if (sf->GetPropertyAsBool("SKIP_AUTOUIC") || - sf->GetPropertyAsBool("SKIP_AUTOGEN")) { - this->UicSkip.insert(absFile); - } - // Check if the .ui file has uic options - std::string const uicOpts = GetSafeProperty(sf, "AUTOUIC_OPTIONS"); - if (!uicOpts.empty()) { - // Check if file isn't skipped - if (this->UicSkip.count(absFile) == 0) { - this->UicFileFiles.push_back(absFile); - std::vector<std::string> optsVec; - cmSystemTools::ExpandListArgument(uicOpts, optsVec); - this->UicFileOptions.push_back(std::move(optsVec)); - } - } - } - } - } - - // Uic executable - { - std::string err; - std::string uicExec; - - cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); - if (this->QtVersionMajor == "5") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt5::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - // Project does not use Qt5Widgets, but has AUTOUIC ON anyway - } - } else if (this->QtVersionMajor == "4") { - cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse("Qt4::uic"); - if (tgt != nullptr) { - uicExec = SafeString(tgt->ImportedGetLocation("")); - } else { - err = "AUTOUIC: Qt4::uic target not found"; - } - } else { - err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; - } - if (err.empty()) { - this->UicExecutable = uicExec; - } else { - err += " ("; - err += this->Target->GetName(); - err += ")"; - cmSystemTools::Error(err.c_str()); - } - } + return true; } void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename, @@ -1333,6 +1300,202 @@ bool cmQtAutoGenInitializer::QtVersionGreaterOrEqual( return false; } +bool cmQtAutoGenInitializer::GetMocExecutable() +{ + std::string err; + + // Find moc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::moc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::moc"; + } else { + err = "The AUTOMOC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Moc.Executable = tgt->ImportedGetLocation(""); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test moc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Moc.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Moc.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The moc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The moc executable "; + err += Quoted(this->Moc.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoMoc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetUicExecutable() +{ + std::string err; + + // Find uic executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::uic"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::uic"; + } else { + err = "The AUTOUIC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Uic.Executable = tgt->ImportedGetLocation(""); + } else { + if (this->QtVersionMajor == "5") { + // Project does not use Qt5Widgets, but has AUTOUIC ON anyway + } else { + err = "Could not find target " + targetName; + } + } + } + } + + // Test uic command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Uic.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Uic.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (!result) { + err = "The uic test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The uic executable "; + err += Quoted(this->Uic.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoUic ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + +bool cmQtAutoGenInitializer::GetRccExecutable() +{ + std::string err; + + // Find rcc executable + { + std::string targetName; + if (this->QtVersionMajor == "5") { + targetName = "Qt5::rcc"; + } else if (QtVersionMajor == "4") { + targetName = "Qt4::rcc"; + } else { + err = "The AUTORCC feature supports only Qt 4 and Qt 5"; + } + if (!targetName.empty()) { + cmLocalGenerator* localGen = this->Target->GetLocalGenerator(); + cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName); + if (tgt != nullptr) { + this->Rcc.Executable = tgt->ImportedGetLocation(""); + } else { + err = "Could not find target " + targetName; + } + } + } + + // Test rcc command + if (err.empty()) { + if (cmSystemTools::FileExists(this->Rcc.Executable, true)) { + std::vector<std::string> command; + command.push_back(this->Rcc.Executable); + command.push_back("-h"); + std::string stdOut; + std::string stdErr; + int retVal = 0; + bool result = cmSystemTools::RunSingleCommand( + command, &stdOut, &stdErr, &retVal, nullptr, + cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto); + if (result) { + // Detect if rcc supports (-)-list + if (this->QtVersionMajor == "5") { + if (stdOut.find("--list") != std::string::npos) { + this->Rcc.ListOptions.push_back("--list"); + } else { + this->Rcc.ListOptions.push_back("-list"); + } + } + } else { + err = "The rcc test command failed: "; + err += QuotedCommand(command); + } + } else { + err = "The rcc executable "; + err += Quoted(this->Rcc.Executable); + err += " does not exist"; + } + } + + // Print error + if (!err.empty()) { + std::string msg = "AutoRcc ("; + msg += this->Target->GetName(); + msg += "): "; + msg += err; + cmSystemTools::Error(msg.c_str()); + return false; + } + + return true; +} + /// @brief Reads the resource files list from from a .qrc file /// @arg fileName Must be the absolute path of the .qrc file /// @return True if the rcc file was successfully read @@ -1346,9 +1509,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, error += "\n"; return false; } - if (!RccListOptions.empty()) { + if (!this->Rcc.ListOptions.empty()) { // Use rcc for file listing - if (RccExecutable.empty()) { + if (this->Rcc.Executable.empty()) { error = "rcc executable not available"; return false; } @@ -1367,8 +1530,9 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName, std::string rccStdErr; { std::vector<std::string> cmd; - cmd.push_back(RccExecutable); - cmd.insert(cmd.end(), RccListOptions.begin(), RccListOptions.end()); + cmd.push_back(this->Rcc.Executable); + cmd.insert(cmd.end(), this->Rcc.ListOptions.begin(), + this->Rcc.ListOptions.end()); cmd.push_back(fileNameName); result = cmSystemTools::RunSingleCommand( cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(), diff --git a/Source/cmQtAutoGenInitializer.h b/Source/cmQtAutoGenInitializer.h index 5fbf0cb..16f9cdd 100644 --- a/Source/cmQtAutoGenInitializer.h +++ b/Source/cmQtAutoGenInitializer.h @@ -12,6 +12,7 @@ #include <vector> class cmGeneratorTarget; +class cmTarget; /// @brief Initializes the QtAutoGen generators class cmQtAutoGenInitializer : public cmQtAutoGen @@ -38,6 +39,7 @@ public: std::string PathChecksum; std::string InfoFile; std::string SettingsFile; + std::map<std::string, std::string> ConfigSettingsFile; std::string RccFile; bool Generated; bool Unique; @@ -50,67 +52,101 @@ public: bool uicEnabled, bool rccEnabled, std::string const& qtVersionMajor); - void InitCustomTargets(); - void SetupCustomTargets(); + bool InitCustomTargets(); + bool SetupCustomTargets(); private: - void SetupCustomTargetsMoc(); - void SetupCustomTargetsUic(); + bool InitMoc(); + bool InitUic(); + bool InitRcc(); + + bool InitScanFiles(); + bool InitAutogenTarget(); + bool InitRccTargets(); + + bool SetupWriteAutogenInfo(); + bool SetupWriteRccInfo(); void AddGeneratedSource(std::string const& filename, GeneratorT genType); bool QtVersionGreaterOrEqual(unsigned long requestMajor, unsigned long requestMinor) const; + bool GetMocExecutable(); + bool GetUicExecutable(); + bool GetRccExecutable(); + bool RccListInputs(std::string const& fileName, std::vector<std::string>& files, std::string& errorMessage); private: cmGeneratorTarget* Target; - bool MocEnabled; - bool UicEnabled; - bool RccEnabled; - bool MultiConfig; + bool MultiConfig = false; // Qt std::string QtVersionMajor; std::string QtVersionMinor; - std::string MocExecutable; - std::string UicExecutable; - std::string RccExecutable; - std::vector<std::string> RccListOptions; // Configurations std::string ConfigDefault; std::vector<std::string> ConfigsList; std::string Parallel; + std::string Verbosity; // Names std::string AutogenTargetName; std::string AutogenFolder; std::string AutogenInfoFile; std::string AutogenSettingsFile; + std::map<std::string, std::string> AutogenConfigSettingsFile; + std::set<std::string> AutogenDependFiles; + std::set<cmTarget*> AutogenDependTargets; // Directories std::string DirInfo; std::string DirBuild; std::string DirWork; - // Sources - std::vector<std::string> Headers; - std::vector<std::string> Sources; + std::string DirInclude; + std::map<std::string, std::string> DirConfigInclude; + // Moc and UIC + struct + { + // Sources + std::vector<std::string> Headers; + std::vector<std::string> Sources; + std::vector<std::string> HeadersGenerated; + std::vector<std::string> SourcesGenerated; + } MocUic; // Moc - std::string MocPredefsCmd; - std::set<std::string> MocSkip; - std::string MocIncludes; - std::map<std::string, std::string> MocIncludesConfig; - std::string MocDefines; - std::map<std::string, std::string> MocDefinesConfig; + struct + { + bool Enabled = false; + std::string Executable; + std::string PredefsCmd; + std::set<std::string> Skip; + std::string Includes; + std::map<std::string, std::string> ConfigIncludes; + std::string Defines; + std::map<std::string, std::string> ConfigDefines; + std::string MocsCompilation; + } Moc; // Uic - std::set<std::string> UicSkip; - std::vector<std::string> UicSearchPaths; - std::string UicOptions; - std::map<std::string, std::string> UicOptionsConfig; - std::vector<std::string> UicFileFiles; - std::vector<std::vector<std::string>> UicFileOptions; + struct + { + bool Enabled = false; + std::string Executable; + std::set<std::string> Skip; + std::vector<std::string> SearchPaths; + std::string Options; + std::map<std::string, std::string> ConfigOptions; + std::vector<std::string> FileFiles; + std::vector<std::vector<std::string>> FileOptions; + } Uic; // Rcc - std::vector<Qrc> Qrcs; + struct + { + bool Enabled = false; + std::string Executable; + std::vector<std::string> ListOptions; + std::vector<Qrc> Qrcs; + } Rcc; }; #endif diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 7aa792f..64ce0e3 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -17,9 +17,14 @@ // -- Class methods -void cmQtAutoGenerator::Logger::SetVerbose(bool value) +void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { - Verbose_ = value; + unsigned long verbosity = 0; + if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) { + if (this->Verbosity_ < verbosity) { + this->Verbosity_ = static_cast<unsigned int>(verbosity); + } + } } void cmQtAutoGenerator::Logger::SetColorOutput(bool value) @@ -632,7 +637,18 @@ cmQtAutoGenerator::cmQtAutoGenerator() : FileSys_(&Logger_) { // Initialize logger - Logger_.SetVerbose(cmSystemTools::HasEnv("VERBOSE")); + { + std::string verbose; + if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { + unsigned long iVerbose = 0; + if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { + Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose)); + } else { + // Non numeric verbosity + Logger_.SetVerbose(cmSystemTools::IsOn(verbose.c_str())); + } + } + } { std::string colorEnv; cmSystemTools::GetEnv("COLOR", colorEnv); diff --git a/Source/cmQtAutoGenerator.h b/Source/cmQtAutoGenerator.h index 4e38413..75143f5 100644 --- a/Source/cmQtAutoGenerator.h +++ b/Source/cmQtAutoGenerator.h @@ -33,8 +33,11 @@ public: { public: // -- Verbosity - bool Verbose() const { return this->Verbose_; } - void SetVerbose(bool value); + unsigned int Verbosity() const { return this->Verbosity_; } + void SetVerbosity(unsigned int value) { this->Verbosity_ = value; } + void RaiseVerbosity(std::string const& value); + bool Verbose() const { return (this->Verbosity_ != 0); } + void SetVerbose(bool value) { this->Verbosity_ = value ? 1 : 0; } bool ColorOutput() const { return this->ColorOutput_; } void SetColorOutput(bool value); // -- Log info @@ -56,8 +59,8 @@ public: private: std::mutex Mutex_; - bool volatile Verbose_ = false; - bool volatile ColorOutput_ = false; + unsigned int Verbosity_ = 0; + bool ColorOutput_ = false; }; /// @brief Thread safe file system interface diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index f196b97..c364700 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -1222,6 +1222,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) } // -- Meta + Log().RaiseVerbosity(InfoGet("AM_VERBOSITY")); Base_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG"); { unsigned long num = Base_.NumThreads; @@ -1246,14 +1247,11 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile) return false; } // include directory - { - std::string dirRel = InfoGetConfig("AM_INCLUDE_DIR"); - if (dirRel.empty()) { - Log().ErrorFile(GeneratorT::GEN, InfoFile(), - "Autogen include directory missing"); - return false; - } - Base_.AutogenIncludeDir = Base_.AbsoluteBuildPath(dirRel); + Base_.AutogenIncludeDir = InfoGetConfig("AM_INCLUDE_DIR"); + if (Base_.AutogenIncludeDir.empty()) { + Log().ErrorFile(GeneratorT::GEN, InfoFile(), + "Autogen include directory missing"); + return false; } // - Files diff --git a/Source/cmQtAutoGeneratorRcc.cxx b/Source/cmQtAutoGeneratorRcc.cxx index 3064895..6caa0d8 100644 --- a/Source/cmQtAutoGeneratorRcc.cxx +++ b/Source/cmQtAutoGeneratorRcc.cxx @@ -70,6 +70,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) } // - Configurations + Log().RaiseVerbosity(InfoGet("ARCC_VERBOSITY")); MultiConfig_ = makefile->IsOn("ARCC_MULTI_CONFIG"); // - Directories @@ -140,9 +141,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile) // Compute rcc output file name if (IsMultiConfig()) { - RccFileOutput_ = AutogenBuildDir_; - RccFileOutput_ += '/'; - RccFileOutput_ += IncludeDir_; + RccFileOutput_ = IncludeDir_; RccFileOutput_ += '/'; RccFileOutput_ += MultiConfigOutput(); } else { diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 12817ae..32ad0b0 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -34,7 +34,7 @@ cmRST::cmRST(std::ostream& os, std::string const& docroot) , NoteDirective("^.. note::[ \t]*(.*)$") , ModuleRST("^#\\[(=*)\\[\\.rst:$") , CMakeRole("(:cmake)?:(" - "command|generator|variable|envvar|module|policy|" + "command|cpack_gen|generator|variable|envvar|module|policy|" "prop_cache|prop_dir|prop_gbl|prop_inst|prop_sf|" "prop_test|prop_tgt|" "manual" diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6792d66..05e26ea 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -296,6 +296,15 @@ const char* cmSourceFile::GetProperty(const std::string& prop) const return retVal; } +const char* cmSourceFile::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmSourceFile.h b/Source/cmSourceFile.h index 1516d98..ab0f229 100644 --- a/Source/cmSourceFile.h +++ b/Source/cmSourceFile.h @@ -45,7 +45,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; /** Implement getting a property when called from a CMake language diff --git a/Source/cmState.cxx b/Source/cmState.cxx index a57be4d..dcf6ea0 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -280,6 +280,8 @@ cmStateSnapshot cmState::Reset() it->CompileDefinitionsBacktraces.clear(); it->CompileOptions.clear(); it->CompileOptionsBacktraces.clear(); + it->LinkOptions.clear(); + it->LinkOptionsBacktraces.clear(); it->DirectoryEnd = pos; it->NormalTargetNames.clear(); it->Properties.clear(); diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx index 85e6366..6eac8e2 100644 --- a/Source/cmStateDirectory.cxx +++ b/Source/cmStateDirectory.cxx @@ -360,6 +360,42 @@ void cmStateDirectory::ClearCompileOptions() this->Snapshot_.Position->CompileOptionsPosition); } +cmStringRange cmStateDirectory::GetLinkOptionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->LinkOptions, + this->Snapshot_.Position->LinkOptionsPosition); +} + +cmBacktraceRange cmStateDirectory::GetLinkOptionsEntryBacktraces() const +{ + return GetPropertyBacktraces(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition); +} + +void cmStateDirectory::AppendLinkOptionsEntry(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::SetLinkOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::ClearLinkOptions() +{ + ClearContent(this->DirectoryState->LinkOptions, + this->DirectoryState->LinkOptionsBacktraces, + this->Snapshot_.Position->LinkOptionsPosition); +} + void cmStateDirectory::SetProperty(const std::string& prop, const char* value, cmListFileBacktrace const& lfbt) { @@ -387,6 +423,14 @@ void cmStateDirectory::SetProperty(const std::string& prop, const char* value, this->SetCompileDefinitions(value, lfbt); return; } + if (prop == "LINK_OPTIONS") { + if (!value) { + this->ClearLinkOptions(); + return; + } + this->SetLinkOptions(value, lfbt); + return; + } this->DirectoryState->Properties.SetProperty(prop, value); } @@ -407,6 +451,10 @@ void cmStateDirectory::AppendProperty(const std::string& prop, this->AppendCompileDefinitionsEntry(value, lfbt); return; } + if (prop == "LINK_OPTIONS") { + this->AppendLinkOptionsEntry(value, lfbt); + return; + } this->DirectoryState->Properties.AppendProperty(prop, value, asString); } @@ -490,6 +538,10 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); return output.c_str(); } + if (prop == "LINK_OPTIONS") { + output = cmJoin(this->GetLinkOptionsEntries(), ";"); + return output.c_str(); + } const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); if (!retVal && chain) { diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h index 79bb369..bc96cc9 100644 --- a/Source/cmStateDirectory.h +++ b/Source/cmStateDirectory.h @@ -58,6 +58,13 @@ public: cmListFileBacktrace const& lfbt); void ClearCompileOptions(); + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsEntryBacktraces() const; + void AppendLinkOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetLinkOptions(std::string const& vec, cmListFileBacktrace const& lfbt); + void ClearLinkOptions(); + void SetProperty(const std::string& prop, const char* value, cmListFileBacktrace const& lfbt); void AppendProperty(const std::string& prop, const char* value, diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h index f36ee37..7177221 100644 --- a/Source/cmStatePrivate.h +++ b/Source/cmStatePrivate.h @@ -42,6 +42,7 @@ struct cmStateDetail::SnapshotDataType std::vector<std::string>::size_type IncludeDirectoryPosition; std::vector<std::string>::size_type CompileDefinitionsPosition; std::vector<std::string>::size_type CompileOptionsPosition; + std::vector<std::string>::size_type LinkOptionsPosition; }; struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap @@ -84,6 +85,9 @@ struct cmStateDetail::BuildsystemDirectoryStateType std::vector<std::string> CompileOptions; std::vector<cmListFileBacktrace> CompileOptionsBacktraces; + std::vector<std::string> LinkOptions; + std::vector<cmListFileBacktrace> LinkOptionsBacktraces; + std::vector<std::string> NormalTargetNames; std::string ProjectName; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 8f5f58c..ec428a6 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -390,6 +390,13 @@ void cmStateSnapshot::InitializeFromParent() this->Position->BuildSystemDirectory->CompileOptionsBacktraces, this->Position->CompileOptionsPosition); + InitializeContentFromParent( + parent->BuildSystemDirectory->LinkOptions, + this->Position->BuildSystemDirectory->LinkOptions, + parent->BuildSystemDirectory->LinkOptionsBacktraces, + this->Position->BuildSystemDirectory->LinkOptionsBacktraces, + this->Position->LinkOptionsPosition); + const char* include_regex = parent->BuildSystemDirectory->Properties.GetPropertyValue( "INCLUDE_REGULAR_EXPRESSION"); diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index ed88a1e..1605fd7 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -273,7 +273,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) // Scan through the input for all matches. std::string output; - if (re.find(input.c_str())) { + if (re.find(input)) { this->Makefile->StoreMatches(re); std::string::size_type l = re.start(); std::string::size_type r = re.end(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1868816..380ac88 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -166,6 +166,8 @@ public: std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; std::vector<std::string> SourceEntries; std::vector<cmListFileBacktrace> SourceBacktraces; + std::vector<std::string> LinkOptionsEntries; + std::vector<cmListFileBacktrace> LinkOptionsBacktraces; std::vector<std::string> LinkImplementationPropertyEntries; std::vector<cmListFileBacktrace> LinkImplementationPropertyBacktraces; }; @@ -276,6 +278,31 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("LINK_SEARCH_START_STATIC", nullptr); this->SetPropertyDefault("LINK_SEARCH_END_STATIC", nullptr); this->SetPropertyDefault("FOLDER", nullptr); +#ifdef __APPLE__ + if (this->GetGlobalGenerator()->IsXcode()) { + this->SetPropertyDefault("XCODE_SCHEME_ADDRESS_SANITIZER", nullptr); + this->SetPropertyDefault( + "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_THREAD_SANITIZER", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_THREAD_SANITIZER_STOP", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER", + nullptr); + this->SetPropertyDefault( + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER", + nullptr); + this->SetPropertyDefault("XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP", + nullptr); + this->SetPropertyDefault("XCODE_SCHEME_MALLOC_SCRIBBLE", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_MALLOC_GUARD_EDGES", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_GUARD_MALLOC", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_ZOMBIE_OBJECTS", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_MALLOC_STACK", nullptr); + this->SetPropertyDefault("XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE", + nullptr); + this->SetPropertyDefault("XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS", nullptr); + } +#endif } // Collect the set of configuration types. @@ -343,17 +370,29 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(), parentSystemIncludes.end()); - const cmStringRange parentOptions = + const cmStringRange parentCompileOptions = this->Makefile->GetCompileOptionsEntries(); - const cmBacktraceRange parentOptionsBts = + const cmBacktraceRange parentCompileOptionsBts = this->Makefile->GetCompileOptionsBacktraces(); this->Internal->CompileOptionsEntries.insert( - this->Internal->CompileOptionsEntries.end(), parentOptions.begin(), - parentOptions.end()); + this->Internal->CompileOptionsEntries.end(), + parentCompileOptions.begin(), parentCompileOptions.end()); this->Internal->CompileOptionsBacktraces.insert( - this->Internal->CompileOptionsBacktraces.end(), parentOptionsBts.begin(), - parentOptionsBts.end()); + this->Internal->CompileOptionsBacktraces.end(), + parentCompileOptionsBts.begin(), parentCompileOptionsBts.end()); + + const cmStringRange parentLinkOptions = + this->Makefile->GetLinkOptionsEntries(); + const cmBacktraceRange parentLinkOptionsBts = + this->Makefile->GetLinkOptionsBacktraces(); + + this->Internal->LinkOptionsEntries.insert( + this->Internal->LinkOptionsEntries.end(), parentLinkOptions.begin(), + parentLinkOptions.end()); + this->Internal->LinkOptionsBacktraces.insert( + this->Internal->LinkOptionsBacktraces.end(), + parentLinkOptionsBts.begin(), parentLinkOptionsBts.end()); } if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && @@ -822,6 +861,16 @@ cmBacktraceRange cmTarget::GetSourceBacktraces() const return cmMakeRange(this->Internal->SourceBacktraces); } +cmStringRange cmTarget::GetLinkOptionsEntries() const +{ + return cmMakeRange(this->Internal->LinkOptionsEntries); +} + +cmBacktraceRange cmTarget::GetLinkOptionsBacktraces() const +{ + return cmMakeRange(this->Internal->LinkOptionsBacktraces); +} + cmStringRange cmTarget::GetLinkImplementationEntries() const { return cmMakeRange(this->Internal->LinkImplementationPropertyEntries); @@ -847,6 +896,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) MAKE_STATIC_PROP(EXPORT_NAME); MAKE_STATIC_PROP(IMPORTED_GLOBAL); MAKE_STATIC_PROP(INCLUDE_DIRECTORIES); + MAKE_STATIC_PROP(LINK_OPTIONS); MAKE_STATIC_PROP(LINK_LIBRARIES); MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES); MAKE_STATIC_PROP(NAME); @@ -925,6 +975,14 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } + } else if (prop == propLINK_OPTIONS) { + this->Internal->LinkOptionsEntries.clear(); + this->Internal->LinkOptionsBacktraces.clear(); + if (value) { + this->Internal->LinkOptionsEntries.push_back(value); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->LinkOptionsBacktraces.push_back(lfbt); + } } else if (prop == propLINK_LIBRARIES) { this->Internal->LinkImplementationPropertyEntries.clear(); this->Internal->LinkImplementationPropertyBacktraces.clear(); @@ -1030,6 +1088,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); this->Internal->CompileDefinitionsBacktraces.push_back(lfbt); } + } else if (prop == "LINK_OPTIONS") { + if (value && *value) { + this->Internal->LinkOptionsEntries.push_back(value); + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + this->Internal->LinkOptionsBacktraces.push_back(lfbt); + } } else if (prop == "LINK_LIBRARIES") { if (value && *value) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); @@ -1111,6 +1175,21 @@ void cmTarget::InsertCompileDefinition(std::string const& entry, this->Internal->CompileDefinitionsBacktraces.push_back(bt); } +void cmTarget::InsertLinkOption(std::string const& entry, + cmListFileBacktrace const& bt, bool before) +{ + std::vector<std::string>::iterator position = before + ? this->Internal->LinkOptionsEntries.begin() + : this->Internal->LinkOptionsEntries.end(); + + std::vector<cmListFileBacktrace>::iterator btPosition = before + ? this->Internal->LinkOptionsBacktraces.begin() + : this->Internal->LinkOptionsBacktraces.end(); + + this->Internal->LinkOptionsEntries.insert(position, entry); + this->Internal->LinkOptionsBacktraces.insert(btPosition, bt); +} + static void cmTargetCheckLINK_INTERFACE_LIBRARIES(const std::string& prop, const char* value, cmMakefile* context, @@ -1230,6 +1309,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const MAKE_STATIC_PROP(COMPILE_FEATURES); MAKE_STATIC_PROP(COMPILE_OPTIONS); MAKE_STATIC_PROP(COMPILE_DEFINITIONS); + MAKE_STATIC_PROP(LINK_OPTIONS); MAKE_STATIC_PROP(IMPORTED); MAKE_STATIC_PROP(IMPORTED_GLOBAL); MAKE_STATIC_PROP(MANUALLY_ADDED_DEPENDENCIES); @@ -1245,6 +1325,7 @@ const char* cmTarget::GetProperty(const std::string& prop) const specialProps.insert(propCOMPILE_FEATURES); specialProps.insert(propCOMPILE_OPTIONS); specialProps.insert(propCOMPILE_DEFINITIONS); + specialProps.insert(propLINK_OPTIONS); specialProps.insert(propIMPORTED); specialProps.insert(propIMPORTED_GLOBAL); specialProps.insert(propMANUALLY_ADDED_DEPENDENCIES); @@ -1303,6 +1384,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const output = cmJoin(this->Internal->CompileDefinitionsEntries, ";"); return output.c_str(); } + if (prop == propLINK_OPTIONS) { + if (this->Internal->LinkOptionsEntries.empty()) { + return nullptr; + } + + static std::string output; + output = cmJoin(this->Internal->LinkOptionsEntries, ";"); + return output.c_str(); + } if (prop == propMANUALLY_ADDED_DEPENDENCIES) { if (this->Utilities.empty()) { return nullptr; @@ -1347,6 +1437,15 @@ const char* cmTarget::GetProperty(const std::string& prop) const return retVal; } +const char* cmTarget::GetSafeProperty(const std::string& prop) const +{ + const char* ret = this->GetProperty(prop); + if (!ret) { + return ""; + } + return ret; +} + bool cmTarget::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 3abb47e..7a3ab65 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -200,7 +200,10 @@ public: void SetProperty(const std::string& prop, const char* value); void AppendProperty(const std::string& prop, const char* value, bool asString = false); + ///! Might return a nullptr if the property is not set or invalid const char* GetProperty(const std::string& prop) const; + ///! Always returns a valid pointer + const char* GetSafeProperty(const std::string& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; const char* GetComputedProperty(const std::string& prop, @@ -239,6 +242,8 @@ public: cmListFileBacktrace const& bt, bool before = false); void InsertCompileDefinition(std::string const& entry, cmListFileBacktrace const& bt); + void InsertLinkOption(std::string const& entry, + cmListFileBacktrace const& bt, bool before = false); void AppendBuildInterfaceIncludes(); @@ -265,6 +270,10 @@ public: cmStringRange GetSourceEntries() const; cmBacktraceRange GetSourceBacktraces() const; + + cmStringRange GetLinkOptionsEntries() const; + cmBacktraceRange GetLinkOptionsBacktraces() const; + cmStringRange GetLinkImplementationEntries() const; cmBacktraceRange GetLinkImplementationBacktraces() const; diff --git a/Source/cmTargetLinkOptionsCommand.cxx b/Source/cmTargetLinkOptionsCommand.cxx new file mode 100644 index 0000000..f0f13fd --- /dev/null +++ b/Source/cmTargetLinkOptionsCommand.cxx @@ -0,0 +1,41 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmTargetLinkOptionsCommand.h" + +#include <sstream> + +#include "cmAlgorithms.h" +#include "cmListFileCache.h" +#include "cmMakefile.h" +#include "cmTarget.h" +#include "cmake.h" + +class cmExecutionStatus; + +bool cmTargetLinkOptionsCommand::InitialPass( + std::vector<std::string> const& args, cmExecutionStatus&) +{ + return this->HandleArguments(args, "LINK_OPTIONS", PROCESS_BEFORE); +} + +void cmTargetLinkOptionsCommand::HandleMissingTarget(const std::string& name) +{ + std::ostringstream e; + e << "Cannot specify link options for target \"" << name + << "\" which is not built by this project."; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); +} + +std::string cmTargetLinkOptionsCommand::Join( + const std::vector<std::string>& content) +{ + return cmJoin(content, ";"); +} + +bool cmTargetLinkOptionsCommand::HandleDirectContent( + cmTarget* tgt, const std::vector<std::string>& content, bool, bool) +{ + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + tgt->InsertLinkOption(this->Join(content), lfbt); + return true; // Successfully handled. +} diff --git a/Source/cmTargetLinkOptionsCommand.h b/Source/cmTargetLinkOptionsCommand.h new file mode 100644 index 0000000..a1fc9fc --- /dev/null +++ b/Source/cmTargetLinkOptionsCommand.h @@ -0,0 +1,41 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmTargetLinkOptionsCommand_h +#define cmTargetLinkOptionsCommand_h + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> +#include <vector> + +#include "cmTargetPropCommandBase.h" + +class cmCommand; +class cmExecutionStatus; +class cmTarget; + +class cmTargetLinkOptionsCommand : public cmTargetPropCommandBase +{ +public: + /** + * This is a virtual constructor for the command. + */ + cmCommand* Clone() override { return new cmTargetLinkOptionsCommand; } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus& status) override; + +private: + void HandleMissingTarget(const std::string& name) override; + + bool HandleDirectContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool system) override; + std::string Join(const std::vector<std::string>& content) override; +}; + +#endif diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx index 3dd3748..62e323c 100644 --- a/Source/cmTargetSourcesCommand.cxx +++ b/Source/cmTargetSourcesCommand.cxx @@ -2,10 +2,14 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmTargetSourcesCommand.h" +#include <cstring> #include <sstream> #include "cmAlgorithms.h" +#include "cmGeneratorExpression.h" #include "cmMakefile.h" +#include "cmPolicies.h" +#include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" @@ -17,6 +21,14 @@ bool cmTargetSourcesCommand::InitialPass(std::vector<std::string> const& args, return this->HandleArguments(args, "SOURCES"); } +void cmTargetSourcesCommand::HandleInterfaceContent( + cmTarget* tgt, const std::vector<std::string>& content, bool prepend, + bool system) +{ + cmTargetPropCommandBase::HandleInterfaceContent( + tgt, ConvertToAbsoluteContent(tgt, content, true), prepend, system); +} + void cmTargetSourcesCommand::HandleMissingTarget(const std::string& name) { std::ostringstream e; @@ -35,6 +47,79 @@ std::string cmTargetSourcesCommand::Join( bool cmTargetSourcesCommand::HandleDirectContent( cmTarget* tgt, const std::vector<std::string>& content, bool, bool) { - tgt->AppendProperty("SOURCES", this->Join(content).c_str()); + tgt->AppendProperty( + "SOURCES", + this->Join(ConvertToAbsoluteContent(tgt, content, false)).c_str()); return true; // Successfully handled. } + +std::vector<std::string> cmTargetSourcesCommand::ConvertToAbsoluteContent( + cmTarget* tgt, const std::vector<std::string>& content, + bool isInterfaceContent) +{ + // Skip conversion in case old behavior has been explictly requested + if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076) == + cmPolicies::OLD) { + return content; + } + + bool changedPath = false; + std::vector<std::string> absoluteContent; + absoluteContent.reserve(content.size()); + for (std::string const& src : content) { + std::string absoluteSrc; + if (cmSystemTools::FileIsFullPath(src) || + cmGeneratorExpression::Find(src) == 0 || + (!isInterfaceContent && + strcmp(this->Makefile->GetCurrentSourceDirectory(), + tgt->GetMakefile()->GetCurrentSourceDirectory()) == 0)) { + absoluteSrc = src; + } else { + changedPath = true; + absoluteSrc = this->Makefile->GetCurrentSourceDirectory(); + absoluteSrc += "/"; + absoluteSrc += src; + } + absoluteContent.push_back(absoluteSrc); + } + + if (!changedPath) { + return content; + } + + bool issueMessage = true; + bool useAbsoluteContent = false; + std::ostringstream e; + switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0076)) { + case cmPolicies::WARN: + e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0076) << "\n"; + break; + case cmPolicies::OLD: + issueMessage = false; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0076)); + break; + case cmPolicies::NEW: { + issueMessage = false; + useAbsoluteContent = true; + break; + } + } + + if (issueMessage) { + if (isInterfaceContent) { + e << "An interface source of target \"" << tgt->GetName() + << "\" has a relative path."; + } else { + e << "A private source from a directory other than that of target \"" + << tgt->GetName() << "\" has a relative path."; + } + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, e.str()); + } + + return useAbsoluteContent ? absoluteContent : content; +} diff --git a/Source/cmTargetSourcesCommand.h b/Source/cmTargetSourcesCommand.h index ea8776a..b01e3ca 100644 --- a/Source/cmTargetSourcesCommand.h +++ b/Source/cmTargetSourcesCommand.h @@ -29,6 +29,11 @@ public: bool InitialPass(std::vector<std::string> const& args, cmExecutionStatus& status) override; +protected: + void HandleInterfaceContent(cmTarget* tgt, + const std::vector<std::string>& content, + bool prepend, bool system) override; + private: void HandleMissingTarget(const std::string& name) override; @@ -37,6 +42,10 @@ private: bool prepend, bool system) override; std::string Join(const std::vector<std::string>& content) override; + + std::vector<std::string> ConvertToAbsoluteContent( + cmTarget* tgt, const std::vector<std::string>& content, + bool isInterfaceContent); }; #endif diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index ea012f6..01ef5cb 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -82,12 +82,12 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, // regular expression for gl GL or xmesa in a file (match(1) of above) cmsys::RegularExpression glLine("(gl|GL|xmesa)"); while (cmSystemTools::GetLineFromStream(fin, inLine)) { - if (includeLine.find(inLine.c_str())) { + if (includeLine.find(inLine)) { std::string includeFile = includeLine.match(1); - if (glDirLine.find(includeFile.c_str())) { + if (glDirLine.find(includeFile)) { std::string gfile = glDirLine.match(3); fout << "#include \"" << outdir << "/" << gfile << "\"\n"; - } else if (glLine.find(includeFile.c_str())) { + } else if (glLine.find(includeFile)) { fout << "#include \"" << outdir << "/" << includeLine.match(1) << "\"\n"; } else { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index eff915b..41567a3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2286,14 +2286,51 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions( if (const char* workingDir = this->GeneratorTarget->GetProperty( "VS_DEBUGGER_WORKING_DIRECTORY")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(workingDir); + std::string genWorkingDir = + cge->Evaluate(this->LocalGenerator, config); + e1.WritePlatformConfigTag("LocalDebuggerWorkingDirectory", cond, - workingDir); + genWorkingDir); + } + + if (const char* environment = + this->GeneratorTarget->GetProperty("VS_DEBUGGER_ENVIRONMENT")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(environment); + std::string genEnvironment = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerEnvironment", cond, + genEnvironment); } if (const char* debuggerCommand = this->GeneratorTarget->GetProperty("VS_DEBUGGER_COMMAND")) { + + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(debuggerCommand); + std::string genDebuggerCommand = + cge->Evaluate(this->LocalGenerator, config); + e1.WritePlatformConfigTag("LocalDebuggerCommand", cond, - debuggerCommand); + genDebuggerCommand); + } + + if (const char* commandArguments = this->GeneratorTarget->GetProperty( + "VS_DEBUGGER_COMMAND_ARGUMENTS")) { + cmGeneratorExpression ge; + std::unique_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(commandArguments); + std::string genCommandArguments = + cge->Evaluate(this->LocalGenerator, config); + + e1.WritePlatformConfigTag("LocalDebuggerCommandArguments", cond, + genCommandArguments); } std::string name = @@ -3235,6 +3272,11 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( flags += flagsConfig; } + std::vector<std::string> opts; + this->GeneratorTarget->GetLinkOptions(opts, config, linkLanguage); + // LINK_OPTIONS are escaped. + this->LocalGenerator->AppendCompileOptions(flags, opts); + cmComputeLinkInformation* pcli = this->GeneratorTarget->GetLinkInformation(config); if (!pcli) { diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index d3d2db0..c504ef4 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -45,16 +45,20 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, cmSystemTools::MakeDirectory(dir); mode_t mode = 0; + bool writable = false; // Set permissions to writable if (cmSystemTools::GetPermissions(fileName.c_str(), mode)) { - cmSystemTools::SetPermissions(fileName.c_str(), #if defined(_MSC_VER) || defined(__MINGW32__) - mode | S_IWRITE + writable = mode & S_IWRITE; + mode_t newMode = mode | S_IWRITE; #else - mode | S_IWUSR | S_IWGRP + writable = mode & S_IWUSR; + mode_t newMode = mode | S_IWUSR | S_IWGRP; #endif - ); + if (!writable) { + cmSystemTools::SetPermissions(fileName.c_str(), newMode); + } } // If GetPermissions fails, pretend like it is ok. File open will fail if // the file is not writable @@ -69,7 +73,7 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args, } file << message << std::endl; file.close(); - if (mode) { + if (mode && !writable) { cmSystemTools::SetPermissions(fileName.c_str(), mode); } diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index f1dce64..58cb9c9 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -143,6 +143,41 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, xout.Attribute("debugServiceExtension", "internal"); xout.Attribute("allowLocationSimulation", "YES"); + // Diagnostics tab begin + + bool useAddressSanitizer = WriteLaunchActionAttribute( + xout, "enableAddressSanitizer", + "XCODE_SCHEME_ADDRESS_SANITIZER"); // not allowed with + // enableThreadSanitizer=YES + WriteLaunchActionAttribute( + xout, "enableASanStackUseAfterReturn", + "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN"); + + bool useThreadSanitizer = false; + if (!useAddressSanitizer) { + useThreadSanitizer = WriteLaunchActionAttribute( + xout, "enableThreadSanitizer", + "XCODE_SCHEME_THREAD_SANITIZER"); // not allowed with + // enableAddressSanitizer=YES + } + + WriteLaunchActionAttribute(xout, "stopOnEveryThreadSanitizerIssue", + "XCODE_SCHEME_THREAD_SANITIZER_STOP"); + + WriteLaunchActionAttribute(xout, "enableUBSanitizer", + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER"); + WriteLaunchActionAttribute( + xout, "stopOnEveryUBSanitizerIssue", + "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP"); + + WriteLaunchActionAttribute( + xout, "disableMainThreadChecker", + "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER"); // negative enabled! + WriteLaunchActionAttribute(xout, "stopOnEveryMainThreadCheckerIssue", + "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP"); + + // Diagnostics tab end + if (IsExecutable(this->Target)) { xout.StartElement("BuildableProductRunnable"); xout.BreakAttributes(); @@ -156,12 +191,144 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, xout.EndElement(); // MacroExpansion + // Info tab begin + + if (const char* exe = + this->Target->GetTarget()->GetProperty("XCODE_SCHEME_EXECUTABLE")) { + + xout.StartElement("PathRunnable"); + xout.BreakAttributes(); + + xout.Attribute("runnableDebuggingMode", "0"); + xout.Attribute("FilePath", exe); + + xout.EndElement(); // PathRunnable + } + + // Info tab end + + // Arguments tab begin + + if (const char* argList = + this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ARGUMENTS")) { + std::vector<std::string> arguments; + cmSystemTools::ExpandListArgument(argList, arguments); + if (!arguments.empty()) { + xout.StartElement("CommandLineArguments"); + + for (auto argument : arguments) { + xout.StartElement("CommandLineArgument"); + xout.BreakAttributes(); + + xout.Attribute("argument", argument); + xout.Attribute("isEnabled", "YES"); + + xout.EndElement(); // CommandLineArgument + } + + xout.EndElement(); // CommandLineArguments + } + } + + if (const char* envList = + this->Target->GetTarget()->GetProperty("XCODE_SCHEME_ENVIRONMENT")) { + std::vector<std::string> envs; + cmSystemTools::ExpandListArgument(envList, envs); + if (!envs.empty()) { + xout.StartElement("EnvironmentVariables"); + + for (auto env : envs) { + + xout.StartElement("EnvironmentVariable"); + xout.BreakAttributes(); + + std::string envValue; + const auto p = env.find_first_of('='); + if (p != std::string::npos) { + envValue = env.substr(p + 1); + env.resize(p); + } + + xout.Attribute("key", env); + xout.Attribute("value", envValue); + xout.Attribute("isEnabled", "YES"); + + xout.EndElement(); // EnvironmentVariable + } + + xout.EndElement(); // EnvironmentVariables + } + } + + // Arguments tab end + xout.StartElement("AdditionalOptions"); + + if (!useThreadSanitizer) { + WriteLaunchActionAdditionalOption(xout, "MallocScribble", "", + "XCODE_SCHEME_MALLOC_SCRIBBLE"); + } + + if (!useThreadSanitizer && !useAddressSanitizer) { + WriteLaunchActionAdditionalOption(xout, "MallocGuardEdges", "", + "XCODE_SCHEME_MALLOC_GUARD_EDGES"); + } + + if (!useThreadSanitizer && !useAddressSanitizer) { + WriteLaunchActionAdditionalOption(xout, "DYLD_INSERT_LIBRARIES", + "/usr/lib/libgmalloc.dylib", + "XCODE_SCHEME_GUARD_MALLOC"); + } + + WriteLaunchActionAdditionalOption(xout, "NSZombieEnabled", "YES", + "XCODE_SCHEME_ZOMBIE_OBJECTS"); + + if (!useThreadSanitizer && !useAddressSanitizer) { + WriteLaunchActionAdditionalOption(xout, "MallocStackLogging", "", + "XCODE_SCHEME_MALLOC_STACK"); + } + + WriteLaunchActionAdditionalOption(xout, "DYLD_PRINT_APIS", "", + "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE"); + + WriteLaunchActionAdditionalOption(xout, "DYLD_PRINT_LIBRARIES", "", + "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS"); + xout.EndElement(); xout.EndElement(); // LaunchAction } +bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout, + const std::string& attrName, + const std::string& varName) +{ + if (Target->GetTarget()->GetPropertyAsBool(varName)) { + xout.Attribute(attrName.c_str(), "YES"); + return true; + } + return false; +} + +bool cmXCodeScheme::WriteLaunchActionAdditionalOption( + cmXMLWriter& xout, const std::string& key, const std::string& value, + const std::string& varName) +{ + if (Target->GetTarget()->GetPropertyAsBool(varName)) { + xout.StartElement("AdditionalOption"); + xout.BreakAttributes(); + + xout.Attribute("key", key); + xout.Attribute("value", value); + xout.Attribute("isEnabled", "YES"); + + xout.EndElement(); // AdditionalOption + + return true; + } + return false; +} + void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, const std::string& configuration) { diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index e5e501a..96c76e6 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -41,6 +41,16 @@ private: const std::string& container); void WriteLaunchAction(cmXMLWriter& xout, const std::string& configuration, const std::string& container); + + bool WriteLaunchActionAttribute(cmXMLWriter& xout, + const std::string& attrName, + const std::string& varName); + + bool WriteLaunchActionAdditionalOption(cmXMLWriter& xout, + const std::string& attrName, + const std::string& value, + const std::string& varName); + void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration); void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration); void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration); diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 920e3a5..4c6c35a 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -186,8 +186,8 @@ void cmXMLParserCharacterDataHandler(void* parser, const char* data, void cmXMLParser::ReportXmlParseError() { XML_Parser parser = static_cast<XML_Parser>(this->Parser); - this->ReportError(XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser), + this->ReportError(static_cast<int>(XML_GetCurrentLineNumber(parser)), + static_cast<int>(XML_GetCurrentColumnNumber(parser)), XML_ErrorString(XML_GetErrorCode(parser))); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6edaa74..5bb1f22 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -407,7 +407,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) for (std::string const& ck : cacheKeys) { cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(ck); if (t != cmStateEnums::STATIC) { - if (regex.find(ck.c_str())) { + if (regex.find(ck)) { entriesToDelete.push_back(ck); } } diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 96088c8..516104b 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1193,13 +1193,17 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -O0") - ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND - NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND - NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")) + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") # Tell IBM XL not to warn about our test infinite loop - # v13.1.1 and newer on Linux ppc64le is clang based and does not accept - # the -qsuppress option - SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + IF(CMAKE_SYSTEM MATCHES "Linux.*ppc64le" + AND CMAKE_C_COMPILER_VERSION VERSION_LESS "16.1.0" + AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1") + # v13.1.[1-6] on Linux ppc64le is clang based and does not accept + # the -qsuppress option, so just suppress all warnings. + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -w") + ELSE() + SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -qsuppress=1500-010") + ENDIF() ENDIF() IF(CMAKE_C_FLAGS MATCHES "-fsanitize=") SET(testProcess_COMPILE_FLAGS "${testProcess_COMPILE_FLAGS} -DCRASH_USING_ABORT") diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index cfe62b4..7545ec7 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3495,7 +3495,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // Chip Model Name this->ChipID.ModelName = - this->ExtractValueFromCpuInfoFile(buffer, "model name").c_str(); + this->ExtractValueFromCpuInfoFile(buffer, "model name"); // L1 Cache size // Different architectures may show different names for the caches. @@ -4613,7 +4613,7 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl( std::string SystemInformationImplementation::RunProcess( std::vector<const char*> args) { - std::string buffer = ""; + std::string buffer; // Run the application kwsysProcess* gp = kwsysProcess_New(); @@ -4668,11 +4668,7 @@ std::string SystemInformationImplementation::RunProcess( std::string SystemInformationImplementation::ParseValueFromKStat( const char* arguments) { - std::vector<const char*> args; - args.clear(); - args.push_back("kstat"); - args.push_back("-p"); - + std::vector<std::string> args_string; std::string command = arguments; size_t start = std::string::npos; size_t pos = command.find(' ', 0); @@ -4691,35 +4687,35 @@ std::string SystemInformationImplementation::ParseValueFromKStat( } if (!inQuotes) { - std::string arg = command.substr(start + 1, pos - start - 1); + args_string.push_back(command.substr(start + 1, pos - start - 1)); + std::string& arg = args_string.back(); // Remove the quotes if any - size_t quotes = arg.find('"'); - while (quotes != std::string::npos) { - arg.erase(quotes, 1); - quotes = arg.find('"'); - } - args.push_back(arg.c_str()); + arg.erase(std::remove(arg.begin(), arg.end(), '"'), arg.end()); start = pos; } pos = command.find(' ', pos + 1); } - std::string lastArg = command.substr(start + 1, command.size() - start - 1); - args.push_back(lastArg.c_str()); + args_string.push_back(command.substr(start + 1, command.size() - start - 1)); + std::vector<const char*> args; + args.reserve(3 + args_string.size()); + args.push_back("kstat"); + args.push_back("-p"); + for (size_t i = 0; i < args_string.size(); ++i) { + args.push_back(args_string[i].c_str()); + } args.push_back(KWSYS_NULLPTR); std::string buffer = this->RunProcess(args); - std::string value = ""; + std::string value; for (size_t i = buffer.size() - 1; i > 0; i--) { if (buffer[i] == ' ' || buffer[i] == '\t') { break; } if (buffer[i] != '\n' && buffer[i] != '\r') { - std::string val = value; - value = buffer[i]; - value += val; + value.insert(0u, 1, buffer[i]); } } return value; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 0079da2..476fe08 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -686,7 +686,7 @@ public: for (iterator i = this->begin(); i != this->end(); ++i) { # if defined(_WIN32) const std::string s = Encoding::ToNarrow(*i); - kwsysUnPutEnv(s.c_str()); + kwsysUnPutEnv(s); # else kwsysUnPutEnv(*i); # endif @@ -1197,9 +1197,27 @@ bool SystemTools::FileExists(const std::string& filename) } return access(filename.c_str(), R_OK) == 0; #elif defined(_WIN32) - return ( - GetFileAttributesW(Encoding::ToWindowsExtendedPath(filename).c_str()) != - INVALID_FILE_ATTRIBUTES); + DWORD attr = + GetFileAttributesW(Encoding::ToWindowsExtendedPath(filename).c_str()); + if (attr == INVALID_FILE_ATTRIBUTES) { + return false; + } + + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) { + // Using 0 instead of GENERIC_READ as it allows reading of file attributes + // even if we do not have permission to read the file itself + HANDLE handle = + CreateFileW(Encoding::ToWindowsExtendedPath(filename).c_str(), 0, 0, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + if (handle == INVALID_HANDLE_VALUE) { + return false; + } + + CloseHandle(handle); + } + + return true; #else // SCO OpenServer 5.0.7/3.2's command has 711 permission. # if defined(_SCO_DS) @@ -1752,11 +1770,11 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len) return n; } -std::vector<kwsys::String> SystemTools::SplitString(const std::string& p, - char sep, bool isPath) +std::vector<std::string> SystemTools::SplitString(const std::string& p, + char sep, bool isPath) { std::string path = p; - std::vector<kwsys::String> paths; + std::vector<std::string> paths; if (path.empty()) { return paths; } @@ -1973,7 +1991,7 @@ std::string SystemTools::ConvertToUnixOutputPath(const std::string& path) } // escape spaces and () in the path if (ret.find_first_of(" ") != std::string::npos) { - std::string result = ""; + std::string result; char lastch = 1; for (const char* ch = ret.c_str(); *ch != '\0'; ++ch) { // if it is already escaped then don't try to escape it again @@ -3140,7 +3158,7 @@ void SystemTools::AddTranslationPath(const std::string& a, void SystemTools::AddKeepPath(const std::string& dir) { std::string cdir; - Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir); + Realpath(SystemTools::CollapseFullPath(dir), cdir); SystemTools::AddTranslationPath(cdir, dir); } @@ -3279,13 +3297,12 @@ std::string SystemTools::RelativePath(const std::string& local, std::string r = SystemTools::CollapseFullPath(remote); // split up both paths into arrays of strings using / as a separator - std::vector<kwsys::String> localSplit = - SystemTools::SplitString(l, '/', true); - std::vector<kwsys::String> remoteSplit = + std::vector<std::string> localSplit = SystemTools::SplitString(l, '/', true); + std::vector<std::string> remoteSplit = SystemTools::SplitString(r, '/', true); - std::vector<kwsys::String> + std::vector<std::string> commonPath; // store shared parts of path in this array - std::vector<kwsys::String> finalPath; // store the final relative path here + std::vector<std::string> finalPath; // store the final relative path here // count up how many matching directory names there are from the start unsigned int sameCount = 0; while (((sameCount <= (localSplit.size() - 1)) && @@ -3325,7 +3342,7 @@ std::string SystemTools::RelativePath(const std::string& local, } // for each entry that is not common in the remote path add it // to the final path. - for (std::vector<String>::iterator vit = remoteSplit.begin(); + for (std::vector<std::string>::iterator vit = remoteSplit.begin(); vit != remoteSplit.end(); ++vit) { if (!vit->empty()) { finalPath.push_back(*vit); @@ -3334,7 +3351,7 @@ std::string SystemTools::RelativePath(const std::string& local, std::string relativePath; // result string // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one - for (std::vector<String>::iterator vit1 = finalPath.begin(); + for (std::vector<std::string>::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) { if (!relativePath.empty() && *relativePath.rbegin() != '/') { relativePath += "/"; diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 928ee41..8d1f78c 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -10,8 +10,6 @@ #include <string> #include <vector> -#include <@KWSYS_NAMESPACE@/String.hxx> - #include <sys/types.h> // include sys/stat.h after sys/types.h #include <sys/stat.h> @@ -197,9 +195,9 @@ public: s starts with a / then the first element of the returned array will be /, so /foo/bar will be [/, foo, bar] */ - static std::vector<String> SplitString(const std::string& s, - char separator = '/', - bool isPath = false); + static std::vector<std::string> SplitString(const std::string& s, + char separator = '/', + bool isPath = false); /** * Perform a case-independent string comparison */ diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index f0d9c64..1bcfd0c 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -209,27 +209,34 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, } /* VT100 escape sequence strings. */ -#define KWSYS_TERMINAL_VT100_NORMAL "\33[0m" -#define KWSYS_TERMINAL_VT100_BOLD "\33[1m" -#define KWSYS_TERMINAL_VT100_UNDERLINE "\33[4m" -#define KWSYS_TERMINAL_VT100_BLINK "\33[5m" -#define KWSYS_TERMINAL_VT100_INVERSE "\33[7m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK "\33[30m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_RED "\33[31m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN "\33[32m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW "\33[33m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE "\33[34m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA "\33[35m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN "\33[36m" -#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE "\33[37m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK "\33[40m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_RED "\33[41m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN "\33[42m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW "\33[43m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE "\33[44m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA "\33[45m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN "\33[46m" -#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE "\33[47m" +#if defined(__MVS__) +/* if building on z/OS (aka MVS), assume we are using EBCDIC */ +# define ESCAPE_CHAR "\47" +#else +# define ESCAPE_CHAR "\33" +#endif + +#define KWSYS_TERMINAL_VT100_NORMAL ESCAPE_CHAR "[0m" +#define KWSYS_TERMINAL_VT100_BOLD ESCAPE_CHAR "[1m" +#define KWSYS_TERMINAL_VT100_UNDERLINE ESCAPE_CHAR "[4m" +#define KWSYS_TERMINAL_VT100_BLINK ESCAPE_CHAR "[5m" +#define KWSYS_TERMINAL_VT100_INVERSE ESCAPE_CHAR "[7m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK ESCAPE_CHAR "[30m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_RED ESCAPE_CHAR "[31m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN ESCAPE_CHAR "[32m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW ESCAPE_CHAR "[33m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE ESCAPE_CHAR "[34m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA ESCAPE_CHAR "[35m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN ESCAPE_CHAR "[36m" +#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE ESCAPE_CHAR "[37m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK ESCAPE_CHAR "[40m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_RED ESCAPE_CHAR "[41m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN ESCAPE_CHAR "[42m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW ESCAPE_CHAR "[43m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE ESCAPE_CHAR "[44m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA ESCAPE_CHAR "[45m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN ESCAPE_CHAR "[46m" +#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE ESCAPE_CHAR "[47m" /* Write VT100 escape sequences to the stream for the given color. */ static void kwsysTerminalSetVT100Color(FILE* stream, int color) diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx index 0385a3d..ef87436 100644 --- a/Source/kwsys/testCommandLineArguments.cxx +++ b/Source/kwsys/testCommandLineArguments.cxx @@ -77,7 +77,7 @@ int testCommandLineArguments(int argc, char* argv[]) int some_int_variable = 10; double some_double_variable = 10.10; char* some_string_variable = KWSYS_NULLPTR; - std::string some_stl_string_variable = ""; + std::string some_stl_string_variable; bool some_bool_variable = false; bool some_bool_variable1 = false; bool bool_arg1 = false; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index e6f9701..0477d59 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -206,7 +206,7 @@ static bool CheckFileOperations() res = false; } - if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { + if (!kwsys::SystemTools::Touch(testNewFile, true)) { std::cerr << "Problem with Touch for: " << testNewFile << std::endl; res = false; } @@ -415,7 +415,7 @@ static bool CheckFileOperations() res = false; } - kwsys::SystemTools::Touch(testNewFile.c_str(), true); + kwsys::SystemTools::Touch(testNewFile, true); if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) { std::cerr << "Problem with RemoveADirectory for: " << testNewDir << std::endl; @@ -806,7 +806,7 @@ static bool CheckFind() const std::string testFindFile(TEST_SYSTEMTOOLS_BINARY_DIR "/" + testFindFileName); - if (!kwsys::SystemTools::Touch(testFindFile.c_str(), true)) { + if (!kwsys::SystemTools::Touch(testFindFile, true)) { std::cerr << "Problem with Touch for: " << testFindFile << std::endl; // abort here as the existence of the file only makes the test meaningful return false; |