diff options
31 files changed, 167 insertions, 110 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 8ad0c01..72144cf 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -15,7 +15,7 @@ set(CMAKE_C_SIMULATE_ID "@CMAKE_C_SIMULATE_ID@") set(CMAKE_C_SIMULATE_VERSION "@CMAKE_C_SIMULATE_VERSION@") @_SET_CMAKE_C_COMPILER_ARCHITECTURE_ID@ @SET_MSVC_C_ARCHITECTURE_ID@ -@SET_CMAKE_XCODE_CURRENT_ARCH@ +@SET_CMAKE_XCODE_ARCHS@ set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_C_COMPILER_AR "@CMAKE_C_COMPILER_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 974886d..8da6a8c 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -17,7 +17,7 @@ set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@") set(CMAKE_CXX_SIMULATE_VERSION "@CMAKE_CXX_SIMULATE_VERSION@") @_SET_CMAKE_CXX_COMPILER_ARCHITECTURE_ID@ @SET_MSVC_CXX_ARCHITECTURE_ID@ -@SET_CMAKE_XCODE_CURRENT_ARCH@ +@SET_CMAKE_XCODE_ARCHS@ set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_CXX_COMPILER_AR "@CMAKE_CXX_COMPILER_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 7e6ca1e..17706ea 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -183,9 +183,9 @@ if(MSVC_C_ARCHITECTURE_ID) "set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") endif() -if(CMAKE_C_XCODE_CURRENT_ARCH) - set(SET_CMAKE_XCODE_CURRENT_ARCH - "set(CMAKE_XCODE_CURRENT_ARCH ${CMAKE_C_XCODE_CURRENT_ARCH})") +if(CMAKE_C_XCODE_ARCHS) + set(SET_CMAKE_XCODE_ARCHS + "set(CMAKE_XCODE_ARCHS \"${CMAKE_C_XCODE_ARCHS}\")") endif() # configure variables set in this file for fast reload later on diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index c0fb3b6..70d17a1 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -181,9 +181,9 @@ if(MSVC_CXX_ARCHITECTURE_ID) "set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") endif() -if(CMAKE_CXX_XCODE_CURRENT_ARCH) - set(SET_CMAKE_XCODE_CURRENT_ARCH - "set(CMAKE_XCODE_CURRENT_ARCH ${CMAKE_CXX_XCODE_CURRENT_ARCH})") +if(CMAKE_CXX_XCODE_ARCHS) + set(SET_CMAKE_XCODE_ARCHS + "set(CMAKE_XCODE_ARCHS \"${CMAKE_CXX_XCODE_ARCHS}\")") endif() # configure all variables set in this file diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1628203..16dde65 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -121,7 +121,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID "${CMAKE_${lang}_COMPILER_ARCHITECTURE_ID}" PARENT_SCOPE) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) - set(CMAKE_${lang}_XCODE_CURRENT_ARCH "${CMAKE_${lang}_XCODE_CURRENT_ARCH}" PARENT_SCOPE) + set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE) set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION_INTERNAL "${CMAKE_${lang}_COMPILER_VERSION_INTERNAL}" PARENT_SCOPE) @@ -380,8 +380,10 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} endif() endif() endif() - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CURRENT_ARCH=([^%\r\n]+)[\r\n]") - set(CMAKE_${lang}_XCODE_CURRENT_ARCH "${CMAKE_MATCH_1}" PARENT_SCOPE) + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "ARCHS=([^%\r\n]+)[\r\n]") + set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_MATCH_1}") + separate_arguments(CMAKE_${lang}_XCODE_ARCHS) + set(CMAKE_${lang}_XCODE_ARCHS "${CMAKE_${lang}_XCODE_ARCHS}" PARENT_SCOPE) endif() else() execute_process( diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in index 1cbaa57..94bcbf8 100644 --- a/Modules/CompilerId/Xcode-3.pbxproj.in +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -58,7 +58,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"GCC_VERSION=$GCC_VERSION\" ; echo \"CURRENT_ARCH=$CURRENT_ARCH\""; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\" ; echo \"ARCHS=$ARCHS\""; showEnvVarsInLog = 0; }; 2C18F0B515DC1DCE00593670 = { diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index e66ae92..a549765 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -10,7 +10,7 @@ # IMPORTED Targets # ^^^^^^^^^^^^^^^^ # -# This module defines :prop_tgt:`IMPORTED` target ``CURL::CURL``, if +# This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if # curl has been found. # # Result Variables @@ -67,9 +67,9 @@ if(CURL_FOUND) set(CURL_LIBRARIES ${CURL_LIBRARY}) set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) - if(NOT TARGET CURL::CURL) - add_library(CURL::CURL UNKNOWN IMPORTED) - set_target_properties(CURL::CURL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - set_property(TARGET CURL::CURL APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + if(NOT TARGET CURL::libcurl) + add_library(CURL::libcurl UNKNOWN IMPORTED) + set_target_properties(CURL::libcurl PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + set_property(TARGET CURL::libcurl APPEND PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") endif() endif() diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake index 61a2213..7290724 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -52,7 +52,7 @@ find_path(JPEG_INCLUDE_DIR jpeglib.h) set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static) -foreach(name ${JPEG_NAMES}) +foreach(name ${jpeg_names}) list(APPEND jpeg_names_debug "${name}d") endforeach() @@ -122,10 +122,4 @@ if(JPEG_FOUND) endif() endif() -# Deprecated declarations. -set(NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR}) -if(JPEG_LIBRARY) - get_filename_component(NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) -endif() - mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR) diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 2a1abba..1b57fd8 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -22,6 +22,8 @@ function(cm_check_cxx_feature name) # Filter out warnings caused by local configuration. string(REGEX REPLACE "[^\n]*warning:[^\n]*directory not found for option[^\n]*" "" check_output "${check_output}") string(REGEX REPLACE "[^\n]*warning:[^\n]*object file compiled with -mlong-branch which is no longer needed[^\n]*" "" check_output "${check_output}") + # Filter out xcodebuild warnings. + string(REGEX REPLACE "[^\n]* xcodebuild\\[[0-9]*:[0-9]*\\] warning: [^\n]*" "" check_output "${check_output}") # If using the feature causes warnings, treat it as broken/unavailable. if(check_output MATCHES "[Ww]arning") set(CMake_HAVE_CXX_${FEATURE} OFF CACHE INTERNAL "TRY_COMPILE" FORCE) diff --git a/Source/Modules/FindLibUV.cmake b/Source/Modules/FindLibUV.cmake index ba13d75..0554d62 100644 --- a/Source/Modules/FindLibUV.cmake +++ b/Source/Modules/FindLibUV.cmake @@ -63,6 +63,8 @@ mark_as_advanced(LibUV_INCLUDE_DIR) set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+") if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h") file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") +elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv/version.h") + file(STRINGS "${LibUV_INCLUDE_DIR}/uv/version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h") file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") else() diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index aae70b1..dcb79f7 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -777,7 +777,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, this->Makefile->GetCMakeInstance()->GetWorkingMode(); while (i != args.end()) { if (*i == "LIST_DIRECTORIES") { - ++i; + ++i; // skip LIST_DIRECTORIES if (i != args.end()) { if (cmSystemTools::IsOn(i->c_str())) { g.SetListDirs(true); @@ -789,27 +789,21 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, this->SetError("LIST_DIRECTORIES missing bool value."); return false; } + ++i; } else { this->SetError("LIST_DIRECTORIES missing bool value."); return false; } - ++i; - if (i == args.end()) { - this->SetError("GLOB requires a glob expression after the bool."); - return false; - } } else if (*i == "FOLLOW_SYMLINKS") { - if (!recurse) { - this->SetError("FOLLOW_SYMLINKS is not a valid parameter for GLOB."); - return false; - } - explicitFollowSymlinks = true; - g.RecurseThroughSymlinksOn(); - ++i; - if (i == args.end()) { - this->SetError( - "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS."); - return false; + ++i; // skip FOLLOW_SYMLINKS + if (recurse) { + explicitFollowSymlinks = true; + g.RecurseThroughSymlinksOn(); + if (i == args.end()) { + this->SetError( + "GLOB_RECURSE requires a glob expression after FOLLOW_SYMLINKS."); + return false; + } } } else if (*i == "RELATIVE") { ++i; // skip RELATIVE diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 8c20313..a5709d5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -263,25 +263,32 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( this->GeneratorToolsetVersion.clear(); } - std::string const toolsetPath = this->GetAuxiliaryToolset(); - if (!toolsetPath.empty() && !cmSystemTools::FileExists(toolsetPath)) { - - std::ostringstream e; - /* clang-format off */ - e << - "Generator\n" - " " << this->GetName() << "\n" - "given toolset and version specification\n" - " " << this->GetPlatformToolsetString() << ",version=" << - this->GeneratorToolsetVersion << "\n" - "does not seem to be installed at\n" << - " " << toolsetPath; - ; - /* clang-format on */ - mf->IssueMessage(cmake::FATAL_ERROR, e.str()); - - // Clear the configured tool-set + bool const isDefaultToolset = + this->IsDefaultToolset(this->GeneratorToolsetVersion); + if (isDefaultToolset) { + // If the given version is the default toolset, remove the setting this->GeneratorToolsetVersion.clear(); + } else { + std::string const toolsetPath = this->GetAuxiliaryToolset(); + if (!toolsetPath.empty() && !cmSystemTools::FileExists(toolsetPath)) { + + std::ostringstream e; + /* clang-format off */ + e << + "Generator\n" + " " << this->GetName() << "\n" + "given toolset and version specification\n" + " " << this->GetPlatformToolsetString() << ",version=" << + this->GeneratorToolsetVersion << "\n" + "does not seem to be installed at\n" << + " " << toolsetPath; + ; + /* clang-format on */ + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); + + // Clear the configured tool-set + this->GeneratorToolsetVersion.clear(); + } } } @@ -615,6 +622,12 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaString() const return this->GeneratorToolsetCuda; } +bool cmGlobalVisualStudio10Generator::IsDefaultToolset( + const std::string&) const +{ + return true; +} + std::string cmGlobalVisualStudio10Generator::GetAuxiliaryToolset() const { return {}; diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index f85b773..6eb597c 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -106,6 +106,7 @@ public: std::string Encoding() override; virtual const char* GetToolsVersion() { return "4.0"; } + virtual bool IsDefaultToolset(const std::string& version) const; virtual std::string GetAuxiliaryToolset() const; bool FindMakeProgram(cmMakefile* mf) override; diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx index 6af5793..9983a43 100644 --- a/Source/cmGlobalVisualStudio15Generator.cxx +++ b/Source/cmGlobalVisualStudio15Generator.cxx @@ -158,6 +158,27 @@ bool cmGlobalVisualStudio15Generator::GetVSInstance(std::string& dir) const return vsSetupAPIHelper.GetVSInstanceInfo(dir); } +bool cmGlobalVisualStudio15Generator::IsDefaultToolset( + const std::string& version) const +{ + if (version.empty()) { + return true; + } + + std::string vcToolsetVersion; + if (this->vsSetupAPIHelper.GetVCToolsetVersion(vcToolsetVersion)) { + + cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9]+"); + if (regex.find(version) && regex.find(vcToolsetVersion)) { + const auto majorMinorEnd = vcToolsetVersion.find('.', 3); + const auto majorMinor = vcToolsetVersion.substr(0, majorMinorEnd); + return version == majorMinor; + } + } + + return false; +} + std::string cmGlobalVisualStudio15Generator::GetAuxiliaryToolset() const { const char* version = this->GetPlatformToolsetVersion(); diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h index 3b9cfc7..cdc97ad 100644 --- a/Source/cmGlobalVisualStudio15Generator.h +++ b/Source/cmGlobalVisualStudio15Generator.h @@ -32,6 +32,7 @@ public: bool GetVSInstance(std::string& dir) const; + bool IsDefaultToolset(const std::string& version) const override; std::string GetAuxiliaryToolset() const override; protected: diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 47741f9..e9a08bf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3156,8 +3156,13 @@ void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) if (this->Architectures.empty()) { // With no ARCHS we use ONLY_ACTIVE_ARCH. // Look up the arch that Xcode chooses in this case. - if (const char* arch = mf->GetDefinition("CMAKE_XCODE_CURRENT_ARCH")) { + if (const char* arch = mf->GetDefinition("CMAKE_XCODE_ARCHS")) { this->ObjectDirArchDefault = arch; + // We expect only one arch but choose the first just in case. + std::string::size_type pos = this->ObjectDirArchDefault.find(';'); + if (pos != std::string::npos) { + this->ObjectDirArchDefault = this->ObjectDirArchDefault.substr(0, pos); + } } } @@ -3333,15 +3338,10 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( } this->WriteXCodePBXProj(fout, root, generators); - // Since the lowest available Xcode version for testing was 6.4, - // I'm setting this as a limit then - if (this->XcodeVersion >= 64) { - if (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() || - root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")) { - this->OutputXCodeSharedSchemes(xcodeDir); - this->OutputXCodeWorkspaceSettings(xcodeDir); - } + if (this->IsGeneratingScheme(root)) { + this->OutputXCodeSharedSchemes(xcodeDir); } + this->OutputXCodeWorkspaceSettings(xcodeDir, root); this->ClearXCodeObjects(); @@ -3351,6 +3351,15 @@ void cmGlobalXCodeGenerator::OutputXCodeProject( root->GetBinaryDirectory()); } +bool cmGlobalXCodeGenerator::IsGeneratingScheme(cmLocalGenerator* root) const +{ + // Since the lowest available Xcode version for testing was 6.4, + // I'm setting this as a limit then + return this->XcodeVersion >= 64 && + (root->GetMakefile()->GetCMakeInstance()->GetIsInTryCompile() || + root->GetMakefile()->IsOn("CMAKE_XCODE_GENERATE_SCHEME")); +} + void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( const std::string& xcProjDir) { @@ -3390,7 +3399,7 @@ void cmGlobalXCodeGenerator::OutputXCodeSharedSchemes( } void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( - const std::string& xcProjDir) + const std::string& xcProjDir, cmLocalGenerator* root) { std::string xcodeSharedDataDir = xcProjDir; xcodeSharedDataDir += "/project.xcworkspace/xcshareddata"; @@ -3412,8 +3421,15 @@ void cmGlobalXCodeGenerator::OutputXCodeWorkspaceSettings( xout.StartElement("plist"); xout.Attribute("version", "1.0"); xout.StartElement("dict"); - xout.Element("key", "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded"); - xout.Element("false"); + if (this->XcodeVersion >= 100) { + xout.Element("key", "BuildSystemType"); + xout.Element("string", "Original"); + } + if (this->IsGeneratingScheme(root)) { + xout.Element("key", + "IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded"); + xout.Element("false"); + } xout.EndElement(); // dict xout.EndElement(); // plist xout.EndDocument(); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 0051c4a..ccef6e2 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -182,9 +182,11 @@ private: std::vector<cmLocalGenerator*>& generators); void OutputXCodeProject(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); + bool IsGeneratingScheme(cmLocalGenerator* root) const; // Write shared scheme files for all the native targets void OutputXCodeSharedSchemes(const std::string& xcProjDir); - void OutputXCodeWorkspaceSettings(const std::string& xcProjDir); + void OutputXCodeWorkspaceSettings(const std::string& xcProjDir, + cmLocalGenerator* root); void WriteXCodePBXProj(std::ostream& fout, cmLocalGenerator* root, std::vector<cmLocalGenerator*>& generators); cmXCodeObject* CreateXCodeFileReferenceFromPath(const std::string& fullpath, diff --git a/Source/cmVS10CudaFlagTable.h b/Source/cmVS10CudaFlagTable.h index da19d64..2b57e08 100644 --- a/Source/cmVS10CudaFlagTable.h +++ b/Source/cmVS10CudaFlagTable.h @@ -47,5 +47,8 @@ static cmVS7FlagTable cmVS10CudaFlagTable[] = { { "HostDebugInfo", "g", "", "true", 0 }, { "HostDebugInfo", "-debug", "", "true", 0 }, + { "MaxRegCount", "maxrregcount=", "", "", cmVS7FlagTable::UserValue }, + { "MaxRegCount", "maxrregcount", "", "", cmVS7FlagTable::UserFollowing }, + { 0, 0, 0, 0, 0 } }; diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 4ca847e..22fe007 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -199,6 +199,7 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo( if (!cmSystemTools::FileIsDirectory(vcToolsDir)) { return false; } + vsInstanceInfo.VCToolsetVersion = vcToolsVersion; } // Reboot may have been required before the product package was registered @@ -254,6 +255,18 @@ bool cmVSSetupAPIHelper::GetVSInstanceInfo(std::string& vsInstallLocation) return isInstalled; } +bool cmVSSetupAPIHelper::GetVCToolsetVersion(std::string& vsToolsetVersion) +{ + vsToolsetVersion.clear(); + bool isInstalled = this->EnumerateAndChooseVSInstance(); + + if (isInstalled) { + vsToolsetVersion = chosenInstanceInfo.VCToolsetVersion; + } + + return isInstalled && !vsToolsetVersion.empty(); +} + bool cmVSSetupAPIHelper::EnumerateAndChooseVSInstance() { bool isVSInstanceExists = false; diff --git a/Source/cmVSSetupHelper.h b/Source/cmVSSetupHelper.h index 368341c..4144c15 100644 --- a/Source/cmVSSetupHelper.h +++ b/Source/cmVSSetupHelper.h @@ -107,16 +107,12 @@ struct VSInstanceInfo std::wstring InstanceId; std::wstring VSInstallLocation; std::wstring Version; - ULONGLONG ullVersion; - bool IsWin10SDKInstalled; - bool IsWin81SDKInstalled; + std::string VCToolsetVersion; + ULONGLONG ullVersion = 0; + bool IsWin10SDKInstalled = false; + bool IsWin81SDKInstalled = false; - VSInstanceInfo() - { - InstanceId = VSInstallLocation = Version = L""; - ullVersion = 0; - IsWin10SDKInstalled = IsWin81SDKInstalled = false; - } + VSInstanceInfo() = default; std::string GetInstallLocation() const; }; @@ -131,6 +127,7 @@ public: bool IsVS2017Installed(); bool GetVSInstanceInfo(std::string& vsInstallLocation); + bool GetVCToolsetVersion(std::string& vsToolsetVersion); bool IsWin10SDKInstalled(); bool IsWin81SDKInstalled(); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 1768c57..b9ec301 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2809,6 +2809,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( // Get includes for this target cudaOptions.AddIncludes(this->GetIncludes(configName, "CUDA")); + cudaOptions.AddFlag("UseHostInclude", "false"); this->CudaOptions[configName] = std::move(pOptions); return true; diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 3aa57fc..127b365 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -1,30 +1,30 @@ cmake_minimum_required(VERSION 2.6) project(testRebuild) -function(test_for_xcode4 result_var) - set(${result_var} 0 PARENT_SCOPE) - if(APPLE) - execute_process(COMMAND xcodebuild -version - OUTPUT_VARIABLE ov RESULT_VARIABLE rv +if(APPLE) + set(CMake_TEST_XCODE_VERSION 0) + if(XCODE_VERSION) + set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}") + else() + execute_process( + COMMAND xcodebuild -version + OUTPUT_VARIABLE _version ERROR_VARIABLE _version ) - if("${rv}" STREQUAL "0" AND ov MATCHES "^Xcode ([0-9]+)\\.") - if(NOT CMAKE_MATCH_1 VERSION_LESS 4) - set(${result_var} 1 PARENT_SCOPE) - endif() + if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)") + set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}") endif() endif() -endfunction() - -if(APPLE) # only use multi-arch if the sysroot exists on this machine # Ninja needs -M which could not be used with multiple -arch flags if(EXISTS "${CMAKE_OSX_SYSROOT}" AND NOT "${CMAKE_GENERATOR}" MATCHES "Ninja") - set(CMAKE_OSX_ARCHITECTURES "ppc;i386") - test_for_xcode4(is_xcode4) - if(is_xcode4) - # Xcode 4, use modern architectures as defaults - # Arch 'ppc' no longer works: tools no longer available starting with Xcode 4 + if(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 10) + # Arch 'i386' no longer works in Xcode 10. + set(CMAKE_OSX_ARCHITECTURES x86_64) + elseif(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 4) + # Arch 'ppc' no longer works in Xcode 4. set(CMAKE_OSX_ARCHITECTURES i386 x86_64) + else() + set(CMAKE_OSX_ARCHITECTURES ppc i386) endif() endif() endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 886e392..b8b724e 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -252,6 +252,10 @@ if(BUILD_TESTING) set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}") endif() endif() + if(NOT CMake_TEST_XCODE_VERSION VERSION_LESS 10) + # Since Xcode 10 we do not have two supported architectures for the host. + set(CTEST_TEST_OSX_ARCH 0) + endif() if(CMAKE_OSX_SYSROOT) execute_process( COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version ProductName diff --git a/Tests/FindCURL/Test/CMakeLists.txt b/Tests/FindCURL/Test/CMakeLists.txt index f0e5568..c3c719b 100644 --- a/Tests/FindCURL/Test/CMakeLists.txt +++ b/Tests/FindCURL/Test/CMakeLists.txt @@ -7,7 +7,7 @@ find_package(CURL REQUIRED) add_definitions(-DCMAKE_EXPECTED_CURL_VERSION="${CURL_VERSION_STRING}") add_executable(test_tgt main.c) -target_link_libraries(test_tgt CURL::CURL) +target_link_libraries(test_tgt CURL::libcurl) add_test(NAME test_tgt COMMAND test_tgt) add_executable(test_var main.c) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index b2b38ef..69c96cc 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -109,6 +109,7 @@ function(run_cmake test) "|clang[^:]*: warning: the object size sanitizer has no effect at -O0, but is explicitly enabled:" "|Error kstat returned" "|Hit xcodebuild bug" + "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" "|ld: 0711-224 WARNING: Duplicate symbol: .__init_aix_libgcc_cxa_atexit" "|ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information" "|[^\n]*is a member of multiple groups" diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt b/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt deleted file mode 100644 index af3cb2e..0000000 --- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at GLOB-error-FOLLOW_SYMLINKS\.cmake:[0-9]+ \(file\): - file FOLLOW_SYMLINKS is not a valid parameter for GLOB\. -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake b/Tests/RunCMake/file/GLOB-noexp-FOLLOW_SYMLINKS.cmake index 6d467a0..6d467a0 100644 --- a/Tests/RunCMake/file/GLOB-error-FOLLOW_SYMLINKS.cmake +++ b/Tests/RunCMake/file/GLOB-noexp-FOLLOW_SYMLINKS.cmake diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt deleted file mode 100644 index d00491f..0000000 --- a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt b/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt deleted file mode 100644 index ee6cb0b..0000000 --- a/Tests/RunCMake/file/GLOB-noexp-LIST_DIRECTORIES-stderr.txt +++ /dev/null @@ -1,4 +0,0 @@ -^CMake Error at GLOB-noexp-LIST_DIRECTORIES\.cmake:[0-9]+ \(file\): - file GLOB requires a glob expression after the bool\. -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 342606b..b383230 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -39,12 +39,12 @@ run_cmake(GLOB_RECURSE-noexp-FOLLOW_SYMLINKS) # tests are valid both for GLOB and GLOB_RECURSE run_cmake(GLOB-sort-dedup) -run_cmake(GLOB-error-FOLLOW_SYMLINKS) run_cmake(GLOB-error-LIST_DIRECTORIES-not-boolean) run_cmake(GLOB-error-LIST_DIRECTORIES-no-arg) run_cmake(GLOB-error-RELATIVE-no-arg) run_cmake(GLOB-error-CONFIGURE_DEPENDS-modified) run_cmake(GLOB-noexp-CONFIGURE_DEPENDS) +run_cmake(GLOB-noexp-FOLLOW_SYMLINKS) run_cmake(GLOB-noexp-LIST_DIRECTORIES) run_cmake(GLOB-noexp-RELATIVE) run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P |