diff options
Diffstat (limited to 'Source')
29 files changed, 198 insertions, 95 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ee4ae2c..b0b01c8 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 13) -set(CMake_VERSION_PATCH 20181022) +set(CMake_VERSION_PATCH 20181102) #set(CMake_VERSION_RC 1) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 7fb5e80..c936910 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1686,6 +1686,7 @@ void cmCTestTestHandler::GetListOfTests() cm.GetState()->AddBuiltinCommand("set_tests_properties", newCom4); // Add handler for SET_DIRECTORY_PROPERTIES + cm.GetState()->RemoveBuiltinCommand("set_directory_properties"); cmCTestSetDirectoryPropertiesCommand* newCom5 = new cmCTestSetDirectoryPropertiesCommand; newCom5->TestHandler = this; diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 873372f..63c5397 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -151,6 +151,8 @@ void GetScriptingCommands(cmState* state) state->AddBuiltinCommand("separate_arguments", new cmSeparateArgumentsCommand); state->AddBuiltinCommand("set", new cmSetCommand); + state->AddBuiltinCommand("set_directory_properties", + new cmSetDirectoryPropertiesCommand); state->AddBuiltinCommand("set_property", new cmSetPropertyCommand); state->AddBuiltinCommand("site_name", new cmSiteNameCommand); state->AddBuiltinCommand("string", new cmStringCommand); @@ -240,8 +242,6 @@ void GetProjectCommands(cmState* state) state->AddBuiltinCommand("install_targets", new cmInstallTargetsCommand); state->AddBuiltinCommand("link_directories", new cmLinkDirectoriesCommand); state->AddBuiltinCommand("project", new cmProjectCommand); - state->AddBuiltinCommand("set_directory_properties", - new cmSetDirectoryPropertiesCommand); state->AddBuiltinCommand("set_source_files_properties", new cmSetSourceFilesPropertiesCommand); state->AddBuiltinCommand("set_target_properties", diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 0e48ca8..27b8599 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -421,7 +421,8 @@ std::string cmComputeLinkInformation::GetRPathLinkString() const return ""; } - // Construct the linker runtime search path. + // Construct the linker runtime search path. These MUST NOT contain tokens + // such as $ORIGIN, see https://sourceware.org/bugzilla/show_bug.cgi?id=16936 return cmJoin(this->OrderDependentRPath->GetOrderedDirectories(), ":"); } @@ -1702,6 +1703,14 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, !this->Makefile->IsOn("CMAKE_SKIP_INSTALL_RPATH") && this->Target->GetPropertyAsBool("INSTALL_RPATH_USE_LINK_PATH"); + // Select whether to use $ORIGIN in RPATHs for artifacts in the build tree. + std::string const& originToken = this->Makefile->GetSafeDefinition( + "CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN"); + std::string targetOutputDir = this->Target->GetDirectory(this->Config); + bool use_relative_build_rpath = + this->Target->GetPropertyAsBool("BUILD_RPATH_USE_ORIGIN") && + !originToken.empty() && !targetOutputDir.empty(); + // Construct the RPATH. std::set<std::string> emitted; if (use_install_rpath) { @@ -1711,6 +1720,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, if (use_build_rpath) { // Add directories explicitly specified by user if (const char* build_rpath = this->Target->GetProperty("BUILD_RPATH")) { + // This will not resolve entries to use $ORIGIN, the user is expected to + // do that if necessary. cmCLI_ExpandListUnique(build_rpath, runtimeDirs, emitted); } } @@ -1728,6 +1739,8 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, this->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); cmSystemTools::ConvertToUnixSlashes(rootPath); std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath(); + std::string const& topBinaryDir = + this->CMakeInstance->GetHomeOutputDirectory(); for (std::string const& ri : rdirs) { // Put this directory in the rpath if using build-tree rpath // support or if using the link path as an rpath. @@ -1741,6 +1754,18 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, d += "/"; d += suffix; cmSystemTools::ConvertToUnixSlashes(d); + } else if (use_relative_build_rpath) { + // If expansion of the $ORIGIN token is supported and permitted per + // policy, use relative paths in the RPATH. + if (cmSystemTools::ComparePath(d, topBinaryDir) || + cmSystemTools::IsSubDirectory(d, topBinaryDir)) { + d = cmSystemTools::RelativePath(targetOutputDir, d); + if (!d.empty()) { + d = originToken + "/" + d; + } else { + d = originToken; + } + } } if (emitted.insert(d).second) { runtimeDirs.push_back(std::move(d)); @@ -1749,8 +1774,6 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, // Do not add any path inside the source or build tree. std::string const& topSourceDir = this->CMakeInstance->GetHomeDirectory(); - std::string const& topBinaryDir = - this->CMakeInstance->GetHomeOutputDirectory(); if (!cmSystemTools::ComparePath(ri, topSourceDir) && !cmSystemTools::ComparePath(ri, topBinaryDir) && !cmSystemTools::IsSubDirectory(ri, topSourceDir) && diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 4cf9dd7..bddc3c4 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -855,7 +855,7 @@ void cmExportFileGenerator::SetImportDetailProperties( std::string propval; if (auto* p = target->GetProperty("COMMON_LANGUAGE_RUNTIME")) { propval = p; - } else if (target->HasLanguage("CSharp", config)) { + } else if (target->IsCSharpOnly()) { // C# projects do not have the /clr flag, so we set the property // here to mark the target as (only) managed (i.e. no .lib file // to link to). Otherwise the COMMON_LANGUAGE_RUNTIME target diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index 04a3c0e..b36ac78 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -315,6 +315,7 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, for (std::string const& p : paths) { std::vector<std::string> pathSegments; cmsys::SystemTools::SplitPath(p, pathSegments, true); + const bool pathIsFile = !cmsys::SystemTools::FileIsDirectory(p); const size_t segmentCount = pathSegments.size(); if (segmentCount < 2) { // Expect at least rootdir and filename @@ -324,7 +325,7 @@ void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, for (size_t i = 0; i < segmentCount; ++i) { assert(currentWatcher); - const bool fileSegment = (i == segmentCount - 1); + const bool fileSegment = (i == segmentCount - 1 && pathIsFile); const bool rootSegment = (i == 0); assert( !(fileSegment && diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b8c9598..71947ea 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -5716,20 +5716,23 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, } } -bool cmGeneratorTarget::HasLanguage(std::string const& language, - std::string const& config, - bool exclusive) const +bool cmGeneratorTarget::IsCSharpOnly() const { - std::set<std::string> languages; - this->GetLanguages(languages, config); - // The "exclusive" check applies only to source files and not - // the linker language which may be affected by dependencies. - if (exclusive && languages.size() > 1) { + // Only certain target types may compile CSharp. + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { return false; } - // add linker language (if it is different from compiler languages) - languages.insert(this->GetLinkerLanguage(config)); - return languages.count(language) > 0; + std::set<std::string> languages; + this->GetLanguages(languages, ""); + // Consider an explicit linker language property, but *not* the + // computed linker language that may depend on linked targets. + const char* linkLang = this->GetProperty("LINKER_LANGUAGE"); + if (linkLang && *linkLang) { + languages.insert(linkLang); + } + return languages.size() == 1 && languages.count("CSharp") > 0; } void cmGeneratorTarget::ComputeLinkImplementationLanguages( @@ -6095,6 +6098,5 @@ cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType( // C# targets are always managed. This language specific check // is added to avoid that the COMMON_LANGUAGE_RUNTIME target property // has to be set manually for C# targets. - return this->HasLanguage("CSharp", config) ? ManagedType::Managed - : ManagedType::Native; + return this->IsCSharpOnly() ? ManagedType::Managed : ManagedType::Native; } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 4c32558..5e7cf12 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -372,11 +372,7 @@ public: void GetLanguages(std::set<std::string>& languages, std::string const& config) const; - // Evaluate if the target uses the given language for compilation - // and/or linking. If 'exclusive' is true, 'language' is expected - // to be the only language used in source files for the target. - bool HasLanguage(std::string const& language, std::string const& config, - bool exclusive = true) const; + bool IsCSharpOnly() const; void GetObjectLibrariesCMP0026( std::vector<cmGeneratorTarget*>& objlibs) const; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index a216346..3be09b0 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -98,7 +98,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout, ext = ".vfproj"; project = "Project(\"{6989167D-11E4-40FE-8C1A-2192A86A7E90}\") = \""; } - if (t->HasLanguage("CSharp", "")) { + if (t->IsCSharpOnly()) { ext = ".csproj"; project = "Project(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \""; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 4aa52c3..da3daf8 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -878,12 +878,13 @@ bool cmGlobalVisualStudioGenerator::Open(const std::string& bindir, const std::string& projectName, bool dryRun) { - std::string buildDir = cmSystemTools::ConvertToOutputPath(bindir); - std::string sln = buildDir + "\\" + projectName + ".sln"; + std::string sln = bindir + "/" + projectName + ".sln"; if (dryRun) { return cmSystemTools::FileExists(sln, true); } + sln = cmSystemTools::ConvertToOutputPath(sln); + return std::async(std::launch::async, OpenSolution, sln).get(); } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index fcdf03f..754fa7d 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -68,7 +68,7 @@ const char* getShapeForTarget(const cmGeneratorTarget* target) } std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget( - cmTarget* Target) + cmTarget* Target, const cmGlobalGenerator* globalGenerator) { char sep = ';'; std::map<std::string, LinkLibraryScopeType> tokens; @@ -95,6 +95,13 @@ std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget( } std::string element = interfaceLinkLibraries.substr(start, end - start); + if (globalGenerator->IsAlias(element)) { + const auto tgt = globalGenerator->FindTarget(element); + if (tgt) { + element = tgt->GetName(); + } + } + if (std::string::npos == element.find("$<LINK_ONLY:", 0)) { // we assume first, that this library is an interface library. // if we find it again in the linklibraries property, we promote it to an @@ -116,6 +123,12 @@ std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget( } std::string element = linkLibraries.substr(start, end - start); + if (globalGenerator->IsAlias(element)) { + const auto tgt = globalGenerator->FindTarget(element); + if (tgt) { + element = tgt->GetName(); + } + } if (tokens.find(element) == tokens.end()) { // this library is not found in interfaceLinkLibraries but in @@ -137,13 +150,13 @@ std::map<std::string, LinkLibraryScopeType> getScopedLinkLibrariesFromTarget( } } -cmGraphVizWriter::cmGraphVizWriter( - const std::vector<cmLocalGenerator*>& localGenerators) +cmGraphVizWriter::cmGraphVizWriter(const cmGlobalGenerator* globalGenerator) : GraphType("digraph") , GraphName("GG") , GraphHeader("node [\n fontsize = \"12\"\n];") , GraphNodePrefix("node") - , LocalGenerators(localGenerators) + , GlobalGenerator(globalGenerator) + , LocalGenerators(globalGenerator->GetLocalGenerators()) , GenerateForExecutables(true) , GenerateForStaticLibs(true) , GenerateForSharedLibs(true) @@ -374,7 +387,8 @@ void cmGraphVizWriter::WriteConnections( std::string myNodeName = this->TargetNamesNodes.find(targetName)->second; std::map<std::string, LinkLibraryScopeType> ll = - getScopedLinkLibrariesFromTarget(targetPtrIt->second->Target); + getScopedLinkLibrariesFromTarget(targetPtrIt->second->Target, + GlobalGenerator); for (auto const& llit : ll) { const char* libName = llit.first.c_str(); @@ -439,7 +453,7 @@ void cmGraphVizWriter::WriteDependerConnections( // Now we have a target, check whether it links against targetName. // If so, draw a connection, and then continue with dependers on that one. std::map<std::string, LinkLibraryScopeType> ll = - getScopedLinkLibrariesFromTarget(tptr.second->Target); + getScopedLinkLibrariesFromTarget(tptr.second->Target, GlobalGenerator); for (auto const& llit : ll) { if (llit.first == targetName) { @@ -540,6 +554,13 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) continue; } + if (GlobalGenerator->IsAlias(libName)) { + const auto tgt = GlobalGenerator->FindTarget(libName); + if (tgt) { + libName = tgt->GetName().c_str(); + } + } + std::map<std::string, const cmGeneratorTarget*>::const_iterator tarIt = this->TargetPtrs.find(libName); if (tarIt == this->TargetPtrs.end()) { diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index ac20da9..ed242f0 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -16,13 +16,14 @@ class cmGeneratedFileStream; class cmGeneratorTarget; class cmLocalGenerator; +class cmGlobalGenerator; /** This class implements writing files for graphviz (dot) for graphs * representing the dependencies between the targets in the project. */ class cmGraphVizWriter { public: - cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators); + cmGraphVizWriter(const cmGlobalGenerator* globalGenerator); void ReadSettings(const char* settingsFileName, const char* fallbackSettingsFileName); @@ -69,6 +70,7 @@ protected: std::vector<cmsys::RegularExpression> TargetsToIgnoreRegex; + const cmGlobalGenerator* GlobalGenerator; const std::vector<cmLocalGenerator*>& LocalGenerators; std::map<std::string, const cmGeneratorTarget*> TargetPtrs; diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx index c9bbde1..a93ec12 100644 --- a/Source/cmLinkLineDeviceComputer.cxx +++ b/Source/cmLinkLineDeviceComputer.cxx @@ -25,6 +25,23 @@ cmLinkLineDeviceComputer::~cmLinkLineDeviceComputer() { } +static bool cmLinkItemValidForDevice(std::string const& item) +{ + // Valid items are: + // * Non-flags (does not start in '-') + // * Specific flags --library, --library-path, -l, -L + // For example: + // * 'cublas_device' => pass-along + // * '--library pthread' => pass-along + // * '-lpthread' => pass-along + // * '-pthread' => drop + // * '-a' => drop + return (!cmHasLiteralPrefix(item, "-") || // + cmHasLiteralPrefix(item, "-l") || // + cmHasLiteralPrefix(item, "-L") || // + cmHasLiteralPrefix(item, "--library")); +} + std::string cmLinkLineDeviceComputer::ComputeLinkLibraries( cmComputeLinkInformation& cli, std::string const& stdLibString) { @@ -60,16 +77,16 @@ 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")) { - out += "-Xnvlink "; + // nvcc understands absolute paths to libraries ending in '.a' or '.lib'. + // These should be passed to nvlink. Other extensions need to be left + // out because nvlink may not understand or need them. Even though it + // can tolerate '.so' or '.dylib' it cannot tolerate '.so.1'. + if (cmHasLiteralSuffix(item.Value, ".a") || + cmHasLiteralSuffix(item.Value, ".lib")) { + out += this->ConvertToOutputFormat( + this->ConvertToLinkReference(item.Value)); } - out += - this->ConvertToOutputFormat(this->ConvertToLinkReference(item.Value)); - } else { + } else if (cmLinkItemValidForDevice(item.Value)) { out += item.Value; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index d0495f7..4689f42 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -481,7 +481,7 @@ std::ostream& operator<<(std::ostream& os, BT<std::string> const& s) } std::vector<BT<std::string>> ExpandListWithBacktrace( - const char* list, cmListFileBacktrace const& bt) + std::string const& list, cmListFileBacktrace const& bt) { std::vector<BT<std::string>> result; std::vector<std::string> tmp; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 7c2802e..9e4a833 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -199,7 +199,8 @@ public: std::ostream& operator<<(std::ostream& os, BT<std::string> const& s); std::vector<BT<std::string>> ExpandListWithBacktrace( - const char* list, cmListFileBacktrace const& bt = cmListFileBacktrace()); + std::string const& list, + cmListFileBacktrace const& bt = cmListFileBacktrace()); struct cmListFile { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7beeb71..d5a18e6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2108,7 +2108,7 @@ void cmLocalGenerator::AppendIncludeDirectories( } void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, - const char* defines_list) const + std::string const& defines_list) const { std::set<BT<std::string>> tmp; this->AppendDefines(tmp, ExpandListWithBacktrace(defines_list)); @@ -2118,10 +2118,10 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, } void cmLocalGenerator::AppendDefines(std::set<BT<std::string>>& defines, - const char* defines_list) const + std::string const& defines_list) const { // Short-circuit if there are no definitions. - if (!defines_list) { + if (defines_list.empty()) { return; } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 95a8a6a..3dd6929 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -169,19 +169,9 @@ public: * command line. */ void AppendDefines(std::set<std::string>& defines, - const char* defines_list) const; - void AppendDefines(std::set<std::string>& defines, - std::string const& defines_list) const - { - this->AppendDefines(defines, defines_list.c_str()); - } + std::string const& defines_list) const; void AppendDefines(std::set<BT<std::string>>& defines, - const char* defines_list) const; - void AppendDefines(std::set<BT<std::string>>& defines, - std::string const& defines_list) const - { - this->AppendDefines(defines, defines_list.c_str()); - } + std::string const& defines_list) const; void AppendDefines(std::set<BT<std::string>>& defines, const std::vector<BT<std::string>>& defines_vec) const; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 4b65cf1..a2008a0 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -502,6 +502,16 @@ std::vector<std::string> cmState::GetCommandNames() const return commandNames; } +void cmState::RemoveBuiltinCommand(std::string const& name) +{ + assert(name == cmSystemTools::LowerCase(name)); + std::map<std::string, cmCommand*>::iterator i = + this->BuiltinCommands.find(name); + assert(i != this->BuiltinCommands.end()); + delete i->second; + this->BuiltinCommands.erase(i); +} + void cmState::RemoveUserDefinedCommands() { cmDeleteAll(this->ScriptedCommands); diff --git a/Source/cmState.h b/Source/cmState.h index ca7093a..916985d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -135,6 +135,7 @@ public: cmPolicies::PolicyID policy, const char* message); void AddUnexpectedCommand(std::string const& name, const char* error); void AddScriptedCommand(std::string const& name, cmCommand* command); + void RemoveBuiltinCommand(std::string const& name); void RemoveUserDefinedCommands(); std::vector<std::string> GetCommandNames() const; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d05d660..568ee82 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1733,6 +1733,32 @@ void list_item_verbose(FILE* out, struct archive_entry* entry) fflush(out); } +bool la_diagnostic(struct archive* ar, __LA_SSIZE_T r) +{ + // See archive.h definition of ARCHIVE_OK for return values. + + if (r >= ARCHIVE_OK) { + return true; + } + + if (r >= ARCHIVE_WARN) { + const char* warn = archive_error_string(ar); + if (!warn) { + warn = "unknown warning"; + } + std::cerr << "cmake -E tar: warning: " << warn << '\n'; + return true; + } + + // Error. + const char* err = archive_error_string(ar); + if (!err) { + err = "unknown error"; + } + std::cerr << "cmake -E tar: error: " << err << '\n'; + return false; +} + // Return 'true' on success bool copy_data(struct archive* ar, struct archive* aw) { @@ -1746,24 +1772,17 @@ bool copy_data(struct archive* ar, struct archive* aw) # endif for (;;) { - // Return value: - // * ARCHIVE_OK - read succeed - // * ARCHIVE_EOF - no more data to read left + // See archive.h definition of ARCHIVE_OK for return values. r = archive_read_data_block(ar, &buff, &size, &offset); if (r == ARCHIVE_EOF) { return true; } - if (r != ARCHIVE_OK) { + if (!la_diagnostic(ar, r)) { return false; } - // Return value: - // * >= ARCHIVE_OK - write succeed - // * < ARCHIVE_OK - write failed - const __LA_SSIZE_T w_size = - archive_write_data_block(aw, buff, size, offset); - if (w_size < ARCHIVE_OK) { - cmSystemTools::Message("archive_write_data_block()", - archive_error_string(aw)); + // See archive.h definition of ARCHIVE_OK for return values. + __LA_SSIZE_T const w = archive_write_data_block(aw, buff, size, offset); + if (!la_diagnostic(ar, w)) { return false; } } @@ -1822,7 +1841,6 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract) r = archive_write_header(ext, entry); if (r == ARCHIVE_OK) { if (!copy_data(a, ext)) { - cmSystemTools::Error("Problem with copy_data"); break; } r = archive_write_finish_entry(ext); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1458f01..987bdb3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -218,6 +218,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("ANDROID_ASSETS_DIRECTORIES", nullptr); this->SetPropertyDefault("ANDROID_ANT_ADDITIONAL_OPTIONS", nullptr); this->SetPropertyDefault("BUILD_RPATH", nullptr); + this->SetPropertyDefault("BUILD_RPATH_USE_ORIGIN", nullptr); this->SetPropertyDefault("INSTALL_NAME_DIR", nullptr); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); diff --git a/Source/cmVS10CSharpFlagTable.h b/Source/cmVS10CSharpFlagTable.h index 18d587c..6ac7a76 100644 --- a/Source/cmVS10CSharpFlagTable.h +++ b/Source/cmVS10CSharpFlagTable.h @@ -21,8 +21,8 @@ static cmVS7FlagTable cmVS10CSharpFlagTable[] = { { "AddModules", "addmodule:", "", "", cmIDEFlagTable::SemicolonAppendable }, { "", "link", "", "", 0 }, - { "Win32Resource", "win32res", "", "", cmIDEFlagTable::UserValueRequired }, - { "ApplicationIcon", "win32icon", "", "", + { "Win32Resource", "win32res:", "", "", cmIDEFlagTable::UserValueRequired }, + { "ApplicationIcon", "win32icon:", "", "", cmIDEFlagTable::UserValueRequired }, { "ApplicationManifest", "win32manifest:", "", "", diff --git a/Source/cmVS11CSharpFlagTable.h b/Source/cmVS11CSharpFlagTable.h index e3ba83c..18b804a 100644 --- a/Source/cmVS11CSharpFlagTable.h +++ b/Source/cmVS11CSharpFlagTable.h @@ -21,8 +21,8 @@ static cmVS7FlagTable cmVS11CSharpFlagTable[] = { { "AddModules", "addmodule:", "", "", cmIDEFlagTable::SemicolonAppendable }, { "", "link", "", "", 0 }, - { "Win32Resource", "win32res", "", "", cmIDEFlagTable::UserValueRequired }, - { "ApplicationIcon", "win32icon", "", "", + { "Win32Resource", "win32res:", "", "", cmIDEFlagTable::UserValueRequired }, + { "ApplicationIcon", "win32icon:", "", "", cmIDEFlagTable::UserValueRequired }, { "ApplicationManifest", "win32manifest:", "", "", diff --git a/Source/cmVS12CSharpFlagTable.h b/Source/cmVS12CSharpFlagTable.h index f8db636..0370499 100644 --- a/Source/cmVS12CSharpFlagTable.h +++ b/Source/cmVS12CSharpFlagTable.h @@ -21,8 +21,8 @@ static cmVS7FlagTable cmVS12CSharpFlagTable[] = { { "AddModules", "addmodule:", "", "", cmIDEFlagTable::SemicolonAppendable }, { "", "link", "", "", 0 }, - { "Win32Resource", "win32res", "", "", cmIDEFlagTable::UserValueRequired }, - { "ApplicationIcon", "win32icon", "", "", + { "Win32Resource", "win32res:", "", "", cmIDEFlagTable::UserValueRequired }, + { "ApplicationIcon", "win32icon:", "", "", cmIDEFlagTable::UserValueRequired }, { "ApplicationManifest", "win32manifest:", "", "", diff --git a/Source/cmVS140CSharpFlagTable.h b/Source/cmVS140CSharpFlagTable.h index 055d5cb..f695f45 100644 --- a/Source/cmVS140CSharpFlagTable.h +++ b/Source/cmVS140CSharpFlagTable.h @@ -21,8 +21,8 @@ static cmVS7FlagTable cmVS140CSharpFlagTable[] = { { "AddModules", "addmodule:", "", "", cmIDEFlagTable::SemicolonAppendable }, { "", "link", "", "", 0 }, - { "Win32Resource", "win32res", "", "", cmIDEFlagTable::UserValueRequired }, - { "ApplicationIcon", "win32icon", "", "", + { "Win32Resource", "win32res:", "", "", cmIDEFlagTable::UserValueRequired }, + { "ApplicationIcon", "win32icon:", "", "", cmIDEFlagTable::UserValueRequired }, { "ApplicationManifest", "win32manifest:", "", "", diff --git a/Source/cmVS141CSharpFlagTable.h b/Source/cmVS141CSharpFlagTable.h index 66c61bd..1f84097 100644 --- a/Source/cmVS141CSharpFlagTable.h +++ b/Source/cmVS141CSharpFlagTable.h @@ -21,8 +21,8 @@ static cmVS7FlagTable cmVS141CSharpFlagTable[] = { { "AddModules", "addmodule:", "", "", cmIDEFlagTable::SemicolonAppendable }, { "", "link", "", "", 0 }, - { "Win32Resource", "win32res", "", "", cmIDEFlagTable::UserValueRequired }, - { "ApplicationIcon", "win32icon", "", "", + { "Win32Resource", "win32res:", "", "", cmIDEFlagTable::UserValueRequired }, + { "ApplicationIcon", "win32icon:", "", "", cmIDEFlagTable::UserValueRequired }, { "ApplicationManifest", "win32manifest:", "", "", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7383efd..e9a1a67 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -205,12 +205,11 @@ static bool cmVS10IsTargetsFile(std::string const& path) return cmSystemTools::Strucmp(ext.c_str(), ".targets") == 0; } -static std::string computeProjectFileExtension(cmGeneratorTarget const* t, - const std::string& config) +static std::string computeProjectFileExtension(cmGeneratorTarget const* t) { std::string res; res = ".vcxproj"; - if (t->HasLanguage("CSharp", config)) { + if (t->IsCSharpOnly()) { res = ".csproj"; } return res; @@ -305,8 +304,8 @@ void cmVisualStudio10TargetGenerator::Generate() this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) { return; } - const std::string ProjectFileExtension = computeProjectFileExtension( - this->GeneratorTarget, *this->Configurations.begin()); + const std::string ProjectFileExtension = + computeProjectFileExtension(this->GeneratorTarget); if (ProjectFileExtension == ".vcxproj") { this->ProjectType = vcxproj; this->Managed = false; @@ -1122,6 +1121,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged( Elem& e1, std::string const& config) { + if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) { + return; + } + cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; Options& o = *(this->ClOptions[config]); @@ -1394,8 +1397,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::string path = this->LocalGenerator->GetCurrentBinaryDirectory(); path += "/"; path += this->Name; - path += computeProjectFileExtension(this->GeneratorTarget, - *this->Configurations.begin()); + path += computeProjectFileExtension(this->GeneratorTarget); path += ".filters"; cmGeneratedFileStream fout(path); fout.SetCopyIfDifferent(true); @@ -3796,7 +3798,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) path = lg->GetCurrentBinaryDirectory(); path += "/"; path += dt->GetName(); - path += computeProjectFileExtension(dt, *this->Configurations.begin()); + path += computeProjectFileExtension(dt); } ConvertToWindowsSlash(path); Elem e2(e1, "ProjectReference"); @@ -3822,7 +3824,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0) } // Workaround for static library C# targets if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) { - referenceNotManaged = !dt->HasLanguage("CSharp", ""); + referenceNotManaged = !dt->IsCSharpOnly(); } if (referenceNotManaged) { e2.Element("ReferenceOutputAssembly", "false"); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 889a5fb..79af3e7 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -676,10 +676,25 @@ void cmake::SetArgs(const std::vector<std::string>& args, #endif else if (arg.find("-D", 0) == 0) { // skip for now + // in case '-D var=val' is given, also skip the next + // in case '-Dvar=val' is given, don't skip the next + if (arg.size() == 2) { + ++i; + } } else if (arg.find("-U", 0) == 0) { // skip for now + // in case '-U var' is given, also skip the next + // in case '-Uvar' is given, don't skip the next + if (arg.size() == 2) { + ++i; + } } else if (arg.find("-C", 0) == 0) { // skip for now + // in case '-C path' is given, also skip the next + // in case '-Cpath' is given, don't skip the next + if (arg.size() == 2) { + ++i; + } } else if (arg.find("-P", 0) == 0) { // skip for now i++; @@ -2128,7 +2143,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) void cmake::GenerateGraphViz(const char* fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE - cmGraphVizWriter gvWriter(this->GetGlobalGenerator()->GetLocalGenerators()); + cmGraphVizWriter gvWriter(this->GetGlobalGenerator()); std::string settingsFile = this->GetHomeOutputDirectory(); settingsFile += "/CMakeGraphVizOptions.cmake"; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 43aec00..a2fcc16 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -90,6 +90,7 @@ FOREACH(p CMP0048 # CMake 3.0, Let the project command manage version variables. CMP0056 # CMake 3.2, Honor link flags in try_compile() source-file signature. CMP0063 # CMake 3.3, Honor visibility properties for all target types. + CMP0069 # CMake 3.9, INTERPROCEDURAL_OPTIMIZATION is enforced when enabled. ) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) |