From 6718caaa2f6070a70ccb2d7efe1652d27c9b4902 Mon Sep 17 00:00:00 2001 From: Kelly Walker Date: Thu, 14 Jan 2021 15:44:16 -0500 Subject: IRSL: Install msvcp${v}${d}_atomic_wait.dll if available with CRT VS now distributes these additional runtime libraries. Install them if available. Fixes: #21675 --- Modules/InstallRequiredSystemLibraries.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index caca697..29d1ec0 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -291,6 +291,7 @@ if(MSVC) foreach(crt "${MSVC_CRT_DIR}/msvcp${v}_1.dll" "${MSVC_CRT_DIR}/msvcp${v}_2.dll" + "${MSVC_CRT_DIR}/msvcp${v}_atomic_wait.dll" "${MSVC_CRT_DIR}/msvcp${v}_codecvt_ids.dll" "${MSVC_CRT_DIR}/vcruntime${v}_1.dll" ) @@ -319,6 +320,7 @@ if(MSVC) foreach(crt "${MSVC_CRT_DIR}/msvcp${v}_1d.dll" "${MSVC_CRT_DIR}/msvcp${v}_2d.dll" + "${MSVC_CRT_DIR}/msvcp${v}d_atomic_wait.dll" "${MSVC_CRT_DIR}/msvcp${v}d_codecvt_ids.dll" "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll" ) -- cgit v0.12 From 6cee4c6a8b83487af3144446ca156476a941c155 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Sun, 17 Jan 2021 15:31:52 +0100 Subject: Restore support for cross-compiling CMake itself In commit eb583b0a66 (cmake_path command: path management, 2020-07-23, v3.19.0-rc1~216^2~1) we added a `try_run`. In cross-compilation mode, C++ features tests must avoid running tests if there is no emulator defined. --- Source/Checks/cm_cxx_features.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 663d89a..7917d41 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -81,7 +81,13 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE) endif() cm_check_cxx_feature(unique_ptr) if (NOT CMAKE_CXX_STANDARD LESS "17") - cm_check_cxx_feature(filesystem TRY_RUN) + if (NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR) + cm_check_cxx_feature(filesystem TRY_RUN) + else() + # In cross-compiling mode, it is not possible to check implementation bugs + # so rely only on conformance done by compilation + cm_check_cxx_feature(filesystem) + endif() else() set(CMake_HAVE_CXX_FILESYSTEM FALSE) endif() -- cgit v0.12 From f2d92b983b8d46f54f4de050d5a10d59ba3ebec0 Mon Sep 17 00:00:00 2001 From: Bianca van Schaik Date: Thu, 14 Jan 2021 14:28:48 +0100 Subject: GetPrerequisites: Include weak macOS dependencies Starting with Clang 12, `otool -L` adds `, weak` to weakly linked libraries. Update GetPrerequisites to recognize these. Issue: #21684 --- Modules/GetPrerequisites.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index c99c772..2d4765a 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -735,7 +735,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(gp_regex_cmp_count 1) elseif(gp_tool MATCHES "otool$") set(gp_cmd_args "-L") - set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$") + set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)(, weak)?\\)${eol_char}$") set(gp_regex_error "") set(gp_regex_fallback "") set(gp_regex_cmp_count 3) -- cgit v0.12 From 7e615a540ea346716ba3d94b4bcecb35c42d5107 Mon Sep 17 00:00:00 2001 From: Bianca van Schaik Date: Fri, 15 Jan 2021 10:20:21 +0100 Subject: file(GET_RUNTIME_DEPENDENCIES): Fix weak macOS libraries not detected Starting with Clang 12, `otool -l` reports `LC_LOAD_WEAK_DYLIB` instead of `LC_LOAD_DYLIB` for weakly linked libraries. Update the implementation of `file(GET_RUNTIME_DEPENDENCIES)` to recognize these. Fixes: #21684 --- ...lsMacOSMachOOToolGetRuntimeDependenciesTool.cxx | 2 +- .../macos-all-check.cmake | 22 ++++++++++++++++++++++ .../file-GET_RUNTIME_DEPENDENCIES/macos.cmake | 15 +++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx index 351d92a..6d97720 100644 --- a/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx +++ b/Source/cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.cxx @@ -44,7 +44,7 @@ bool cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool::GetFileInfo( std::string line; static const cmsys::RegularExpression rpathRegex("^ *cmd LC_RPATH$"); static const cmsys::RegularExpression loadDylibRegex( - "^ *cmd LC_LOAD_DYLIB$"); + "^ *cmd LC_LOAD(_WEAK)?_DYLIB$"); static const cmsys::RegularExpression pathRegex( "^ *path (.*) \\(offset [0-9]+\\)$"); static const cmsys::RegularExpression nameRegex( diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake index e6f2623..e7cdbf6 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-all-check.cmake @@ -148,6 +148,27 @@ set(_check ) check_contents(deps/udeps6.txt "^${_check}$") +# Weak library reference should have exactly the same dependencies as a regular library reference (test 1) +set_with_libsystem(_check + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/libtestlib\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/normal/libnormal\.dylib]] + [[[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]] + ) +check_contents(deps/deps7.txt "^${_check}$") + +set(_check + [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]] + [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]] + [[@rpath/librpath_executable_path_bundle\.dylib]] + [[@rpath/librpath_loader_path_unresolved\.dylib]] + [[@rpath/librpath_unresolved\.dylib]] + ) +check_contents(deps/udeps7.txt "^${_check}$") + set(_check "^libconflict\\.dylib:[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict/libconflict\\.dylib;[^;]*/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-build/root-all/executable/lib/conflict2/libconflict\\.dylib\n$" ) @@ -157,3 +178,4 @@ check_contents(deps/cdeps3.txt "${_check}") check_contents(deps/cdeps4.txt "${_check}") check_contents(deps/cdeps5.txt "${_check}") check_contents(deps/cdeps6.txt "${_check}") +check_contents(deps/cdeps7.txt "${_check}") diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake index c56a14b..aab19b7 100644 --- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake +++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos.cmake @@ -128,16 +128,19 @@ endforeach() target_link_libraries(testlib PRIVATE ${testlib_names}) add_executable(topexe macos/topexe.c) +add_executable(topexe_weak macos/topexe.c) add_library(toplib SHARED macos/toplib.c) add_library(topmod MODULE macos/toplib.c) target_link_libraries(topexe PRIVATE testlib) +target_link_libraries(topexe_weak PRIVATE "-weak_library" testlib) target_link_libraries(toplib PRIVATE testlib) target_link_libraries(topmod PRIVATE testlib) set_property(TARGET topexe toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib") +set_property(TARGET topexe_weak toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib") -install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib) -install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib) +install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib) +install(TARGETS topexe topexe_weak toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib) install(CODE [[ function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile) @@ -213,4 +216,12 @@ install(CODE [[ "${CMAKE_INSTALL_PREFIX}/executable/lib/$" BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$" ) + + exec_get_runtime_dependencies( + deps7.txt udeps7.txt cdeps7.txt + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/executable/bin/$" + LIBRARIES + "${CMAKE_INSTALL_PREFIX}/executable/lib/$" + ) ]]) -- cgit v0.12 From 2439a048b0b98b654d6b4a68146eb65283c575e8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 20 Jan 2021 14:04:25 -0500 Subject: FindHDF5: avoid writing to the output when testing h5cc The execution of this tool can output error logs to the output during configure. This can then be caught by CTest and flagged as an error during the build. --- Modules/FindHDF5.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 25f5a1f..6bbc821 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -360,6 +360,8 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var execute_process( COMMAND ${HDF5_${language}_COMPILER_EXECUTABLE} ${test_file} WORKING_DIRECTORY ${scratch_dir} + OUTPUT_VARIABLE output + ERROR_VARIABLE output RESULT_VARIABLE return_value ) if(return_value) -- cgit v0.12 From b9246693857b26e24e5a46e88698ff87c52e83fa Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 20 Jan 2021 14:05:14 -0500 Subject: FindHDF5: silence STATUS messages when found with QUIET --- Modules/FindHDF5.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 6bbc821..38388d9 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -364,7 +364,7 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var ERROR_VARIABLE output RESULT_VARIABLE return_value ) - if(return_value) + if(return_value AND NOT HDF5_FIND_QUIETLY) message(STATUS "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.") else() @@ -376,7 +376,7 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var RESULT_VARIABLE return_value OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(return_value) + if(return_value AND NOT HDF5_FIND_QUIETLY) message(STATUS "Unable to determine HDF5 ${language} flags from HDF5 wrapper.") endif() @@ -387,7 +387,7 @@ function( _HDF5_invoke_compiler language output_var return_value_var version_var RESULT_VARIABLE return_value OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(return_value) + if(return_value AND NOT HDF5_FIND_QUIETLY) message(STATUS "Unable to determine HDF5 ${language} version_var from HDF5 wrapper.") endif() -- cgit v0.12 From 1e67482daf417135d09054327368c6651c33fa84 Mon Sep 17 00:00:00 2001 From: jonathan molinatto Date: Wed, 20 Jan 2021 09:55:41 -0500 Subject: VS: Generalize Win10 max SDK version to all VS generators The `CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` variable added in CMake 3.19 by commit ba497111f6 (VS: Add option for custom Win10 SDK version maximum, 2020-08-20, v3.19.0-rc1~262^2) was documented as if it worked for all generators but implemented only to override CMake's builtin default for the VS 2015 max SDK version. Generalize the variable to set a custom max SDK version for later VS versions too. Fixes: #21720 --- Help/release/3.19.rst | 8 ++++++++ .../variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst | 2 +- Source/cmGlobalVisualStudio14Generator.cxx | 6 ++++++ Source/cmGlobalVisualStudio14Generator.h | 6 +++++- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 3 ++- Source/cmGlobalVisualStudioVersionedGenerator.h | 2 +- 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index 7ad27c8..d819e8c 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -400,3 +400,11 @@ Changes made since CMake 3.19.0 include the following. * The naming pattern ``cmake-$ver-macos10.10-universal`` is a universal binary with ``x86_64`` and ``arm64`` architectures. It requires macOS 10.10 or newer. + +3.19.4 +------ + +* The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` + variable introduced in 3.19.0 previously worked only with the + :generator:`Visual Studio 14 2015` generator. It has now been fixed to + work with :ref:`Visual Studio Generators` for later VS versions too. diff --git a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst index 591ea91..d9f136c 100644 --- a/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst +++ b/Help/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM.rst @@ -3,7 +3,7 @@ CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM .. versionadded:: 3.19 -Override the :ref:`Windows 10 SDK Maximum Version for VS 2015`. +Override the :ref:`Windows 10 SDK Maximum Version for VS 2015` and beyond. The :variable:`CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM` variable may be set to a false value (e.g. ``OFF``, ``FALSE``, or ``0``) or the SDK version diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx index e17c6d7..b46f1b9 100644 --- a/Source/cmGlobalVisualStudio14Generator.cxx +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -253,6 +253,12 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion( // If value is an invalid pointer, leave result unchanged. } + return this->GetWindows10SDKMaxVersionDefault(mf); +} + +std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersionDefault( + cmMakefile*) const +{ // The last Windows 10 SDK version that VS 2015 can target is 10.0.14393.0. // // "VS 2015 Users: The Windows 10 SDK (15063, 16299, 17134, 17763) is diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h index 1ccd4c7..7804b83 100644 --- a/Source/cmGlobalVisualStudio14Generator.h +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -40,9 +40,13 @@ protected: // of the toolset is installed bool IsWindowsStoreToolsetInstalled() const; + // Used to adjust the max-SDK-version calculation to accommodate user + // configuration. + std::string GetWindows10SDKMaxVersion(cmMakefile* mf) const; + // Used to make sure that the Windows 10 SDK selected can work with the // version of the toolset. - virtual std::string GetWindows10SDKMaxVersion(cmMakefile* mf) const; + virtual std::string GetWindows10SDKMaxVersionDefault(cmMakefile* mf) const; virtual bool SelectWindows10SDK(cmMakefile* mf, bool required); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 95357e7..84f870e 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -540,7 +540,8 @@ bool cmGlobalVisualStudioVersionedGenerator::IsWin81SDKInstalled() const return false; } -std::string cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersion( +std::string +cmGlobalVisualStudioVersionedGenerator::GetWindows10SDKMaxVersionDefault( cmMakefile*) const { return std::string(); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index af09cbd..46a5f40 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -56,7 +56,7 @@ protected: // Check for a Win 8 SDK known to the registry or VS installer tool. bool IsWin81SDKInstalled() const; - std::string GetWindows10SDKMaxVersion(cmMakefile*) const override; + std::string GetWindows10SDKMaxVersionDefault(cmMakefile*) const override; std::string FindMSBuildCommand() override; std::string FindDevEnvCommand() override; -- cgit v0.12 From 5e5fecb7bca1a351df2c30b63d4d5a7194aa773f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jan 2021 11:38:53 -0500 Subject: ci: speed up cmake and ninja downloads on Windows Invoke-WebRequest uses a progress bar by default, but we have no interactive session anyway. Turn it off to speed up downloads. --- .gitlab/ci/cmake.ps1 | 1 + .gitlab/ci/ninja.ps1 | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1 index 3b42cae..80fd0cd 100755 --- a/.gitlab/ci/cmake.ps1 +++ b/.gitlab/ci/cmake.ps1 @@ -7,6 +7,7 @@ $tarball = "$filename.zip" $outdir = $pwd.Path $outdir = "$outdir\.gitlab" +$ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v$version/$tarball" -OutFile "$outdir\$tarball" $hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 if ($hash.Hash -ne $sha256sum) { diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1 index 91f8b02..cd08954 100755 --- a/.gitlab/ci/ninja.ps1 +++ b/.gitlab/ci/ninja.ps1 @@ -7,6 +7,7 @@ $tarball = "$filename.zip" $outdir = $pwd.Path $outdir = "$outdir\.gitlab" +$ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v$version/$tarball" -OutFile "$outdir\$tarball" $hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 if ($hash.Hash -ne $sha256sum) { -- cgit v0.12 From 8efbb0c95fe79f883973b6f36b718f95662c147c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 21 Jan 2021 11:41:14 -0500 Subject: ci: download WiX on Windows Avoid requiring Windows CI hosts to have WiX installed. --- .gitlab/ci/wix.ps1 | 18 ++++++++++++++++++ .gitlab/os-windows.yml | 3 +++ 2 files changed, 21 insertions(+) create mode 100755 .gitlab/ci/wix.ps1 diff --git a/.gitlab/ci/wix.ps1 b/.gitlab/ci/wix.ps1 new file mode 100755 index 0000000..a9322b6 --- /dev/null +++ b/.gitlab/ci/wix.ps1 @@ -0,0 +1,18 @@ +$erroractionpreference = "stop" + +$release = "wix3112rtm" +$sha256sum = "2C1888D5D1DBA377FC7FA14444CF556963747FF9A0A289A3599CF09DA03B9E2E" +$filename = "wix311-binaries" +$tarball = "$filename.zip" + +$outdir = $pwd.Path +$outdir = "$outdir\.gitlab" +$ProgressPreference = 'SilentlyContinue' +Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/$release/$tarball" -OutFile "$outdir\$tarball" +$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 +if ($hash.Hash -ne $sha256sum) { + exit 1 +} + +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir\wix\bin") diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 63b8758..6b46573 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -72,9 +72,12 @@ ## Windows-specific scripts .before_script_windows: &before_script_windows + - Invoke-Expression -Command .gitlab/ci/wix.ps1 - Invoke-Expression -Command .gitlab/ci/cmake.ps1 - Invoke-Expression -Command .gitlab/ci/ninja.ps1 - $pwdpath = $pwd.Path + - Set-Item -Force -Path "env:WIX" -Value "$pwdpath\.gitlab\wix" + - (& "$env:WIX\bin\light.exe" -help) | Select -First 1 - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH" - cmake --version - ninja --version -- cgit v0.12 From 2a5955ac0934ca11d706a8d6508561681e5a0581 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 22 Jan 2021 09:37:09 -0500 Subject: Intel: Replace deprecated Fortran flag -nofor_main with -nofor-main The `-nofor_main` flag was originally added by commit ccdd3e943d (Fix Intel Fortran SHARED libraries on Linux, 2009-10-27, v2.8.2~915). Since then, Intel Fortran renamed the option to `-nofor-main` and deprecated the old name. The new name has been available for a long time, so we can just switch to it. Fixes: #21735 --- Modules/Platform/Linux-Intel-Fortran.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index d8e94d0..a99e793 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,4 +1,4 @@ include(Platform/Linux-Intel) __linux_compiler_intel(Fortran) -string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor_main") +string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor-main") set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") -- cgit v0.12 From 1d7daa668c774d6cbe876680656bf5be06ca7187 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 25 Jan 2021 10:51:23 -0500 Subject: Help: Add Ninja Multi-Config to list in GENERATOR_IS_MULTI_CONFIG Fixes: #21739 --- Help/prop_gbl/GENERATOR_IS_MULTI_CONFIG.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Help/prop_gbl/GENERATOR_IS_MULTI_CONFIG.rst b/Help/prop_gbl/GENERATOR_IS_MULTI_CONFIG.rst index 6f1a9e1..761a1dd 100644 --- a/Help/prop_gbl/GENERATOR_IS_MULTI_CONFIG.rst +++ b/Help/prop_gbl/GENERATOR_IS_MULTI_CONFIG.rst @@ -5,7 +5,11 @@ GENERATOR_IS_MULTI_CONFIG Read-only property that is true on multi-configuration generators. -True when using a multi-configuration generator -(such as :ref:`Visual Studio Generators` or :generator:`Xcode`). +True when using a multi-configuration generator such as: + +* :generator:`Ninja Multi-Config` +* :ref:`Visual Studio Generators` +* :generator:`Xcode` + Multi-config generators use :variable:`CMAKE_CONFIGURATION_TYPES` as the set of configurations and ignore :variable:`CMAKE_BUILD_TYPE`. -- cgit v0.12 From 0c86d15459eeef2ddd15644b7bb3d7854f226334 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 28 Jan 2021 10:28:45 -0500 Subject: CMake 3.19.4 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0f9f8e8..2f98453 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 3) +set(CMake_VERSION_PATCH 4) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 375b307bae4513b69b9f86549a094da7f2e8b3a7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 18 Dec 2020 13:44:44 -0500 Subject: Apple: Fix linking to frameworks that do not exist until build time Fixes: #21621 --- Source/cmComputeLinkInformation.cxx | 18 ++++++------------ Source/cmComputeLinkInformation.h | 1 - Tests/Framework/CMakeLists.txt | 16 ++++++++++++++++ Tests/Framework/External/CMakeLists.txt | 5 +++++ Tests/Framework/External/external.c | 4 ++++ Tests/Framework/useExternal.c | 6 ++++++ 6 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 Tests/Framework/External/CMakeLists.txt create mode 100644 Tests/Framework/External/external.c create mode 100644 Tests/Framework/useExternal.c diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 201a9d9..6e1fac0 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -699,9 +699,13 @@ void cmComputeLinkInformation::AddItem(BT const& item, } else { // This is not a CMake target. Use the name given. if (cmSystemTools::FileIsFullPath(item.Value)) { - if (cmSystemTools::FileIsDirectory(item.Value)) { + if (cmSystemTools::IsPathToFramework(item.Value) && + this->Makefile->IsOn("APPLE")) { + // This is a framework. + this->AddFrameworkItem(item.Value); + } else if (cmSystemTools::FileIsDirectory(item.Value)) { // This is a directory. - this->AddDirectoryItem(item.Value); + this->DropDirectoryItem(item.Value); } else { // Use the full path given to the library file. this->Depends.push_back(item.Value); @@ -1306,16 +1310,6 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) } } -void cmComputeLinkInformation::AddDirectoryItem(std::string const& item) -{ - if (this->Makefile->IsOn("APPLE") && - cmSystemTools::IsPathToFramework(item)) { - this->AddFrameworkItem(item); - } else { - this->DropDirectoryItem(item); - } -} - void cmComputeLinkInformation::DropDirectoryItem(std::string const& item) { // A full path to a directory was found as a link item. Warn the diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index 543b6d7..ec8d73c 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -155,7 +155,6 @@ private: void AddFullItem(BT const& item); bool CheckImplicitDirItem(std::string const& item); void AddUserItem(BT const& item, bool pathNotKnown); - void AddDirectoryItem(std::string const& item); void AddFrameworkItem(std::string const& item); void DropDirectoryItem(std::string const& item); bool CheckSharedLibNoSOName(std::string const& item); diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index a313c2c..f741ec2 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -84,3 +84,19 @@ if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5) endif() include(CPack) + +if(APPLE) + set(ExternalFramework_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/External") + file(REMOVE_RECURSE "${ExternalFramework_INSTALL_DIR}") + + include(ExternalProject) + ExternalProject_Add(ExternalFramework + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/External" + INSTALL_DIR "${ExternalFramework_INSTALL_DIR}" + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= + ) + + add_executable(useExternal useExternal.c) + target_link_libraries(useExternal PRIVATE "${ExternalFramework_INSTALL_DIR}/lib/External.framework") + add_dependencies(useExternal ExternalFramework) +endif() diff --git a/Tests/Framework/External/CMakeLists.txt b/Tests/Framework/External/CMakeLists.txt new file mode 100644 index 0000000..b9128fd --- /dev/null +++ b/Tests/Framework/External/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.19) +project(ExternalFramework C) +add_library(External SHARED external.c) +set_property(TARGET External PROPERTY FRAMEWORK 1) +install(TARGETS External DESTINATION lib) diff --git a/Tests/Framework/External/external.c b/Tests/Framework/External/external.c new file mode 100644 index 0000000..8441e71 --- /dev/null +++ b/Tests/Framework/External/external.c @@ -0,0 +1,4 @@ +int external(void) +{ + return 0; +} diff --git a/Tests/Framework/useExternal.c b/Tests/Framework/useExternal.c new file mode 100644 index 0000000..8494b15 --- /dev/null +++ b/Tests/Framework/useExternal.c @@ -0,0 +1,6 @@ +extern int external(void); + +int main(void) +{ + return external(); +} -- cgit v0.12 From df08f8df3027db25eb1cb75fb6017c3a8c046674 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 3 Feb 2021 23:02:36 +1100 Subject: cmComputeLinkInformation: Fix misspelt private variable name --- Source/cmComputeLinkInformation.cxx | 6 +++--- Source/cmComputeLinkInformation.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 6e1fac0..d1680ad 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1336,8 +1336,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() "CMAKE_", this->LinkLanguage, "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"); this->Makefile->GetDefExpandList(implicitDirVar, implicitDirVec); - this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(), - implicitDirVec.end()); + this->FrameworkPathsEmitted.insert(implicitDirVec.begin(), + implicitDirVec.end()); // Regular expression to extract a framework path and name. this->SplitFramework.compile("(.*)/(.*)\\.framework$"); @@ -1345,7 +1345,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() void cmComputeLinkInformation::AddFrameworkPath(std::string const& p) { - if (this->FrameworkPathsEmmitted.insert(p).second) { + if (this->FrameworkPathsEmitted.insert(p).second) { this->FrameworkPaths.push_back(p); } } diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index ec8d73c..d8ec563 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -164,7 +164,7 @@ private: // Framework info. void ComputeFrameworkInfo(); void AddFrameworkPath(std::string const& p); - std::set FrameworkPathsEmmitted; + std::set FrameworkPathsEmitted; cmsys::RegularExpression SplitFramework; // Linker search path computation. -- cgit v0.12 From 5389bb4274f80b69e45aceffbdf3ffdb1e79908f Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 3 Feb 2021 23:03:00 +1100 Subject: Xcode: Don't hard-code SDK-provided implicit framework search paths When a framework is linked to a target by its full path and that framework is located in one of the implicit framework search directories, CMake 3.18.5 and earlier discarded that path. ce2dee9e5ba (Xcode: Don't add framework as -framework argument in linker info list, 2020-09-28) introduced a regression which resulted in the framework path always being added to the search path even if it matched one of the implicit search paths. This broke the ability to do device and simulator builds from the same configured project. Fixes: #21678 --- Source/cmComputeLinkInformation.cxx | 6 ++++++ Source/cmComputeLinkInformation.h | 1 + Source/cmGlobalXCodeGenerator.cxx | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index d1680ad..b9f15b7 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -474,6 +474,12 @@ std::vector const& cmComputeLinkInformation::GetFrameworkPaths() return this->FrameworkPaths; } +std::set const& +cmComputeLinkInformation::GetFrameworkPathsEmitted() const +{ + return this->FrameworkPathsEmitted; +} + const std::set& cmComputeLinkInformation::GetSharedLibrariesLinked() const { diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h index d8ec563..9fec702 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -55,6 +55,7 @@ public: std::vector> GetDirectoriesWithBacktraces(); std::vector const& GetDepends() const; std::vector const& GetFrameworkPaths() const; + std::set const& GetFrameworkPathsEmitted() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector const& GetRuntimeSearchPath() const; std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index df45b35..51a7915 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3620,6 +3620,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // now add the left-over link libraries { + // Keep track of framework search paths we've already added or that are + // part of the set of implicit search paths. We don't want to repeat + // them and we also need to avoid hard-coding any SDK-specific paths. + // This is essential for getting device-and-simulator builds to work, + // otherwise we end up hard-coding a path to the wrong SDK for + // SDK-provided frameworks that are added by their full path. + std::set emitted(cli->GetFrameworkPathsEmitted()); + const auto& fwPaths = cli->GetFrameworkPaths(); + emitted.insert(fwPaths.begin(), fwPaths.end()); BuildObjectListOrString libPaths(this, true); for (auto const& libItem : configItemMap[configName]) { auto const& libName = *libItem; @@ -3633,7 +3642,11 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) const auto fwName = cmSystemTools::GetFilenameWithoutExtension(libPath); const auto fwDir = cmSystemTools::GetParentDirectory(libPath); - libPaths.Add("-F " + this->XCodeEscapePath(fwDir)); + if (emitted.insert(fwDir).second) { + // This is a search path we had not added before and it isn't an + // implicit search path, so we need it + libPaths.Add("-F " + this->XCodeEscapePath(fwDir)); + } libPaths.Add("-framework " + fwName); } else { libPaths.Add(this->XCodeEscapePath(cleanPath)); -- cgit v0.12 From 4ea6d3c3aea25968fbbd2c4cece56a10eccf48ab Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Mon, 1 Feb 2021 15:05:21 -0500 Subject: FindCUDAToolkit: Restore use of CUDA_PATH environment variable Refactoring in commit 7cc815a2a6 (CUDAToolkit: Detect CUDA SDK that don't have nvcc, 2020-07-24, v3.19.0-rc1~366^2) accidentally broke use of the `CUDA_PATH` environment variable. Fixes: #21740 --- Modules/FindCUDAToolkit.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake index b3c8569..d4cd338 100644 --- a/Modules/FindCUDAToolkit.cmake +++ b/Modules/FindCUDAToolkit.cmake @@ -561,7 +561,7 @@ else() _CUDAToolkit_find_root_dir(SEARCH_PATHS "${CUDAToolkit_ROOT}" FIND_FLAGS PATH_SUFFIXES bin NO_DEFAULT_PATH) endif() if(NOT CUDAToolkit_ROOT_DIR) - _CUDAToolkit_find_root_dir(FIND_FLAGS PATHS "ENV CUDA_PATH" PATH_SUFFIXES bin) + _CUDAToolkit_find_root_dir(FIND_FLAGS PATHS ENV CUDA_PATH PATH_SUFFIXES bin) endif() # If the user specified CUDAToolkit_ROOT but the toolkit could not be found, this is an error. -- cgit v0.12 From 82930647607d23b118c84194afc3c70d6d8e79e3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 3 Feb 2021 12:07:49 -0500 Subject: FindBoost: Add support for Boost 1.75 Update the list of known versions. Run the command cmake -DBOOST_DIR=/path/to/boost_1_75_0 \ -P Utilities/Scripts/BoostScanDeps.cmake to extract dependencies from the 1.75.0 source tree. They differ from 1.74's dependencies by the addition of dependencies of the json component, so add a new version block to FindBoost. Fixes: #21773 --- Modules/FindBoost.cmake | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 00e4ff1..54d9593 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1186,11 +1186,26 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(Boost_VERSION_STRING VERSION_LESS 1.75.0) + set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) + set(_Boost_COROUTINE_DEPENDENCIES context) + set(_Boost_FIBER_DEPENDENCIES context) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python${component_python_version} mpi serialization) + set(_Boost_NUMPY_DEPENDENCIES python${component_python_version}) + set(_Boost_THREAD_DEPENDENCIES chrono date_time atomic) + set(_Boost_TIMER_DEPENDENCIES chrono) + set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() set(_Boost_CONTRACT_DEPENDENCIES thread chrono date_time) set(_Boost_COROUTINE_DEPENDENCIES context) set(_Boost_FIBER_DEPENDENCIES context) set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_JSON_DEPENDENCIES container) set(_Boost_LOG_DEPENDENCIES date_time log_setup filesystem thread regex chrono atomic) set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) set(_Boost_MPI_DEPENDENCIES serialization) @@ -1200,7 +1215,7 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_TIMER_DEPENDENCIES chrono) set(_Boost_WAVE_DEPENDENCIES filesystem serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.75.0) + if(Boost_VERSION_STRING VERSION_GREATER_EQUAL 1.76.0) message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") endif() endif() @@ -1472,7 +1487,7 @@ else() # _Boost_COMPONENT_HEADERS. See the instructions at the top of # _Boost_COMPONENT_DEPENDENCIES. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.74.0" "1.74" + "1.75.0" "1.75" "1.74.0" "1.74" "1.73.0" "1.73" "1.72.0" "1.72" "1.71.0" "1.71" "1.70.0" "1.70" "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" -- cgit v0.12 From c40e81ce8023f4b21860ae94adeddcf78ed2f935 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 4 Feb 2021 09:05:58 -0500 Subject: Help: Restore docs that find_library considers LIB, not INCLUDE Documentation updates in commit 02f527c66a (Find: Provide global controls for the `NO_[]_PATH` call options, 2019-06-12, v3.16.0-rc1~541^2) accidentally switched the `find_library` documentation to mention `INCLUDE` where it should be `LIB`. While at it, update `find_file` and `find_path` to mention `INCLUDE` and `PATH` in the order they are considered. --- Help/command/find_file.rst | 3 ++- Help/command/find_library.rst | 3 ++- Help/command/find_path.rst | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Help/command/find_file.rst b/Help/command/find_file.rst index 3f03f37..39dfb85 100644 --- a/Help/command/find_file.rst +++ b/Help/command/find_file.rst @@ -17,7 +17,8 @@ find_file .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``INCLUDE`` + and ``PATH``. .. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. diff --git a/Help/command/find_library.rst b/Help/command/find_library.rst index 8a55aca..ab957ce 100644 --- a/Help/command/find_library.rst +++ b/Help/command/find_library.rst @@ -17,7 +17,8 @@ find_library .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_LIBRARY_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``LIB`` + and ``PATH``. .. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: ``/lib/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. diff --git a/Help/command/find_path.rst b/Help/command/find_path.rst index 52ffe3c..ec66771 100644 --- a/Help/command/find_path.rst +++ b/Help/command/find_path.rst @@ -17,7 +17,8 @@ find_path .. |CMAKE_XXX_PATH| replace:: :variable:`CMAKE_INCLUDE_PATH` .. |CMAKE_XXX_MAC_PATH| replace:: :variable:`CMAKE_FRAMEWORK_PATH` -.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``PATH`` and ``INCLUDE``. +.. |SYSTEM_ENVIRONMENT_PATH_XXX| replace:: The directories in ``INCLUDE`` + and ``PATH``. .. |SYSTEM_ENVIRONMENT_PATH_WINDOWS_XXX| replace:: On Windows hosts: ``/include/`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. -- cgit v0.12 From a8b41e2c68ca38b2b47f20c591042fb69a731494 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Feb 2021 07:11:58 -0500 Subject: LexerParser: Do not override existing _POSIX_C_SOURCE definition In commit f034b0f663 (CMake compilation: do not use compiler extensions, 2020-03-14, v3.18.0-rc1~494^2) we explicitly defined `_POSIX_C_SOURCE` to ensure availability of POSIX APIs even when compiler extensions are not enabled. Update the code to avoid redefining `_POSIX_C_SOURCE` if it is already defined. This occurs when building our release binaries as configured in `Utilities/Release/linux`, where we define `_POSIX_C_SOURCE` explicitly on the compiler command line. --- Source/cmStandardLexer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index e0b2116..b248b91 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -7,7 +7,7 @@ /* Needed for glibc < 2.12 */ # define _XOPEN_SOURCE 600 #endif -#if !defined(_WIN32) && !defined(__sun) +#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun) /* POSIX APIs are needed */ # define _POSIX_C_SOURCE 200809L #endif -- cgit v0.12 From 0110aa018d81a7b0f1f9371fcd038b71fefae554 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Mon, 8 Feb 2021 17:30:48 +1100 Subject: IOS_INSTALL_COMBINED: Support Xcode 12 (command line only) Xcode 12 doesn't allow nested builds within the same build directory. That means we can no longer do an install by building the install target when IOS_INSTALL_COMBINED is true. We can, however, still do an install by running the cmake_install.cmake script or executing cmake --install, since there is no outer build and therefore the associated SDK can be built as a sub-build. The non-build methods previously didn't work when IOS_INSTALL_COMBINED was true because the generated install script and the CMakeIOSInstallCombined script both made certain assumptions that relied on being part of a build. Those assumptions are now removed. A side-effect of this work is that cpack now also works from the command line when IOS_INSTALL_COMBINED is true. Relates: #21282 Fixes: #20023 --- Modules/CMakeIOSInstallCombined.cmake | 31 ++++++----- Source/cmLocalGenerator.cxx | 2 + Source/cmLocalGenerator.h | 2 + Source/cmLocalXCodeGenerator.cxx | 60 ++++++++++++++++++++-- Source/cmLocalXCodeGenerator.h | 2 +- Tests/RunCMake/XcodeProject/RunCMakeTest.cmake | 29 +++++++++-- ...codeIOSInstallCombined-cmakeinstall-check.cmake | 2 + ...tallCombinedSingleArch-cmakeinstall-check.cmake | 2 + 8 files changed, 109 insertions(+), 21 deletions(-) create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake create mode 100644 Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake diff --git a/Modules/CMakeIOSInstallCombined.cmake b/Modules/CMakeIOSInstallCombined.cmake index 44bb622..b022217 100644 --- a/Modules/CMakeIOSInstallCombined.cmake +++ b/Modules/CMakeIOSInstallCombined.cmake @@ -3,10 +3,11 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) # if IN_LIST +cmake_policy(SET CMP0054 NEW) # Function to print messages of this module function(_ios_install_combined_message) - message("[iOS combined] " ${ARGN}) + message(STATUS "[iOS combined] " ${ARGN}) endfunction() # Get build settings for the current target/config/SDK by running @@ -176,29 +177,33 @@ function(_ios_install_combined_keep_archs lib archs) endforeach() endfunction() -function(_ios_install_combined_detect_sdks this_sdk_var corr_sdk_var) - set(this_sdk "$ENV{PLATFORM_NAME}") - if("${this_sdk}" STREQUAL "") - message(FATAL_ERROR "Environment variable PLATFORM_NAME is empty") +function(_ios_install_combined_detect_associated_sdk corr_sdk_var) + if("${PLATFORM_NAME}" STREQUAL "") + message(FATAL_ERROR "PLATFORM_NAME should not be empty") endif() set(all_platforms "$ENV{SUPPORTED_PLATFORMS}") - if("${all_platforms}" STREQUAL "") - message(FATAL_ERROR "Environment variable SUPPORTED_PLATFORMS is empty") + if("${SUPPORTED_PLATFORMS}" STREQUAL "") + _ios_install_combined_get_build_setting( + ${PLATFORM_NAME} SUPPORTED_PLATFORMS all_platforms) + if("${all_platforms}" STREQUAL "") + message(FATAL_ERROR + "SUPPORTED_PLATFORMS not set as an environment variable nor " + "able to be determined from project") + endif() endif() separate_arguments(all_platforms) - if(NOT this_sdk IN_LIST all_platforms) - message(FATAL_ERROR "`${this_sdk}` not found in `${all_platforms}`") + if(NOT PLATFORM_NAME IN_LIST all_platforms) + message(FATAL_ERROR "`${PLATFORM_NAME}` not found in `${all_platforms}`") endif() - list(REMOVE_ITEM all_platforms "" "${this_sdk}") + list(REMOVE_ITEM all_platforms "" "${PLATFORM_NAME}") list(LENGTH all_platforms all_platforms_length) if(NOT all_platforms_length EQUAL 1) message(FATAL_ERROR "Expected one element: ${all_platforms}") endif() - set(${this_sdk_var} "${this_sdk}" PARENT_SCOPE) set(${corr_sdk_var} "${all_platforms}" PARENT_SCOPE) endfunction() @@ -274,10 +279,10 @@ function(ios_install_combined target destination) _ios_install_combined_message("Destination: ${destination}") # Get SDKs - _ios_install_combined_detect_sdks(this_sdk corr_sdk) + _ios_install_combined_detect_associated_sdk(corr_sdk) # Get architectures of the target - _ios_install_combined_get_valid_archs("${this_sdk}" this_valid_archs) + _ios_install_combined_get_valid_archs("${PLATFORM_NAME}" this_valid_archs) _ios_install_combined_get_valid_archs("${corr_sdk}" corr_valid_archs) _ios_install_combined_prune_common_archs("${corr_sdk}" corr_valid_archs this_valid_archs) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2239192..b5580e7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -644,6 +644,8 @@ void cmLocalGenerator::GenerateInstallRules() /* clang-format on */ } + this->AddGeneratorSpecificInstallSetup(fout); + // Ask each install generator to write its code. cmPolicies::PolicyStatus status = this->GetPolicyStatus(cmPolicies::CMP0082); auto const& installers = this->Makefile->GetInstallGenerators(); diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 22d3599..0fa8759 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -493,6 +493,8 @@ protected: std::ostream& os, const std::string& config, std::vector const& configurationTypes); + virtual void AddGeneratorSpecificInstallSetup(std::ostream&) {} + std::string& CreateSafeUniqueObjectFileName(const std::string& sin, std::string const& dir_max); diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index ac0d35e..3b4e3a8 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -4,6 +4,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalXCodeGenerator.h" +#include "cmMakefile.h" #include "cmSourceFile.h" class cmGeneratorTarget; @@ -45,13 +46,66 @@ void cmLocalXCodeGenerator::Generate() } } -void cmLocalXCodeGenerator::GenerateInstallRules() +void cmLocalXCodeGenerator::AddGeneratorSpecificInstallSetup(std::ostream& os) { - cmLocalGenerator::GenerateInstallRules(); - + // First check if we need to warn about incompatible settings for (const auto& target : this->GetGeneratorTargets()) { target->HasMacOSXRpathInstallNameDir(""); } + + // CMakeIOSInstallCombined.cmake needs to know the location of the top of + // the build directory + os << "set(CMAKE_BINARY_DIR \"" << this->GetBinaryDirectory() << "\")\n\n"; + + if (this->Makefile->PlatformIsAppleEmbedded()) { + std::string platformName; + switch (this->Makefile->GetAppleSDKType()) { + case cmMakefile::AppleSDK::IPhoneOS: + platformName = "iphoneos"; + break; + case cmMakefile::AppleSDK::IPhoneSimulator: + platformName = "iphonesimulator"; + break; + case cmMakefile::AppleSDK::AppleTVOS: + platformName = "appletvos"; + break; + case cmMakefile::AppleSDK::AppleTVSimulator: + platformName = "appletvsimulator"; + break; + case cmMakefile::AppleSDK::WatchOS: + platformName = "watchos"; + break; + case cmMakefile::AppleSDK::WatchSimulator: + platformName = "watchsimulator"; + break; + case cmMakefile::AppleSDK::MacOS: + break; + } + if (!platformName.empty()) { + // The effective platform name is just the platform name with a hyphen + // prepended. We can get the SUPPORTED_PLATFORMS from the project file + // at runtime, so we don't need to compute that here. + /* clang-format off */ + os << + "if(NOT PLATFORM_NAME)\n" + " if(NOT \"$ENV{PLATFORM_NAME}\" STREQUAL \"\")\n" + " set(PLATFORM_NAME \"$ENV{PLATFORM_NAME}\")\n" + " endif()\n" + " if(NOT PLATFORM_NAME)\n" + " set(PLATFORM_NAME " << platformName << ")\n" + " endif()\n" + "endif()\n\n" + "if(NOT EFFECTIVE_PLATFORM_NAME)\n" + " if(NOT \"$ENV{EFFECTIVE_PLATFORM_NAME}\" STREQUAL \"\")\n" + " set(EFFECTIVE_PLATFORM_NAME \"$ENV{EFFECTIVE_PLATFORM_NAME}\")\n" + " endif()\n" + " if(NOT EFFECTIVE_PLATFORM_NAME)\n" + " set(EFFECTIVE_PLATFORM_NAME -" << platformName << ")\n" + " endif()\n" + "endif()\n\n"; + /* clang-format off */ + } + } } void cmLocalXCodeGenerator::ComputeObjectFilenames( diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index dd038b4..5f72f6d 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -32,7 +32,7 @@ public: void AppendFlagEscape(std::string& flags, const std::string& rawFlag) const override; void Generate() override; - virtual void GenerateInstallRules(); + void AddGeneratorSpecificInstallSetup(std::ostream& os) override; void ComputeObjectFilenames( std::map& mapping, cmGeneratorTarget const* gt = nullptr) override; diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake index 62163ac..794274c 100644 --- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake +++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake @@ -206,7 +206,7 @@ if(NOT XCODE_VERSION VERSION_LESS 7) unset(RunCMake_TEST_OPTIONS) endif() -if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12) +if(XCODE_VERSION VERSION_GREATER_EQUAL 6) # XcodeIOSInstallCombined set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeIOSInstallCombined-build) set(RunCMake_TEST_NO_CLEAN 1) @@ -220,7 +220,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12) run_cmake(XcodeIOSInstallCombined) run_cmake_command(XcodeIOSInstallCombined-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombined-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombined-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -239,7 +246,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12) run_cmake(XcodeIOSInstallCombinedPrune) run_cmake_command(XcodeIOSInstallCombinedPrune-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedPrune-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedPrune-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) @@ -258,7 +272,14 @@ if(XCODE_VERSION VERSION_GREATER_EQUAL 6 AND XCODE_VERSION VERSION_LESS 12) run_cmake(XcodeIOSInstallCombinedSingleArch) run_cmake_command(XcodeIOSInstallCombinedSingleArch-build ${CMAKE_COMMAND} --build .) - run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) + if(XCODE_VERSION VERSION_LESS 12) + run_cmake_command(XcodeIOSInstallCombinedSingleArch-install ${CMAKE_COMMAND} --build . --target install) + endif() + # --build defaults to Debug, --install defaults to Release, so we have to + # specify the configuration explicitly + run_cmake_command(XcodeIOSInstallCombinedSingleArch-cmakeinstall + ${CMAKE_COMMAND} --install . --config Debug + ) unset(RunCMake_TEST_BINARY_DIR) unset(RunCMake_TEST_NO_CLEAN) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake new file mode 100644 index 0000000..a1ceb13 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombined-cmakeinstall-check.cmake @@ -0,0 +1,2 @@ +# Expect the same results whether installing directly or via cmake --install +include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombined-install-check.cmake) diff --git a/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake new file mode 100644 index 0000000..3f7c379 --- /dev/null +++ b/Tests/RunCMake/XcodeProject/XcodeIOSInstallCombinedSingleArch-cmakeinstall-check.cmake @@ -0,0 +1,2 @@ +# Expect the same results whether installing directly or via cmake --install +include(${CMAKE_CURRENT_LIST_DIR}/XcodeIOSInstallCombinedSingleArch-install-check.cmake) -- cgit v0.12 From eafe740eadb5e9a8dfb2dddc95e063779183f2ab Mon Sep 17 00:00:00 2001 From: Yauheni Khnykin Date: Tue, 9 Feb 2021 10:15:08 +1100 Subject: FindXCTest: Fix output directory for test bundle with new build system The output directory was still correct for macOS with the new build system, but not for iOS. Fixes: #20662 --- Modules/FindXCTest.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/FindXCTest.cmake b/Modules/FindXCTest.cmake index 1f6e825..48371e6 100644 --- a/Modules/FindXCTest.cmake +++ b/Modules/FindXCTest.cmake @@ -155,9 +155,16 @@ function(xctest_add_bundle target testee) set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_BUNDLE_LOADER "$(TEST_HOST)" XCODE_ATTRIBUTE_TEST_HOST "$") - if(NOT XCODE_VERSION VERSION_LESS 7.3) + if(XCODE_VERSION VERSION_GREATER_EQUAL 7.3) + # CMAKE_XCODE_BUILD_SYSTEM equals 12 means that at least Xcode 11.x is used. + if(CMAKE_XCODE_BUILD_SYSTEM EQUAL 12 AND + NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(_output_directory "$") + else() + set(_output_directory "$/PlugIns") + endif() set_target_properties(${target} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "$/PlugIns") + LIBRARY_OUTPUT_DIRECTORY "${_output_directory}") endif() else(XCODE) target_link_libraries(${target} -- cgit v0.12 From 33fa015b4a7ba4b657ac1f4021081bb3490e15cc Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 9 Feb 2021 11:05:08 -0500 Subject: CTest: Restore running dashboard client Test step with modified files Since commit 6a6f1d1edd (CTest: exit nonzero after message(SEND_ERROR|FATAL_ERROR), 2020-04-03, v3.19.0-rc1~260^2), `ctest` no longer runs tests if there are errors before the full set of tests is defined. Such errors were previously treated more like warnings. The change exposed some cases where we were issuing an error message but proceeding to run tests anyway. The above commit downgraded one such case (missing `DartConfiguration.tcl`) to a warning explicitly in order to restore its former warning-like semantics. Downgrade the Update step's diagnostic about modified or conflicting files to a warning for the same reason. Fixes: #21783 --- Source/CTest/cmCTestUpdateHandler.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index f30ba2b..57cc024 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -240,7 +240,7 @@ int cmCTestUpdateHandler::ProcessHandler() if (localModifications) { xml.Content("Update error: " "There are modified or conflicting files in the repository"); - cmCTestLog(this->CTest, ERROR_MESSAGE, + cmCTestLog(this->CTest, WARNING, " There are modified or conflicting files in the repository" << std::endl); } -- cgit v0.12 From 2fc5e5dba903da4c845b41f60fa9adb59c7cfbd1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 9 Feb 2021 11:24:41 -0500 Subject: Clang: Use -imsvc for system include only with MSVC-like front-end In commit bb61c2d024 (Clang: use -imsvc for system include dirs when running on Windows, 2020-09-16, v3.19.0-rc1~162^2) we added `-imsvc` for all Clang compilers targeting the MSVC ABI. However, the option only exists for the MSVC-like front-end. The GNU-like front-ends use `-isystem`. Fixes: #21789 --- Modules/Compiler/Clang.cmake | 1 - Modules/Platform/Windows-Clang.cmake | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 27692c2..c43265d 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -19,7 +19,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC" OR "x${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "xMSVC") macro(__compiler_clang lang) - set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc ") endmacro() else() include(Compiler/GNU) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 389d6ab..7697407 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -169,6 +169,7 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" macro(__windows_compiler_clang_base lang) set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}") __windows_compiler_msvc(${lang}) + set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-imsvc ") endmacro() else() cmake_policy(GET CMP0091 __WINDOWS_CLANG_CMP0091) -- cgit v0.12 From 0e1dba36c388757f9dc817a3f3eeac6e69d34a72 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Feb 2021 09:18:18 -0500 Subject: CMake 3.18.6 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b77e56e..5439a69 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 18) -set(CMake_VERSION_PATCH 5) +set(CMake_VERSION_PATCH 6) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From cd80f3905ffe872ed10523b288a14bb6f32bd882 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 14 Feb 2021 18:28:56 +1100 Subject: Help: Add 3.19.5 release notes for Xcode iOS-related changes --- Help/release/3.19.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index d819e8c..d8f4f9d 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -408,3 +408,20 @@ Changes made since CMake 3.19.0 include the following. variable introduced in 3.19.0 previously worked only with the :generator:`Visual Studio 14 2015` generator. It has now been fixed to work with :ref:`Visual Studio Generators` for later VS versions too. + + +3.19.5 +------ + +* When :prop_tgt:`IOS_INSTALL_COMBINED` is enabled and the :generator:`Xcode` + generator is used, it is now possible to initiate an install or package + creation by running ``cmake --install`` or ``cpack`` from the command line. + When using the Xcode new build system, these are the only supported methods + due to a limitation of Xcode. Initiating these operations by building the + ``install`` or ``package`` targets in Xcode is only supported when using + the legacy build system. + +* The framework handling introduced in 3.19.0 as part of supporting Xcode's + *Link Binaries With Libraries* build phase broke the ability to switch + between device and simulator builds without reconfiguring. That capability + has now been restored. -- cgit v0.12 From d5401de605af11ad3cd1c6faa64bf319af6b67c6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Feb 2021 11:48:33 -0500 Subject: CMake 3.19.5 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2f98453..4ce01e6 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 4) +set(CMake_VERSION_PATCH 5) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 754f4f6876f05b213b5ad2fc1a2e581bf529beb6 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Tue, 16 Feb 2021 11:07:51 +0100 Subject: FindPython: fix erroneous variable handling Fixes: #21817 --- Modules/FindPython/Support.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake index 79b1d18..8b2d739 100644 --- a/Modules/FindPython/Support.cmake +++ b/Modules/FindPython/Support.cmake @@ -1528,7 +1528,7 @@ if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE) list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE) elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION) - list (APPEND VERSION ${${_PYTHON_PREFIX}_FIND_VERSION}) + list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_PREFIX}_FIND_VERSION}) endif() while (TRUE) @@ -1996,7 +1996,7 @@ if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS) if (${_PYTHON_PREFIX}_FIND_VERSION_RANGE) list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS IN_RANGE) elseif (DEFINED ${_PYTHON_PREFIX}_FIND_VERSION) - list (APPEND VERSION ${${_PYTHON_PREFIX}_FIND_VERSION}) + list (APPEND _${_PYTHON_PREFIX}_VALIDATE_OPTIONS VERSION ${${_PYTHON_PREFIX}_FIND_VERSION}) endif() while (TRUE) -- cgit v0.12 From af074c266e103e7b868db7a6664f056102bf4715 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Feb 2021 07:29:03 -0500 Subject: Intel: Make explicit Fortran preprocessing under Ninja more robust Tell the Fortran compiler to write preprocessor output directly to a file, as we do for the GNU compiler. The previous "redirect stdout" approach could break during ABI detection with some `mpif90` wrappers that add version information to stdout when called with `-v`. Fixes: #21828 --- Modules/Compiler/Intel-Fortran.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Modules/Compiler/Intel-Fortran.cmake b/Modules/Compiler/Intel-Fortran.cmake index 71f25f4..9fb6d46 100644 --- a/Modules/Compiler/Intel-Fortran.cmake +++ b/Modules/Compiler/Intel-Fortran.cmake @@ -13,7 +13,15 @@ set(CMAKE_Fortran_COMPILE_WITH_DEFINES 1) set(CMAKE_Fortran_CREATE_PREPROCESSED_SOURCE " -E > ") set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE " -S -o ") -set(CMAKE_Fortran_PREPROCESS_SOURCE - " -fpp -E > ") +if(CMAKE_HOST_WIN32) + # MSVC-like + set(CMAKE_Fortran_PREPROCESS_SOURCE + " -fpp -P -Fi") +else() + # GNU-like + set(CMAKE_Fortran_PREPROCESS_SOURCE + " -fpp -P -o ") +endif() + set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp") set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp") -- cgit v0.12 From d33c2c93d8d006f1270c800d5f6a0b3c493e4404 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 23 Feb 2021 10:46:11 -0500 Subject: Tests: Update for upstream ninja change to write status on stderr Upstream ninja commit `ad3d29fb53` (Put builder output through status interface) from ninja PR 1899 changed the status output from stdout to stderr. In particular, `ninja: no work to do` is now printed on stderr. Update our RunCMake tests to accept this difference. A few RunCMake test cases check for `ninja: no work to do`. For those, move the message to stdout using `RunCMake_TEST_OUTPUT_MERGE`. The rest of the test cases do not care about the message, so remove it from the actual stderr content before comparing against that expected. --- Tests/RunCMake/Ninja/RunCMakeTest.cmake | 2 ++ Tests/RunCMake/RunCMake.cmake | 6 ++++++ Tests/RunCMake/try_compile/RunCMakeTest.cmake | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index e6f86a1..35be2ec 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -34,6 +34,7 @@ function(run_NoWorkToDo) run_cmake(NoWorkToDo) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/NoWorkToDo-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(NoWorkToDo-build ${CMAKE_COMMAND} --build .) run_cmake_command(NoWorkToDo-nowork ${CMAKE_COMMAND} --build . -- -d explain) endfunction() @@ -43,6 +44,7 @@ function(run_VerboseBuild) run_cmake(VerboseBuild) set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VerboseBuild-build) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(VerboseBuild-build ${CMAKE_COMMAND} --build . -v --clean-first) run_cmake_command(VerboseBuild-nowork ${CMAKE_COMMAND} --build . --verbose) endfunction() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index e8fbd6a..a26f632 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -139,6 +139,12 @@ function(run_cmake test) if(NOT "${actual_result}" MATCHES "${expect_result}") string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n") endif() + + # Special case: remove ninja no-op line from stderr, but not stdout. + # Test cases that look for it should use RunCMake_TEST_OUTPUT_MERGE. + string(REGEX REPLACE "(^|\r?\n)ninja: no work to do\\.\r?\n" "\\1" actual_stderr "${actual_stderr}") + + # Remove incidental content from both stdout and stderr. string(CONCAT ignore_line_regex "(^|\n)((==[0-9]+==" "|BullseyeCoverage" diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 5b849bf..fffb038 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -93,7 +93,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") message(STATUS "RerunCMake: first configuration...") run_cmake(RerunCMake) if(NOT CMake_TEST_FILESYSTEM_1S) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + unset(RunCMake_TEST_OUTPUT_MERGE) endif() execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution @@ -101,7 +103,9 @@ if(RunCMake_GENERATOR MATCHES "Make|Ninja") file(WRITE "${in_tc}" "does-not-compile\n") run_cmake_command(RerunCMake-rerun${ninja} ${CMAKE_COMMAND} --build .) if(NOT CMake_TEST_FILESYSTEM_1S) + set(RunCMake_TEST_OUTPUT_MERGE 1) run_cmake_command(RerunCMake-nowork${ninja} ${CMAKE_COMMAND} --build .) + unset(RunCMake_TEST_OUTPUT_MERGE) endif() unset(RunCMake_TEST_BINARY_DIR) -- cgit v0.12 From 431dd59b5e30000c3e3860af69c0dd387634205b Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Tue, 23 Feb 2021 15:38:10 -0500 Subject: CMakePresets.json: Remove undocumented support for comments Fixes: #21858 --- Help/release/3.19.rst | 9 ++++++++- Source/cmCMakePresetsFile.cxx | 1 + Tests/RunCMake/CMakePresets/CMakePresets.json.in | 4 ---- Tests/RunCMake/CMakePresets/Comment-result.txt | 1 + Tests/RunCMake/CMakePresets/Comment-stderr.txt | 2 ++ Tests/RunCMake/CMakePresets/Comment.json.in | 11 +++++++++++ Tests/RunCMake/CMakePresets/RunCMakeTest.cmake | 1 + Tests/RunCMake/CMakePresets/validate_schema.py | 3 +-- 8 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 Tests/RunCMake/CMakePresets/Comment-result.txt create mode 100644 Tests/RunCMake/CMakePresets/Comment-stderr.txt create mode 100644 Tests/RunCMake/CMakePresets/Comment.json.in diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index d8f4f9d..1d55f1e 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -409,7 +409,6 @@ Changes made since CMake 3.19.0 include the following. :generator:`Visual Studio 14 2015` generator. It has now been fixed to work with :ref:`Visual Studio Generators` for later VS versions too. - 3.19.5 ------ @@ -425,3 +424,11 @@ Changes made since CMake 3.19.0 include the following. *Link Binaries With Libraries* build phase broke the ability to switch between device and simulator builds without reconfiguring. That capability has now been restored. + +3.19.6 +------ + +* The :manual:`cmake-presets(7)` feature no longer allows comments in + ``CMakePresets.json`` or ``CMakeUserPresets.json`` files. + This was mistakenly allowed by the implementation in CMake 3.19.0 through + CMake 3.19.5, and was not documented. diff --git a/Source/cmCMakePresetsFile.cxx b/Source/cmCMakePresetsFile.cxx index cf5db6e..872cb4e 100644 --- a/Source/cmCMakePresetsFile.cxx +++ b/Source/cmCMakePresetsFile.cxx @@ -839,6 +839,7 @@ cmCMakePresetsFile::ReadFileResult cmCMakePresetsFile::ReadJSONFile( Json::Value root; Json::CharReaderBuilder builder; + Json::CharReaderBuilder::strictMode(&builder.settings_); if (!Json::parseFromStream(builder, fin, &root, nullptr)) { return ReadFileResult::JSON_PARSE_ERROR; } diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in index 54e4140..e65c1a9 100644 --- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in +++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in @@ -1,8 +1,4 @@ -/* - * Block comment - */ { - // Inline comment "version": 1, "cmakeMinimumRequired": { "major": 3, diff --git a/Tests/RunCMake/CMakePresets/Comment-result.txt b/Tests/RunCMake/CMakePresets/Comment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/Comment-stderr.txt b/Tests/RunCMake/CMakePresets/Comment-stderr.txt new file mode 100644 index 0000000..2f404bc --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/Comment: JSON parse error$ diff --git a/Tests/RunCMake/CMakePresets/Comment.json.in b/Tests/RunCMake/CMakePresets/Comment.json.in new file mode 100644 index 0000000..0f7120c --- /dev/null +++ b/Tests/RunCMake/CMakePresets/Comment.json.in @@ -0,0 +1,11 @@ +// Comment +{ + "version": 1, + "configurePresets": [ + { + "name": "Comment", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 1ffda3d..1f399fe 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -77,6 +77,7 @@ endfunction() # Test CMakePresets.json errors set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_presets(NoCMakePresets) +run_cmake_presets(Comment) run_cmake_presets(JSONParseError) run_cmake_presets(InvalidRoot) run_cmake_presets(NoVersion) diff --git a/Tests/RunCMake/CMakePresets/validate_schema.py b/Tests/RunCMake/CMakePresets/validate_schema.py index c9f84ee..b2a67fc 100644 --- a/Tests/RunCMake/CMakePresets/validate_schema.py +++ b/Tests/RunCMake/CMakePresets/validate_schema.py @@ -1,4 +1,3 @@ -import jsmin import json import jsonschema import os.path @@ -6,7 +5,7 @@ import sys with open(sys.argv[1], "rb") as f: - contents = json.loads(jsmin.jsmin(f.read().decode("utf-8-sig"))) + contents = json.loads(f.read().decode("utf-8-sig")) schema_file = os.path.join( os.path.dirname(__file__), -- cgit v0.12 From 0ecd9de6ddcaf951968d053ae491949d68d6175f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Feb 2021 10:08:43 -0500 Subject: CMake 3.19.6 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4ce01e6..0a47531 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 5) +set(CMake_VERSION_PATCH 6) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From 23b101de601491342f1b918ee29114d7f66d2ad9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 8 Mar 2021 12:26:19 -0500 Subject: Revert "Cray: Fix Cray compiler detection on new platforms" The justification in commit 9ee4a42813 (Cray: Fix Cray compiler detection on new platforms, 2020-12-01, v3.19.2~26^2) confuses detection of the CrayPrgEnv with identification of the Cray compiler. The change regressed detection of the CrayPrgEnv on non-Cray compilers. Revert it pending further investigation into the original problem. Fixes: #21894 --- Modules/CMakeCCompilerId.c.in | 4 ++-- Modules/CMakeCXXCompilerId.cpp.in | 4 ++-- Modules/CMakeFortranCompilerId.F.in | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 8ba6abc..2f6bdb4 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,7 +26,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(_CRAYC) || defined(__cray__) +#if defined(__CRAYXE) || defined(__CRAYXC) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(_CRAYC) || defined(__cray__) +#if defined(__CRAYXE) || defined(__CRAYXC) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 672fff8..a743ce7 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,7 +20,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(_CRAYC) || defined(__cray__) +#if defined(__CRAYXE) || defined(__CRAYXC) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(_CRAYC) || defined(__cray__) +#if defined(__CRAYXE) || defined(__CRAYXC) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 7e8828b..30f8d4c 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -108,7 +108,7 @@ #else PRINT *, 'INFO:compiler[]' #endif -#if defined(_CRAYFTN) +#if defined(__CRAYXE) || defined(__CRAYXC) PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' #endif -- cgit v0.12 From 4f9a71974e0d6e34c81fd8f55fce4118157e5559 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 10 Mar 2021 09:37:00 -0500 Subject: Xcode: Restore support for spaces in framework names In commit ce2dee9e5b (Xcode: Don't add framework as -framework argument in linker info list, 2020-09-28, v3.19.0-rc1~47^2) we split up the path to a framework into the directory and framework name parts, but only retained the quoting on the directory part. Restore quoting of the framework name. Fixes: #21910 --- Source/cmGlobalXCodeGenerator.cxx | 2 +- Tests/Framework/CMakeLists.txt | 10 ++++++++++ Tests/Framework/space.c | 7 +++++++ Tests/Framework/use_space.c | 8 ++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Tests/Framework/space.c create mode 100644 Tests/Framework/use_space.c diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 51a7915..5b44851 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -3647,7 +3647,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) // implicit search path, so we need it libPaths.Add("-F " + this->XCodeEscapePath(fwDir)); } - libPaths.Add("-framework " + fwName); + libPaths.Add("-framework " + this->XCodeEscapePath(fwName)); } else { libPaths.Add(this->XCodeEscapePath(cleanPath)); } diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index f741ec2..aabf6b4 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -83,6 +83,16 @@ if(NOT XCODE OR NOT XCODE_VERSION VERSION_LESS 5) target_link_libraries(barStatic fooStatic) endif() +if(XCODE) + add_library(space SHARED space.c) + set_target_properties(space PROPERTIES + FRAMEWORK TRUE + OUTPUT_NAME "space space" + ) + add_executable(use_space use_space.c) + target_link_libraries(use_space PRIVATE space) +endif() + include(CPack) if(APPLE) diff --git a/Tests/Framework/space.c b/Tests/Framework/space.c new file mode 100644 index 0000000..bf5b0c3 --- /dev/null +++ b/Tests/Framework/space.c @@ -0,0 +1,7 @@ +#ifdef _WIN32 +__declspec(dllexport) +#endif + int space(void) +{ + return 0; +} diff --git a/Tests/Framework/use_space.c b/Tests/Framework/use_space.c new file mode 100644 index 0000000..bb4893d --- /dev/null +++ b/Tests/Framework/use_space.c @@ -0,0 +1,8 @@ +#ifdef _WIN32 +__declspec(dllimport) +#endif + int space(void); +int main(void) +{ + return space(); +} -- cgit v0.12 From 13144e82cdb29490ac34251b7c48a0260d4d54cf Mon Sep 17 00:00:00 2001 From: Justin LaPolla Date: Tue, 1 Dec 2020 10:42:06 -0600 Subject: Cray: Enable Cray compiler wrapper detection on all platforms Previously were checking for the `__CRAYXC` and `__CRAYXE` predefined macros. These macros reflect the platform that the compiler wrapper is running on, i.e. Cray XC and Cray XE machines. They are not defined on other platforms such as Apollo80. Switch to the `__CRAYXT_COMPUTE_LINUX_TARGET` macro. The Cray cc/CC/ftn wrappers always define this macro on the command line. This macro has been in use for many years, and is believed to be a reliable way to detect current and older Cray compiler wrappers. Fixes: #21904 --- Modules/CMakeCCompilerId.c.in | 4 ++-- Modules/CMakeCXXCompilerId.cpp.in | 4 ++-- Modules/CMakeFortranCompilerId.F.in | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 2f6bdb4..14e1282 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -26,7 +26,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -77,7 +77,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index a743ce7..d55d8b1 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -20,7 +20,7 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; char const* qnxnto = "INFO" ":" "qnxnto[]"; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; #endif @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) #ifdef SIMULATE_VERSION_MAJOR require += info_simulate_version[argc]; #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) require += info_cray[argc]; #endif require += info_language_dialect_default[argc]; diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 30f8d4c..6b51e38 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -108,7 +108,7 @@ #else PRINT *, 'INFO:compiler[]' #endif -#if defined(__CRAYXE) || defined(__CRAYXC) +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' #endif -- cgit v0.12 From 09f59da7f09ef864c592cb7e3ffd26373ae2f705 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Mar 2021 06:33:51 -0500 Subject: cmGlobalVisualStudioVersionedGenerator: Clarify local variable name --- Source/cmGlobalVisualStudio10Generator.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7794df3..7011333 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -302,16 +302,16 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( // If a specific minor version of the toolset was requested, verify that it // is compatible to the major version and that is exists on disk. // If not clear the value. - std::string version = this->GeneratorToolsetVersion; + std::string versionToolset = this->GeneratorToolsetVersion; cmsys::RegularExpression regex("[0-9][0-9]\\.[0-9][0-9]"); - if (regex.find(version)) { - version = "v" + version.erase(2, 1); + if (regex.find(versionToolset)) { + versionToolset = "v" + versionToolset.erase(2, 1); } else { // Version not recognized. Clear it. - version.clear(); + versionToolset.clear(); } - if (!cmHasPrefix(version, this->GetPlatformToolsetString())) { + if (!cmHasPrefix(versionToolset, this->GetPlatformToolsetString())) { std::ostringstream e; /* clang-format off */ e << -- cgit v0.12 From 58a50a3a0aa814c0fb00720cb8fc9edb2cf72344 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 11 Mar 2021 16:59:20 -0500 Subject: VS: Fix '-T version=14.28' under VS 16.9 CMake accepts the toolset version that is default in the current VS version by matching the name later VS versions will use for the SxS props files. It predicts the future name based on the first two components of the current VS version's default toolset. However, this heuristic breaks naming the VS 16.8 toolset version 14.28 under VS 16.9 because the latter's default toolset version is 14.28.29910, which did not increment the second version component (unprecedented in VS). Fix this by always using the requested version's SxS props file when it exists, even if it matches the first two components of the current VS version's default toolset. Also add a special case for the name VS 16.10 will use for VS 16.9's default toolset, so that it can be used with VS 16.9 too. Fixes: #21922 --- .../variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst | 8 ++ Source/cmGlobalVisualStudio10Generator.cxx | 63 +++++++-------- Source/cmGlobalVisualStudio10Generator.h | 22 ++++-- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 90 ++++++++++++---------- Source/cmGlobalVisualStudioVersionedGenerator.h | 4 +- Source/cmVisualStudio10TargetGenerator.cxx | 12 +-- 6 files changed, 108 insertions(+), 91 deletions(-) diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst index 64f2e39..b058278 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst @@ -11,3 +11,11 @@ may be specified by a field in :variable:`CMAKE_GENERATOR_TOOLSET` of the form ``version=14.11``. If none is specified CMake will choose a default toolset. The value may be empty if no minor version was selected and the default is used. + +If the value is not empty, it is the version number that MSBuild uses in +its ``Microsoft.VCToolsVersion.*.props`` file names. + +.. versionadded:: 3.19.7 + + VS 16.9's toolset may also be specified as ``14.28.16.9`` because + VS 16.10 uses the file name ``Microsoft.VCToolsVersion.14.28.16.9.props``. diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7011333..badce2e 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -3,6 +3,7 @@ #include "cmGlobalVisualStudio10Generator.h" #include +#include #include @@ -329,15 +330,20 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( this->GeneratorToolsetVersion.clear(); } - 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::string auxProps; + switch (this->FindAuxToolset(this->GeneratorToolsetVersion, auxProps)) { + case AuxToolset::None: + this->GeneratorToolsetVersionProps = {}; + break; + case AuxToolset::Default: + // The given version is the default toolset. Remove the setting. + this->GeneratorToolsetVersion.clear(); + this->GeneratorToolsetVersionProps = {}; + break; + case AuxToolset::PropsExist: + this->GeneratorToolsetVersionProps = std::move(auxProps); + break; + case AuxToolset::PropsMissing: { std::ostringstream e; /* clang-format off */ e << @@ -347,22 +353,24 @@ bool cmGlobalVisualStudio10Generator::SetGeneratorToolset( " " << this->GetPlatformToolsetString() << ",version=" << this->GeneratorToolsetVersion << "\n" "does not seem to be installed at\n" << - " " << toolsetPath; + " " << auxProps; ; /* clang-format on */ mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); // Clear the configured tool-set this->GeneratorToolsetVersion.clear(); - } + this->GeneratorToolsetVersionProps = {}; + } break; } } if (const char* toolset = this->GetPlatformToolset()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset); } - if (const char* version = this->GetPlatformToolsetVersion()) { - mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VERSION", version); + if (!this->GeneratorToolsetVersion.empty()) { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_VERSION", + this->GeneratorToolsetVersion); } if (const char* hostArch = this->GetPlatformToolsetHostArchitecture()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE", hostArch); @@ -719,23 +727,10 @@ std::string const& cmGlobalVisualStudio10Generator::GetPlatformToolsetString() return empty; } -const char* cmGlobalVisualStudio10Generator::GetPlatformToolsetVersion() const -{ - std::string const& version = this->GetPlatformToolsetVersionString(); - if (version.empty()) { - return nullptr; - } - return version.c_str(); -} - std::string const& -cmGlobalVisualStudio10Generator::GetPlatformToolsetVersionString() const +cmGlobalVisualStudio10Generator::GetPlatformToolsetVersionProps() const { - if (!this->GeneratorToolsetVersion.empty()) { - return this->GeneratorToolsetVersion; - } - static std::string const empty; - return empty; + return this->GeneratorToolsetVersionProps; } const char* @@ -792,15 +787,11 @@ cmGlobalVisualStudio10Generator::GetPlatformToolsetCudaCustomDirString() const return this->GeneratorToolsetCudaCustomDir; } -bool cmGlobalVisualStudio10Generator::IsDefaultToolset( - const std::string&) const -{ - return true; -} - -std::string cmGlobalVisualStudio10Generator::GetAuxiliaryToolset() const +cmGlobalVisualStudio10Generator::AuxToolset +cmGlobalVisualStudio10Generator::FindAuxToolset(std::string&, + std::string&) const { - return {}; + return AuxToolset::None; } bool cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 65ea33f..8d30ef8 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -61,9 +61,8 @@ public: const char* GetPlatformToolset() const; std::string const& GetPlatformToolsetString() const; - /** The toolset version. */ - const char* GetPlatformToolsetVersion() const; - std::string const& GetPlatformToolsetVersionString() const; + /** The toolset version props file, if any. */ + std::string const& GetPlatformToolsetVersionProps() const; /** The toolset host architecture name (e.g. x64 for 64-bit host tools). */ const char* GetPlatformToolsetHostArchitecture() const; @@ -120,9 +119,6 @@ public: std::string Encoding() override; const char* GetToolsVersion() const; - virtual bool IsDefaultToolset(const std::string& version) const; - virtual std::string GetAuxiliaryToolset() const; - bool GetSupportsUnityBuilds() const { return this->SupportsUnityBuilds; } bool FindMakeProgram(cmMakefile* mf) override; @@ -168,6 +164,16 @@ protected: virtual bool SelectWindowsPhoneToolset(std::string& toolset) const; virtual bool SelectWindowsStoreToolset(std::string& toolset) const; + enum class AuxToolset + { + None, + Default, + PropsExist, + PropsMissing + }; + virtual AuxToolset FindAuxToolset(std::string& version, + std::string& props) const; + std::string const& GetMSBuildCommand(); cmIDEFlagTable const* LoadFlagTable(std::string const& optionsName, @@ -176,7 +182,7 @@ protected: std::string const& table) const; std::string GeneratorToolset; - std::string GeneratorToolsetVersion; + std::string GeneratorToolsetVersionProps; std::string GeneratorToolsetHostArchitecture; std::string GeneratorToolsetCustomVCTargetsDir; std::string GeneratorToolsetCuda; @@ -230,6 +236,8 @@ private: std::string FindDevEnvCommand() override; std::string GetVSMakeProgram() override { return this->GetMSBuildCommand(); } + std::string GeneratorToolsetVersion; + bool PlatformToolsetNeedsDebugEnum; bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf); diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 84f870e..4e2464b 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalVisualStudioVersionedGenerator.h" +#include + #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmLocalVisualStudio10Generator.h" @@ -391,27 +393,6 @@ bool cmGlobalVisualStudioVersionedGenerator::GetVSInstanceVersion( return vsSetupAPIHelper.GetVSInstanceVersion(vsInstanceVersion); } -bool cmGlobalVisualStudioVersionedGenerator::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; -} - bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const { // Supported from Visual Studio 16.7 Preview 3. @@ -446,29 +427,58 @@ cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision() return ""; } -std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const +cmGlobalVisualStudioVersionedGenerator::AuxToolset +cmGlobalVisualStudioVersionedGenerator::FindAuxToolset( + std::string& version, std::string& props) const { - const char* version = this->GetPlatformToolsetVersion(); - if (version) { - std::string instancePath; - GetVSInstance(instancePath); - std::string toolsetDir = instancePath + "/VC/Auxiliary/Build"; - char sep = '/'; - if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) { - std::string toolsetDot = - cmStrCat(toolsetDir, '.', version, "/Microsoft.VCToolsVersion.", - version, ".props"); - if (cmSystemTools::PathExists(toolsetDot)) { - sep = '.'; + if (version.empty()) { + return AuxToolset::None; + } + + std::string instancePath; + this->GetVSInstance(instancePath); + cmSystemTools::ConvertToUnixSlashes(instancePath); + + if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) { + props = cmStrCat(instancePath, "/VC/Auxiliary/Build."_s, version, + "/Microsoft.VCToolsVersion."_s, version, ".props"_s); + if (cmSystemTools::PathExists(props)) { + return AuxToolset::PropsExist; + } + } + props = cmStrCat(instancePath, "/VC/Auxiliary/Build/"_s, version, + "/Microsoft.VCToolsVersion."_s, version, ".props"_s); + if (cmSystemTools::PathExists(props)) { + return AuxToolset::PropsExist; + } + + // Accept the toolset version that is default in the current VS version + // by matching the name later VS versions will use for the SxS props files. + std::string vcToolsetVersion; + if (this->vsSetupAPIHelper.GetVCToolsetVersion(vcToolsetVersion)) { + // Accept an exact-match (three-component version). + if (version == vcToolsetVersion) { + return AuxToolset::Default; + } + + // Accept known SxS props file names using four version components + // in VS versions later than the current. + if (version == "14.28.16.9" && vcToolsetVersion == "14.28.29910") { + return AuxToolset::Default; + } + + // The first two components of the default toolset version typically + // match the name used by later VS versions for the SxS props files. + cmsys::RegularExpression twoComponent("^([0-9]+\\.[0-9]+)"); + if (twoComponent.find(version)) { + std::string const versionPrefix = cmStrCat(twoComponent.match(1), '.'); + if (cmHasPrefix(vcToolsetVersion, versionPrefix)) { + return AuxToolset::Default; } } - std::string toolsetPath = - cmStrCat(toolsetDir, sep, version, "/Microsoft.VCToolsVersion.", version, - ".props"); - cmSystemTools::ConvertToUnixSlashes(toolsetPath); - return toolsetPath; } - return {}; + + return AuxToolset::PropsMissing; } bool cmGlobalVisualStudioVersionedGenerator::InitializeWindows(cmMakefile* mf) diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.h b/Source/cmGlobalVisualStudioVersionedGenerator.h index 46a5f40..cee129e 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.h +++ b/Source/cmGlobalVisualStudioVersionedGenerator.h @@ -30,8 +30,8 @@ public: bool GetVSInstanceVersion(unsigned long long& vsInstanceVersion) const; - bool IsDefaultToolset(const std::string& version) const override; - std::string GetAuxiliaryToolset() const override; + AuxToolset FindAuxToolset(std::string& version, + std::string& props) const override; bool IsStdOutEncodingSupported() const override; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 4eb3b7f..489e42d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -623,14 +623,14 @@ void cmVisualStudio10TargetGenerator::Generate() } switch (this->ProjectType) { - case vcxproj: - if (this->GlobalGenerator->GetPlatformToolsetVersion()) { - Elem(e0, "Import") - .Attribute("Project", - this->GlobalGenerator->GetAuxiliaryToolset()); + case vcxproj: { + std::string const& props = + this->GlobalGenerator->GetPlatformToolsetVersionProps(); + if (!props.empty()) { + Elem(e0, "Import").Attribute("Project", props); } Elem(e0, "Import").Attribute("Project", VS10_CXX_DEFAULT_PROPS); - break; + } break; case csproj: Elem(e0, "Import") .Attribute("Project", VS10_CSharp_DEFAULT_PROPS) -- cgit v0.12 From 30c835428fffbf91191ebb1150d7fec00803523c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Mar 2021 08:01:54 -0500 Subject: VS: Accept and translate '-T version=' values with three components The VS 16.8 and VS 16.9 toolset versions differ only in their third component. The `vcvarsall` option `-vcvars_ver=` accepts a three component version, so accept this format for VS toolset selection too. Issue: #21922 --- Help/release/3.19.rst | 8 +++++ .../variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst | 12 +++++++ Source/cmGlobalVisualStudioVersionedGenerator.cxx | 37 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index 1d55f1e..49c6793 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -432,3 +432,11 @@ Changes made since CMake 3.19.0 include the following. ``CMakePresets.json`` or ``CMakeUserPresets.json`` files. This was mistakenly allowed by the implementation in CMake 3.19.0 through CMake 3.19.5, and was not documented. + +3.19.7 +------ + +* With :ref:`Visual Studio Generators` for VS 2017 and higher, the + :variable:`CMAKE_GENERATOR_TOOLSET` field ``version=`` now accepts + three-component MSVC toolset versions such as ``14.28.29910``. + See the :variable:`CMAKE_VS_PLATFORM_TOOLSET_VERSION` variable. diff --git a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst index b058278..c4369ee 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst @@ -19,3 +19,15 @@ its ``Microsoft.VCToolsVersion.*.props`` file names. VS 16.9's toolset may also be specified as ``14.28.16.9`` because VS 16.10 uses the file name ``Microsoft.VCToolsVersion.14.28.16.9.props``. + +Three-Component MSVC Toolset Versions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionadded:: 3.19.7 + +The ``version=`` field may be given a three-component toolset version +such as ``14.28.29910``, and CMake will convert it to the name used by +MSBuild ``Microsoft.VCToolsVersion.*.props`` files. This is useful +to distinguish between VS 16.8's ``14.28.29333`` toolset and VS 16.9's +``14.28.29910`` toolset. It also matches ``vcvarsall``'s ``-vcvars_ver=`` +behavior. diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 4e2464b..fb518a2 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -4,6 +4,9 @@ #include +#include "cmsys/FStream.hxx" +#include "cmsys/Glob.hxx" + #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmLocalVisualStudio10Generator.h" @@ -439,6 +442,40 @@ cmGlobalVisualStudioVersionedGenerator::FindAuxToolset( this->GetVSInstance(instancePath); cmSystemTools::ConvertToUnixSlashes(instancePath); + // Translate three-component format accepted by "vcvarsall -vcvars_ver=". + cmsys::RegularExpression threeComponent( + "^([0-9]+\\.[0-9]+)\\.[0-9][0-9][0-9][0-9][0-9]$"); + if (threeComponent.find(version)) { + // Load "VC/Auxiliary/Build/*/Microsoft.VCToolsVersion.*.txt" files + // with two matching components to check their three-component version. + std::string const& twoComponent = threeComponent.match(1); + std::string pattern = + cmStrCat(instancePath, "/VC/Auxiliary/Build/"_s, twoComponent, + "*/Microsoft.VCToolsVersion."_s, twoComponent, "*.txt"_s); + cmsys::Glob glob; + glob.SetRecurseThroughSymlinks(false); + if (glob.FindFiles(pattern)) { + for (std::string const& txt : glob.GetFiles()) { + std::string ver; + cmsys::ifstream fin(txt.c_str()); + if (fin && std::getline(fin, ver)) { + // Strip trailing whitespace. + ver = ver.substr(0, ver.find_first_not_of("0123456789.")); + // If the three-component version matches, translate it to + // that used by the "Microsoft.VCToolsVersion.*.txt" file name. + if (ver == version) { + cmsys::RegularExpression extractVersion( + "VCToolsVersion\\.([0-9.]+)\\.txt$"); + if (extractVersion.find(txt)) { + version = extractVersion.match(1); + break; + } + } + } + } + } + } + if (cmSystemTools::VersionCompareGreaterEq(version, "14.20")) { props = cmStrCat(instancePath, "/VC/Auxiliary/Build."_s, version, "/Microsoft.VCToolsVersion."_s, version, ".props"_s); -- cgit v0.12 From 22612dd53a46c7f9b4c3f4b7dbe5c78f9afd9581 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Mar 2021 09:39:14 -0400 Subject: CMake 3.19.7 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0a47531..827ec9f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 6) +set(CMake_VERSION_PATCH 7) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) -- cgit v0.12 From c7bd2d0d974a2246641c5523ee95beb6e06d6762 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Mar 2021 09:04:56 -0400 Subject: FindPkgConfig: Restore preference for first pkg-config in PATH Since commit ab8bd48352 (FindPkgConfig: Search for pkg-config.bat file on a Windows host, 2020-09-25, v3.19.0-rc1~98^2) we prefer `pkg-config.bat` over `pkg-config` regardless of the order they appear in the `PATH`. Tell `find_program` to consider all names in each directory so that the first one in `PATH` of any name wins. Issue: #21239 --- Modules/FindPkgConfig.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 2ad2c7e..360f439 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -37,7 +37,10 @@ if(CMAKE_HOST_WIN32) list(PREPEND PKG_CONFIG_NAMES "pkg-config.bat") endif() -find_program(PKG_CONFIG_EXECUTABLE NAMES ${PKG_CONFIG_NAMES} DOC "pkg-config executable") +find_program(PKG_CONFIG_EXECUTABLE + NAMES ${PKG_CONFIG_NAMES} + NAMES_PER_DIR + DOC "pkg-config executable") mark_as_advanced(PKG_CONFIG_EXECUTABLE) set(_PKG_CONFIG_FAILURE_MESSAGE "") -- cgit v0.12 From 6fd9c68ed02d6b1dc013a6984f890d2c9457b1c8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Mar 2021 09:34:51 -0400 Subject: Ninja: Do not recompact deps log in regeneration during a build Since commit fb18215904 (Ninja: clean ninja metadata once generated, 2019-05-13, v3.17.0-rc1~207^2) we recompact the ninja deps log during regeneration. That does not make sense during a build, so skip it if we are regenerating during a build. This problem went unnoticed previously because on non-Windows platforms the deps log is just overwritten again by the outer build. On Windows platforms, recompaction during the build fails, but we did not actually try to do that until commit 11f4259362 (Ninja: Clean metadata after regen during build on Windows with 1.10.2+, 2020-11-30, v3.19.2~29^2~1). Fixes: #21916 --- Source/cmGlobalNinjaGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 02ffaf7..e10c76e 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -588,8 +588,9 @@ void cmGlobalNinjaGenerator::CleanMetaData() // `build.ninja` to load for this in Ninja-Multi. This may be relaxed in the // future pending further investigation into how Ninja works upstream // (ninja#1721). - if (this->NinjaSupportsUnconditionalRecompactTool && expectBuildManifest && - !missingBuildManifest) { + if (this->NinjaSupportsUnconditionalRecompactTool && + !this->GetCMakeInstance()->GetRegenerateDuringBuild() && + expectBuildManifest && !missingBuildManifest) { run_ninja_tool({ "recompact" }); } if (this->NinjaSupportsRestatTool && this->OutputPathPrefix.empty()) { -- cgit v0.12 From 9f36461e12fb57ea4a886040005c7d8e525ac9ce Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 15 Mar 2021 10:08:19 -0400 Subject: gitlab-ci: Fix using VS 16.8 toolset under VS 16.9 in CMake 3.19 branch The 16.8 and 16.9 toolset numbers vary only in their third component. Use CMake 3.19.7 for three-component toolset version specification support. --- .gitlab/ci/cmake.ps1 | 4 ++-- .gitlab/os-windows.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1 index e7b4de7..3d6fb81 100755 --- a/.gitlab/ci/cmake.ps1 +++ b/.gitlab/ci/cmake.ps1 @@ -1,7 +1,7 @@ $erroractionpreference = "stop" -$version = "3.19.0" -$sha256sum = "67BBDA67C98C5F0789199FE1DB650F12274A6AD40FD8CAE88D208029AC618905" +$version = "3.19.7" +$sha256sum = "E6788D6E23B3026C37FCFA7658075D6B5F9113F26FAE17FE372AD4A7EE62D5FD" $filename = "cmake-$version-win64-x64" $tarball = "$filename.zip" diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 1fff2bb..14ec309 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -38,7 +38,7 @@ CMAKE_CONFIGURATION: windows_vs2019_x64_ninja VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "x64" - VCVARSVERSION: "14.28" + VCVARSVERSION: "14.28.29333" ### External testing @@ -49,7 +49,7 @@ CMAKE_CONFIGURATION: windows_vs2019_x64 CMAKE_GENERATOR: "Visual Studio 16 2019" CMAKE_GENERATOR_PLATFORM: "x64" - CMAKE_GENERATOR_TOOLSET: "v142,version=14.28" + CMAKE_GENERATOR_TOOLSET: "v142,version=14.28.29333" ## Tags -- cgit v0.12 From 3a042bef8e5a1d5c03f9cad01c603b536b46ba6f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 24 Mar 2021 10:18:30 -0400 Subject: gitlab-ci: Update Windows builds to MSVC 19.28-16.9 toolset --- .gitlab/os-windows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml index 14ec309..e63953e 100644 --- a/.gitlab/os-windows.yml +++ b/.gitlab/os-windows.yml @@ -38,7 +38,7 @@ CMAKE_CONFIGURATION: windows_vs2019_x64_ninja VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat" VCVARSPLATFORM: "x64" - VCVARSVERSION: "14.28.29333" + VCVARSVERSION: "14.28.29910" ### External testing @@ -49,7 +49,7 @@ CMAKE_CONFIGURATION: windows_vs2019_x64 CMAKE_GENERATOR: "Visual Studio 16 2019" CMAKE_GENERATOR_PLATFORM: "x64" - CMAKE_GENERATOR_TOOLSET: "v142,version=14.28.29333" + CMAKE_GENERATOR_TOOLSET: "v142,version=14.28.29910" ## Tags @@ -59,7 +59,7 @@ - windows - shell - vs2019 - - msvc-19.28 + - msvc-19.28-16.9 - nonconcurrent .windows_builder_ext_tags: @@ -68,7 +68,7 @@ - windows - shell - vs2019 - - msvc-19.28 + - msvc-19.28-16.9 - concurrent ## Windows-specific scripts -- cgit v0.12