diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 90 | ||||
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 3 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.h | 8 | ||||
-rw-r--r-- | Source/cmVisualStudio10ToolsetOptions.cxx | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
6 files changed, 77 insertions, 60 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0f2a2d2..9e785da 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -19,55 +19,57 @@ else() set(CMake_VERSION_IS_RELEASE 0) endif() -if(EXISTS ${CMake_SOURCE_DIR}/.git) - find_package(Git QUIET) - if(GIT_FOUND) - macro(_git) - execute_process( - COMMAND ${GIT_EXECUTABLE} ${ARGN} - WORKING_DIRECTORY ${CMake_SOURCE_DIR} - RESULT_VARIABLE _git_res - OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE - ) - endmacro() - endif() -endif() - -# Try to identify the current development source version. -if(COMMAND _git) - # Get the commit checked out in this work tree. - _git(log -n 1 HEAD "--pretty=format:%h %s" --) - set(git_info "${_git_out}") -else() - # Get the commit exported by 'git archive'. +if(NOT CMake_VERSION_NO_GIT) + # If this source was exported by 'git archive', use its commit info. set(git_info [==[$Format:%h %s$]==]) -endif() - -# Extract commit information if available. -if(git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* (.*)$") - # Have commit information. - set(git_hash "${CMAKE_MATCH_1}") - set(git_subject "${CMAKE_MATCH_2}") - # If this is not the exact commit of a release, add dev info. - if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$") - set(CMake_VERSION "${CMake_VERSION}-g${git_hash}") + # Otherwise, try to identify the current development source version. + if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* " + AND EXISTS ${CMake_SOURCE_DIR}/.git) + find_package(Git QUIET) + if(GIT_FOUND) + macro(_git) + execute_process( + COMMAND ${GIT_EXECUTABLE} ${ARGN} + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + RESULT_VARIABLE _git_res + OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE + ) + endmacro() + endif() + if(COMMAND _git) + # Get the commit checked out in this work tree. + _git(log -n 1 HEAD "--pretty=format:%h %s" --) + set(git_info "${_git_out}") + endif() endif() - # If this is a work tree, check whether it is dirty. - if(COMMAND _git) - _git(update-index -q --refresh) - _git(diff-index --name-only HEAD --) - if(_git_out) - set(CMake_VERSION_IS_DIRTY 1) + # Extract commit information if available. + if(git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* (.*)$") + # Have commit information. + set(git_hash "${CMAKE_MATCH_1}") + set(git_subject "${CMAKE_MATCH_2}") + + # If this is not the exact commit of a release, add dev info. + if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$") + set(CMake_VERSION "${CMake_VERSION}-g${git_hash}") + endif() + + # If this is a work tree, check whether it is dirty. + if(COMMAND _git) + _git(update-index -q --refresh) + _git(diff-index --name-only HEAD --) + if(_git_out) + set(CMake_VERSION_IS_DIRTY 1) + endif() + endif() + else() + # No commit information. + if(NOT CMake_VERSION_IS_RELEASE) + # Generic development version. + set(CMake_VERSION "${CMake_VERSION}-git") endif() - endif() -else() - # No commit information. - if(NOT CMake_VERSION_IS_RELEASE) - # Generic development version. - set(CMake_VERSION "${CMake_VERSION}-git") endif() endif() diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 515f446..910cc9d 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -56,6 +56,8 @@ static std::string const kCMAKE_POSITION_INDEPENDENT_CODE = static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT"; static std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE"; static std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK"; +static std::string const kCMAKE_Swift_COMPILER_TARGET = + "CMAKE_Swift_COMPILER_TARGET"; static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES = "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES"; static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES = @@ -671,6 +673,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv, vars.insert(kCMAKE_SYSROOT); vars.insert(kCMAKE_SYSROOT_COMPILE); vars.insert(kCMAKE_SYSROOT_LINK); + vars.insert(kCMAKE_Swift_COMPILER_TARGET); vars.insert(kCMAKE_WARN_DEPRECATED); vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s); diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 3d7eccc..aeef602 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -752,9 +752,9 @@ void cmExportFileGenerator::SetImportLinkInterface( if (iface->ImplementationIsInterface) { // Policy CMP0022 must not be NEW. - this->SetImportLinkProperty(suffix, target, - "IMPORTED_LINK_INTERFACE_LIBRARIES", - iface->Libraries, properties, missingTargets); + this->SetImportLinkProperty( + suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries, + properties, missingTargets, ImportLinkPropertyTargetNames::Yes); return; } @@ -832,14 +832,14 @@ void cmExportFileGenerator::SetImportDetailProperties( // Add the transitive link dependencies for this configuration. if (cmLinkInterface const* iface = target->GetLinkInterface(config, target)) { - this->SetImportLinkProperty(suffix, target, - "IMPORTED_LINK_INTERFACE_LANGUAGES", - iface->Languages, properties, missingTargets); + this->SetImportLinkProperty( + suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages, + properties, missingTargets, ImportLinkPropertyTargetNames::No); std::vector<std::string> dummy; - this->SetImportLinkProperty(suffix, target, - "IMPORTED_LINK_DEPENDENT_LIBRARIES", - iface->SharedDeps, properties, dummy); + this->SetImportLinkProperty( + suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps, + properties, dummy, ImportLinkPropertyTargetNames::Yes); if (iface->Multiplicity > 0) { std::string prop = cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix); @@ -880,7 +880,8 @@ template <typename T> void cmExportFileGenerator::SetImportLinkProperty( std::string const& suffix, cmGeneratorTarget* target, const std::string& propName, std::vector<T> const& entries, - ImportPropertyMap& properties, std::vector<std::string>& missingTargets) + ImportPropertyMap& properties, std::vector<std::string>& missingTargets, + ImportLinkPropertyTargetNames targetNames) { // Skip the property if there are no entries. if (entries.empty()) { @@ -895,9 +896,13 @@ void cmExportFileGenerator::SetImportLinkProperty( link_entries += sep; sep = ";"; - std::string temp = asString(l); - this->AddTargetNamespace(temp, target, missingTargets); - link_entries += temp; + if (targetNames == ImportLinkPropertyTargetNames::Yes) { + std::string temp = asString(l); + this->AddTargetNamespace(temp, target, missingTargets); + link_entries += temp; + } else { + link_entries += asString(l); + } } // Store the property. diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index b04a31e..0d69779 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -102,13 +102,19 @@ protected: ImportPropertyMap& properties, std::vector<std::string>& missingTargets); + enum class ImportLinkPropertyTargetNames + { + Yes, + No, + }; template <typename T> void SetImportLinkProperty(std::string const& suffix, cmGeneratorTarget* target, const std::string& propName, std::vector<T> const& entries, ImportPropertyMap& properties, - std::vector<std::string>& missingTargets); + std::vector<std::string>& missingTargets, + ImportLinkPropertyTargetNames targetNames); /** Each subclass knows how to generate its kind of export file. */ virtual bool GenerateMainFile(std::ostream& os) = 0; diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx index a490e03..7fc33e6 100644 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ b/Source/cmVisualStudio10ToolsetOptions.cxx @@ -34,8 +34,7 @@ std::string cmVisualStudio10ToolsetOptions::GetCSharpFlagTableName( std::string const useToolset = this->GetToolsetName(name, toolset); if (useToolset == "v142") { - // FIXME: Add CSharp flag table for v142. - return "v141"; + return "v142"; } else if (useToolset == "v141") { return "v141"; } else if (useToolset == "v140") { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 50f47af..f63a264 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -423,6 +423,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } std::cout << "loading initial cache file " << path << "\n"; + // Resolve script path specified on command line relative to $PWD. + path = cmSystemTools::CollapseFullPath(path); this->ReadListFile(args, path); } else if (arg.find("-P", 0) == 0) { i++; |