diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/QtDialog/RegexExplorer.cxx | 2 | ||||
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 45 | ||||
-rw-r--r-- | Source/cmExportBuildFileGenerator.h | 7 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 6 | ||||
-rw-r--r-- | Source/cmFortranParserImpl.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmLinkLineDeviceComputer.cxx | 4 | ||||
-rw-r--r-- | Source/cmListCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 2 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 31 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 59 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 26 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 61 | ||||
-rw-r--r-- | Source/cmake.cxx | 71 | ||||
-rw-r--r-- | Source/cmake.h | 49 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 2 |
20 files changed, 180 insertions, 231 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a054b11..300aab7 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 15) -set(CMake_VERSION_PATCH 20190626) +set(CMake_VERSION_PATCH 20190709) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/RegexExplorer.cxx b/Source/QtDialog/RegexExplorer.cxx index cb67f85..746fd8a 100644 --- a/Source/QtDialog/RegexExplorer.cxx +++ b/Source/QtDialog/RegexExplorer.cxx @@ -20,7 +20,7 @@ void RegexExplorer::setStatusColor(QWidget* widget, bool successful) QColor color = successful ? QColor(0, 127, 0) : Qt::red; QPalette palette = widget->palette(); - palette.setColor(QPalette::Foreground, color); + palette.setColor(QPalette::WindowText, color); widget->setPalette(palette); } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 3fe84a9..5800629 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -12,7 +12,6 @@ #include "cmMessageType.h" #include "cmPolicies.h" #include "cmStateTypes.h" -#include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" #include "cmake.h" @@ -259,11 +258,11 @@ void cmExportBuildFileGenerator::HandleMissingTarget( const std::string name = dependee->GetName(); cmGlobalGenerator* gg = dependee->GetLocalGenerator()->GetGlobalGenerator(); - std::vector<std::string> namespaces = this->FindNamespaces(gg, name); + auto exportInfo = this->FindBuildExportInfo(gg, name); + std::vector<std::string> const& exportFiles = exportInfo.first; - int targetOccurrences = static_cast<int>(namespaces.size()); - if (targetOccurrences == 1) { - std::string missingTarget = namespaces[0]; + if (exportFiles.size() == 1) { + std::string missingTarget = exportInfo.second; missingTarget += dependee->GetExportName(); link_libs += missingTarget; @@ -272,7 +271,7 @@ void cmExportBuildFileGenerator::HandleMissingTarget( } // We are not appending, so all exported targets should be // known here. This is probably user-error. - this->ComplainAboutMissingTarget(depender, dependee, targetOccurrences); + this->ComplainAboutMissingTarget(depender, dependee, exportFiles); } // Assume the target will be exported by another command. // Append it with the export namespace. @@ -292,10 +291,12 @@ void cmExportBuildFileGenerator::GetTargets( targets = this->Targets; } -std::vector<std::string> cmExportBuildFileGenerator::FindNamespaces( - cmGlobalGenerator* gg, const std::string& name) +std::pair<std::vector<std::string>, std::string> +cmExportBuildFileGenerator::FindBuildExportInfo(cmGlobalGenerator* gg, + const std::string& name) { - std::vector<std::string> namespaces; + std::vector<std::string> exportFiles; + std::string ns; std::map<std::string, cmExportBuildFileGenerator*>& exportSets = gg->GetBuildExportSets(); @@ -305,31 +306,31 @@ std::vector<std::string> cmExportBuildFileGenerator::FindNamespaces( std::vector<std::string> targets; exportSet->GetTargets(targets); if (std::find(targets.begin(), targets.end(), name) != targets.end()) { - namespaces.push_back(exportSet->GetNamespace()); + exportFiles.push_back(exp.first); + ns = exportSet->GetNamespace(); } } - return namespaces; + return std::make_pair(exportFiles, ns); } void cmExportBuildFileGenerator::ComplainAboutMissingTarget( - cmGeneratorTarget* depender, cmGeneratorTarget* dependee, int occurrences) + cmGeneratorTarget* depender, cmGeneratorTarget* dependee, + std::vector<std::string> const& exportFiles) { - if (cmSystemTools::GetErrorOccuredFlag()) { - return; - } - std::ostringstream e; e << "export called with target \"" << depender->GetName() << "\" which requires target \"" << dependee->GetName() << "\" "; - if (occurrences == 0) { - e << "that is not in the export set.\n"; + if (exportFiles.empty()) { + e << "that is not in any export set."; } else { - e << "that is not in this export set, but " << occurrences - << " times in others.\n"; + e << "that is not in this export set, but in multiple other export sets: " + << cmJoin(exportFiles, ", ") << ".\n"; + e << "An exported target cannot depend upon another target which is " + "exported multiple times. Consider consolidating the exports of the " + "\"" + << dependee->GetName() << "\" target to a single export."; } - e << "If the required target is not easy to reference in this call, " - << "consider using the APPEND option with multiple separate calls."; this->LG->GetGlobalGenerator()->GetCMakeInstance()->IssueMessage( MessageType::FATAL_ERROR, e.str(), diff --git a/Source/cmExportBuildFileGenerator.h b/Source/cmExportBuildFileGenerator.h index 0a1e755..e5b6597 100644 --- a/Source/cmExportBuildFileGenerator.h +++ b/Source/cmExportBuildFileGenerator.h @@ -11,6 +11,7 @@ #include <iosfwd> #include <string> +#include <utility> #include <vector> class cmExportSet; @@ -64,7 +65,7 @@ protected: void ComplainAboutMissingTarget(cmGeneratorTarget* depender, cmGeneratorTarget* dependee, - int occurrences); + std::vector<std::string> const& namespaces); /** Fill in properties indicating built file locations. */ void SetImportLocationProperty(const std::string& config, @@ -75,8 +76,8 @@ protected: std::string InstallNameDir(cmGeneratorTarget* target, const std::string& config) override; - std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, - const std::string& name); + std::pair<std::vector<std::string>, std::string> FindBuildExportInfo( + cmGlobalGenerator* gg, const std::string& name); std::vector<std::string> Targets; cmExportSet* ExportSet; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 6fe8c14..30b3f0d 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -217,22 +217,21 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::SHARED_LIBRARY: case cmStateEnums::MODULE_LIBRARY: { + cmake const* cm = makefile->GetCMakeInstance(); std::vector<cmSourceFile*> sources; gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* s : sources) { + std::string const& fullPath = s->GetFullPath(); + std::string const& extLower = + cmSystemTools::LowerCase(s->GetExtension()); // check whether it is a source or a include file // then put it accordingly into one of the two containers - switch (cmSystemTools::GetFileFormat(s->GetExtension())) { - case cmSystemTools::C_FILE_FORMAT: - case cmSystemTools::CXX_FILE_FORMAT: - case cmSystemTools::CUDA_FILE_FORMAT: - case cmSystemTools::FORTRAN_FILE_FORMAT: { - cFiles[s->GetFullPath()] = s; - } break; - default: { - otherFiles.insert(s->GetFullPath()); - } + if (cm->IsSourceExtension(extLower) || cm->IsCudaExtension(extLower) || + cm->IsFortranExtension(extLower)) { + cFiles[fullPath] = s; + } else { + otherFiles.insert(fullPath); } } } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 4dd009e..50ae6a9 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -737,12 +737,6 @@ bool cmFindPackageCommand::HandlePackageMode( { this->ConsideredConfigs.clear(); - // Support old capitalization behavior. - std::string upperDir = cmSystemTools::UpperCase(this->Name); - std::string upperFound = cmSystemTools::UpperCase(this->Name); - upperDir += "_DIR"; - upperFound += "_FOUND"; - // Try to find the config file. const char* def = this->Makefile->GetDefinition(this->Variable); diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index 18e3c10..e8b1da8 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -79,7 +79,13 @@ std::string cmFortranParser_s::ModName(std::string const& mod_name) const std::string cmFortranParser_s::SModName(std::string const& mod_name, std::string const& sub_name) const { - return mod_name + this->Compiler.SModSep + sub_name + this->Compiler.SModExt; + std::string const& SModExt = + this->Compiler.SModExt.empty() ? ".mod" : this->Compiler.SModExt; + // An empty separator means that the compiler does not use a prefix. + if (this->Compiler.SModSep.empty()) { + return sub_name + SModExt; + } + return mod_name + this->Compiler.SModSep + sub_name + SModExt; } bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b250dd7..ec4107b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1679,6 +1679,7 @@ void cmGlobalGenerator::ClearGeneratorMembers() cmDeleteAll(this->LocalGenerators); this->LocalGenerators.clear(); + this->AliasTargets.clear(); this->ExportSets.clear(); this->TargetDependencies.clear(); this->TargetSearchIndex.clear(); diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index 6cfe5bb..d27da3e 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -12,6 +12,7 @@ #include "cmAlgorithms.h" #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" @@ -142,6 +143,9 @@ std::string cmLinkLineDeviceComputer::GetLinkerLanguage(cmGeneratorTarget*, bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg, const std::string& config) { + if (!target.GetGlobalGenerator()->GetLanguageEnabled("CUDA")) { + return false; + } if (target.GetType() == cmStateEnums::OBJECT_LIBRARY) { return false; diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 5474afa..1b01ea2 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -344,7 +344,7 @@ bool cmListCommand::HandlePopFrontCommand(std::vector<std::string> const& args) auto vi = varArgsExpanded.begin(); for (; vi != varArgsExpanded.end() && ai != args.cend(); ++ai, ++vi) { assert(!ai->empty()); - this->Makefile->AddDefinition(*ai, varArgsExpanded.front().c_str()); + this->Makefile->AddDefinition(*ai, vi->c_str()); } varArgsExpanded.erase(varArgsExpanded.begin(), vi); // Undefine the rest variables if the list gets empty earlier... diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index e0f69cb..bd98f08 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4300,7 +4300,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, // Deprecate old policies, especially those that require a lot // of code to maintain the old behavior. - if (status == cmPolicies::OLD && id <= cmPolicies::CMP0066 && + if (status == cmPolicies::OLD && id <= cmPolicies::CMP0067 && !(this->GetCMakeInstance()->GetIsInTryCompile() && ( // Policies set by cmCoreTryCompile::TryCompileCode. diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 552463d..6b9b9c7 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -82,11 +82,7 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( bool relink) { #ifdef CMAKE_BUILD_WITH_CMAKE - if (!this->GlobalGenerator->GetLanguageEnabled("CUDA")) { - return; - } - - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (!requiresDeviceLinking) { return; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 99f0df8..b9f7c6d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -123,8 +123,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() { - - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; @@ -152,7 +151,7 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) } if (!relink) { - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; @@ -186,9 +185,8 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) { - if (!relink) { - bool requiresDeviceLinking = requireDeviceLinking( + const bool requiresDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, this->ConfigName); if (requiresDeviceLinking) { std::string linkRuleVar = "CMAKE_CUDA_DEVICE_LINK_LIBRARY"; diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 9985f93..83a1bc4 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -620,6 +620,7 @@ bool cmQtAutoGenInitializer::InitRcc() bool cmQtAutoGenInitializer::InitScanFiles() { cmMakefile* makefile = this->Target->Target->GetMakefile(); + cmake const* cm = makefile->GetCMakeInstance(); auto const& kw = this->GlobalInitializer->kw(); auto makeMUFile = [this, &kw](cmSourceFile* sf, std::string const& fullPath, @@ -665,25 +666,21 @@ bool cmQtAutoGenInitializer::InitScanFiles() if (!pathError.empty() || fullPath.empty()) { continue; } - std::string const& ext = sf->GetExtension(); + std::string const& extLower = + cmSystemTools::LowerCase(sf->GetExtension()); // Register files that will be scanned by moc or uic if (this->MocOrUicEnabled()) { - switch (cmSystemTools::GetFileFormat(ext)) { - case cmSystemTools::HEADER_FILE_FORMAT: - addMUFile(makeMUFile(sf, fullPath, true), true); - break; - case cmSystemTools::CXX_FILE_FORMAT: - addMUFile(makeMUFile(sf, fullPath, true), false); - break; - default: - break; + if (cm->IsHeaderExtension(extLower)) { + addMUFile(makeMUFile(sf, fullPath, true), true); + } else if (cm->IsSourceExtension(extLower)) { + addMUFile(makeMUFile(sf, fullPath, true), false); } } // Register rcc enabled files if (this->Rcc.Enabled) { - if ((ext == kw.qrc) && !sf->GetPropertyAsBool(kw.SKIP_AUTOGEN) && + if ((extLower == kw.qrc) && !sf->GetPropertyAsBool(kw.SKIP_AUTOGEN) && !sf->GetPropertyAsBool(kw.SKIP_AUTORCC)) { // Register qrc file Qrc qrc; @@ -715,7 +712,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() extraHeaders.reserve(this->AutogenTarget.Sources.size() * 2); // Header search suffixes and extensions std::array<std::string, 2> const suffixes{ { "", "_p" } }; - auto const& exts = makefile->GetCMakeInstance()->GetHeaderExtensions(); + auto const& exts = cm->GetHeaderExtensions(); // Scan through sources for (auto const& pair : this->AutogenTarget.Sources) { MUFile const& muf = *pair.second; @@ -784,10 +781,10 @@ bool cmQtAutoGenInitializer::InitScanFiles() if (!pathError.empty() || fullPath.empty()) { continue; } - std::string const& ext = sf->GetExtension(); + std::string const& extLower = + cmSystemTools::LowerCase(sf->GetExtension()); - auto const fileFormat = cmSystemTools::GetFileFormat(ext); - if (fileFormat == cmSystemTools::HEADER_FILE_FORMAT) { + if (cm->IsHeaderExtension(extLower)) { if (this->AutogenTarget.Headers.find(sf) == this->AutogenTarget.Headers.end()) { auto muf = makeMUFile(sf, fullPath, false); @@ -795,7 +792,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->AutogenTarget.Headers.emplace(sf, std::move(muf)); } } - } else if (fileFormat == cmSystemTools::CXX_FILE_FORMAT) { + } else if (cm->IsSourceExtension(extLower)) { if (this->AutogenTarget.Sources.find(sf) == this->AutogenTarget.Sources.end()) { auto muf = makeMUFile(sf, fullPath, false); @@ -803,7 +800,7 @@ bool cmQtAutoGenInitializer::InitScanFiles() this->AutogenTarget.Sources.emplace(sf, std::move(muf)); } } - } else if (this->Uic.Enabled && (ext == kw.ui)) { + } else if (this->Uic.Enabled && (extLower == kw.ui)) { // .ui file std::string realPath = cmSystemTools::GetRealPath(fullPath); bool const skipAutogen = sf->GetPropertyAsBool(kw.SKIP_AUTOGEN); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1501481..723f280 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1264,65 +1264,6 @@ bool cmSystemTools::SimpleGlob(const std::string& glob, return res; } -cmSystemTools::FileFormat cmSystemTools::GetFileFormat(std::string const& ext) -{ - if (ext.empty()) { - return cmSystemTools::NO_FILE_FORMAT; - } - if (ext == "c" || ext == ".c" || ext == "m" || ext == ".m") { - return cmSystemTools::C_FILE_FORMAT; - } - if (ext == "C" || ext == ".C" || ext == "M" || ext == ".M" || ext == "c++" || - ext == ".c++" || ext == "cc" || ext == ".cc" || ext == "cpp" || - ext == ".cpp" || ext == "cxx" || ext == ".cxx" || ext == "mm" || - ext == ".mm") { - return cmSystemTools::CXX_FILE_FORMAT; - } - if (ext == "f" || ext == ".f" || ext == "F" || ext == ".F" || ext == "f77" || - ext == ".f77" || ext == "f90" || ext == ".f90" || ext == "for" || - ext == ".for" || ext == "f95" || ext == ".f95") { - return cmSystemTools::FORTRAN_FILE_FORMAT; - } - if (ext == "java" || ext == ".java") { - return cmSystemTools::JAVA_FILE_FORMAT; - } - if (ext == "cu" || ext == ".cu") { - return cmSystemTools::CUDA_FILE_FORMAT; - } - if (ext == "H" || ext == ".H" || ext == "h" || ext == ".h" || ext == "h++" || - ext == ".h++" || ext == "hm" || ext == ".hm" || ext == "hpp" || - ext == ".hpp" || ext == "hxx" || ext == ".hxx" || ext == "in" || - ext == ".in" || ext == "txx" || ext == ".txx") { - return cmSystemTools::HEADER_FILE_FORMAT; - } - if (ext == "rc" || ext == ".rc") { - return cmSystemTools::RESOURCE_FILE_FORMAT; - } - if (ext == "def" || ext == ".def") { - return cmSystemTools::DEFINITION_FILE_FORMAT; - } - if (ext == "lib" || ext == ".lib" || ext == "a" || ext == ".a") { - return cmSystemTools::STATIC_LIBRARY_FILE_FORMAT; - } - if (ext == "o" || ext == ".o" || ext == "obj" || ext == ".obj") { - return cmSystemTools::OBJECT_FILE_FORMAT; - } -#ifdef __APPLE__ - if (ext == "dylib" || ext == ".dylib") { - return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; - } - if (ext == "so" || ext == ".so" || ext == "bundle" || ext == ".bundle") { - return cmSystemTools::MODULE_FILE_FORMAT; - } -#else // __APPLE__ - if (ext == "so" || ext == ".so" || ext == "sl" || ext == ".sl" || - ext == "dll" || ext == ".dll") { - return cmSystemTools::SHARED_LIBRARY_FILE_FORMAT; - } -#endif // __APPLE__ - return cmSystemTools::UNKNOWN_FILE_FORMAT; -} - std::string cmSystemTools::ConvertToOutputPath(std::string const& path) { #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 016c266..a9c03bd 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -299,27 +299,6 @@ public: static void EnableRunCommandOutput() { s_DisableRunCommandOutput = false; } static bool GetRunCommandOutput() { return s_DisableRunCommandOutput; } - /** - * Some constants for different file formats. - */ - enum FileFormat - { - NO_FILE_FORMAT = 0, - C_FILE_FORMAT, - CXX_FILE_FORMAT, - FORTRAN_FILE_FORMAT, - JAVA_FILE_FORMAT, - CUDA_FILE_FORMAT, - HEADER_FILE_FORMAT, - RESOURCE_FILE_FORMAT, - DEFINITION_FILE_FORMAT, - STATIC_LIBRARY_FILE_FORMAT, - SHARED_LIBRARY_FILE_FORMAT, - MODULE_FILE_FORMAT, - OBJECT_FILE_FORMAT, - UNKNOWN_FILE_FORMAT - }; - enum CompareOp { OP_EQUAL = 1, @@ -350,11 +329,6 @@ public: */ static int strverscmp(std::string const& lhs, std::string const& rhs); - /** - * Determine the file type based on the extension - */ - static FileFormat GetFileFormat(std::string const& ext); - /** Windows if this is true, the CreateProcess in RunCommand will * not show new console windows when running programs. */ diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8b9a41f..0420881 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2915,10 +2915,9 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( Options& cudaOptions = *pOptions; // Get compile flags for CUDA in this directory. - std::string CONFIG = cmSystemTools::UpperCase(configName); - std::string configFlagsVar = "CMAKE_CUDA_FLAGS_" + CONFIG; - std::string flags = this->Makefile->GetSafeDefinition("CMAKE_CUDA_FLAGS") + - " " + this->Makefile->GetSafeDefinition(configFlagsVar); + std::string flags; + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, "CUDA", + configName); this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, "CUDA", configName); @@ -3065,7 +3064,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions( Options& cudaLinkOptions = *pOptions; // Determine if we need to do a device link - bool doDeviceLinking = requireDeviceLinking( + const bool doDeviceLinking = requireDeviceLinking( *this->GeneratorTarget, *this->LocalGenerator, configName); cudaLinkOptions.AddFlag("PerformDeviceLink", @@ -3119,11 +3118,9 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( this->LocalGenerator, Options::MasmCompiler, gg->GetMasmFlagTable()); Options& masmOptions = *pOptions; - std::string CONFIG = cmSystemTools::UpperCase(configName); - std::string configFlagsVar = "CMAKE_ASM_MASM_FLAGS_" + CONFIG; - std::string flags = - this->Makefile->GetSafeDefinition("CMAKE_ASM_MASM_FLAGS") + " " + - this->Makefile->GetSafeDefinition(configFlagsVar); + std::string flags; + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + "ASM_MASM", configName); masmOptions.Parse(flags); @@ -3173,12 +3170,11 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions( this->LocalGenerator, Options::NasmCompiler, gg->GetNasmFlagTable()); Options& nasmOptions = *pOptions; - std::string CONFIG = cmSystemTools::UpperCase(configName); - std::string configFlagsVar = "CMAKE_ASM_NASM_FLAGS_" + CONFIG; - std::string flags = - this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_FLAGS") + " -f" + - this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_OBJECT_FORMAT") + " " + - this->Makefile->GetSafeDefinition(configFlagsVar); + std::string flags; + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + "ASM_NASM", configName); + flags += " -f"; + flags += this->Makefile->GetSafeDefinition("CMAKE_ASM_NASM_OBJECT_FORMAT"); nasmOptions.Parse(flags); // Get includes for this target @@ -3257,15 +3253,32 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions( std::vector<cmSourceFile const*> manifest_srcs; this->GeneratorTarget->GetManifests(manifest_srcs, config); - if (!manifest_srcs.empty()) { - std::ostringstream oss; - for (cmSourceFile const* mi : manifest_srcs) { - std::string m = this->ConvertPath(mi->GetFullPath(), false); - ConvertToWindowsSlash(m); - oss << m << ";"; - } + + const char* dpiAware = this->GeneratorTarget->GetProperty("VS_DPI_AWARE"); + + if (!manifest_srcs.empty() || dpiAware) { Elem e2(e1, "Manifest"); - e2.Element("AdditionalManifestFiles", oss.str()); + if (!manifest_srcs.empty()) { + std::ostringstream oss; + for (cmSourceFile const* mi : manifest_srcs) { + std::string m = this->ConvertPath(mi->GetFullPath(), false); + ConvertToWindowsSlash(m); + oss << m << ";"; + } + e2.Element("AdditionalManifestFiles", oss.str()); + } + if (dpiAware) { + if (!strcmp(dpiAware, "PerMonitor")) { + e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware"); + } else if (cmSystemTools::IsOn(dpiAware)) { + e2.Element("EnableDpiAwareness", "true"); + } else if (cmSystemTools::IsOff(dpiAware)) { + e2.Element("EnableDpiAwareness", "false"); + } else { + cmSystemTools::Error("Bad parameter for VS_DPI_AWARE: " + + std::string(dpiAware)); + } + } } } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 8f2f86d..ca3b405 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -104,7 +104,6 @@ #include <cstring> #include <initializer_list> #include <iostream> -#include <iterator> #include <memory> // IWYU pragma: keep #include <sstream> #include <stdio.h> @@ -122,9 +121,9 @@ typedef std::unordered_map<std::string, Json::Value> JsonValueMapType; static bool cmakeCheckStampFile(const std::string& stampName); static bool cmakeCheckStampList(const std::string& stampList); -void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, - void* ctx, const char* /*unused*/, - const cmMakefile* /*unused*/) +static void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/, + void* ctx, const char* /*unused*/, + const cmMakefile* /*unused*/) { cmake* cm = reinterpret_cast<cmake*>(ctx); cm->MarkCliAsUsed(variable); @@ -184,40 +183,36 @@ cmake::cmake(Role role, cmState::Mode mode) // Make sure we can capture the build tool output. cmSystemTools::EnableVSConsoleOutput(); - // Set up a list of source and header extensions - // these are used to find files when the extension - // is not given - // The "c" extension MUST precede the "C" extension. - this->SourceFileExtensions.emplace_back("c"); - this->SourceFileExtensions.emplace_back("C"); - - this->SourceFileExtensions.emplace_back("c++"); - this->SourceFileExtensions.emplace_back("cc"); - this->SourceFileExtensions.emplace_back("cpp"); - this->SourceFileExtensions.emplace_back("cxx"); - this->SourceFileExtensions.emplace_back("cu"); - this->SourceFileExtensions.emplace_back("m"); - this->SourceFileExtensions.emplace_back("M"); - this->SourceFileExtensions.emplace_back("mm"); - - std::copy(this->SourceFileExtensions.begin(), - this->SourceFileExtensions.end(), - std::inserter(this->SourceFileExtensionsSet, - this->SourceFileExtensionsSet.end())); - - this->HeaderFileExtensions.emplace_back("h"); - this->HeaderFileExtensions.emplace_back("hh"); - this->HeaderFileExtensions.emplace_back("h++"); - this->HeaderFileExtensions.emplace_back("hm"); - this->HeaderFileExtensions.emplace_back("hpp"); - this->HeaderFileExtensions.emplace_back("hxx"); - this->HeaderFileExtensions.emplace_back("in"); - this->HeaderFileExtensions.emplace_back("txx"); - - std::copy(this->HeaderFileExtensions.begin(), - this->HeaderFileExtensions.end(), - std::inserter(this->HeaderFileExtensionsSet, - this->HeaderFileExtensionsSet.end())); + // Set up a list of source and header extensions. + // These are used to find files when the extension is not given. + { + auto fillExts = [](FileExtensions& exts, + std::initializer_list<const char*> extList) { + // Fill ordered vector + exts.ordered.reserve(extList.size()); + for (const char* ext : extList) { + exts.ordered.emplace_back(ext); + }; + // Fill unordered set + exts.unordered.insert(exts.ordered.begin(), exts.ordered.end()); + }; + + // Source extensions + // The "c" extension MUST precede the "C" extension. + fillExts(this->SourceFileExtensions, + { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "m", "M", "mm" }); + + // Header extensions + fillExts(this->HeaderFileExtensions, + { "h", "hh", "h++", "hm", "hpp", "hxx", "in", "txx" }); + + // Cuda extensions + fillExts(this->CudaFileExtensions, { "cu" }); + + // Fortran extensions + fillExts(this->FortranFileExtensions, + { "f", "F", "for", "f77", "f90", "f95", "f03" }); + } } cmake::~cmake() diff --git a/Source/cmake.h b/Source/cmake.h index e14a081..c03872b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -121,6 +121,17 @@ public: bool isAlias; }; + struct FileExtensions + { + bool Test(std::string const& ext) const + { + return (this->unordered.find(ext) != this->unordered.end()); + } + + std::vector<std::string> ordered; + std::unordered_set<std::string> unordered; + }; + typedef std::map<std::string, cmInstalledFile> InstalledFilesMap; static const int NO_BUILD_PARALLEL_LEVEL = -1; @@ -233,24 +244,42 @@ public: const std::vector<std::string>& GetSourceExtensions() const { - return this->SourceFileExtensions; + return this->SourceFileExtensions.ordered; } bool IsSourceExtension(const std::string& ext) const { - return this->SourceFileExtensionsSet.find(ext) != - this->SourceFileExtensionsSet.end(); + return this->SourceFileExtensions.Test(ext); } const std::vector<std::string>& GetHeaderExtensions() const { - return this->HeaderFileExtensions; + return this->HeaderFileExtensions.ordered; } bool IsHeaderExtension(const std::string& ext) const { - return this->HeaderFileExtensionsSet.find(ext) != - this->HeaderFileExtensionsSet.end(); + return this->HeaderFileExtensions.Test(ext); + } + + const std::vector<std::string>& GetCudaExtensions() const + { + return this->CudaFileExtensions.ordered; + } + + bool IsCudaExtension(const std::string& ext) const + { + return this->CudaFileExtensions.Test(ext); + } + + const std::vector<std::string>& GetFortranExtensions() const + { + return this->FortranFileExtensions.ordered; + } + + bool IsFortranExtension(const std::string& ext) const + { + return this->FortranFileExtensions.Test(ext); } // Strips the extension (if present and known) from a filename @@ -531,10 +560,10 @@ private: std::string CheckStampList; std::string VSSolutionFile; std::string EnvironmentGenerator; - std::vector<std::string> SourceFileExtensions; - std::unordered_set<std::string> SourceFileExtensionsSet; - std::vector<std::string> HeaderFileExtensions; - std::unordered_set<std::string> HeaderFileExtensionsSet; + FileExtensions SourceFileExtensions; + FileExtensions HeaderFileExtensions; + FileExtensions CudaFileExtensions; + FileExtensions FortranFileExtensions; bool ClearBuildSystem; bool DebugTryCompile; std::unique_ptr<cmFileTimeCache> FileTimeCache; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 64026ca..a6348b3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -96,7 +96,7 @@ static const char* cmDocumentationOptions[][2] = { "Generate graphviz of dependencies, see " "CMakeGraphVizOptions.cmake for more." }, { "--system-information [file]", "Dump information about this system." }, - { "--loglevel=<error|warn|notice|status|verbose|debug|trace>", + { "--loglevel=<ERROR|WARNING|NOTICE|STATUS|VERBOSE|DEBUG|TRACE>", "Set the verbosity of messages from CMake files." }, { "--debug-trycompile", "Do not delete the try_compile build tree. Only " |