diff options
author | Brad King <brad.king@kitware.com> | 2021-04-05 17:45:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-05 17:45:08 (GMT) |
commit | f9f59fb0b201987c218579e1310cc62a05df5694 (patch) | |
tree | 95da5b35a4d16a2b25639fa9ceedd717f0f2d7ff | |
parent | 30959aec8f1347ac2098f85824fe6777dae627b5 (diff) | |
parent | 0913499f69463c94cc16ed437721e88148e131a8 (diff) | |
download | CMake-f9f59fb0b201987c218579e1310cc62a05df5694.zip CMake-f9f59fb0b201987c218579e1310cc62a05df5694.tar.gz CMake-f9f59fb0b201987c218579e1310cc62a05df5694.tar.bz2 |
Merge branch 'release-3.19' into backport-3.19-rel-file-table
68 files changed, 591 insertions, 187 deletions
diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1 index 9d7f317..3d6fb81 100755 --- a/.gitlab/ci/cmake.ps1 +++ b/.gitlab/ci/cmake.ps1 @@ -1,12 +1,13 @@ $erroractionpreference = "stop" -$version = "3.19.0" -$sha256sum = "67BBDA67C98C5F0789199FE1DB650F12274A6AD40FD8CAE88D208029AC618905" +$version = "3.19.7" +$sha256sum = "E6788D6E23B3026C37FCFA7658075D6B5F9113F26FAE17FE372AD4A7EE62D5FD" $filename = "cmake-$version-win64-x64" $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 4cc6bcb..4c5333a 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) { 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 2e21fdf..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" + 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" + 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,15 +68,18 @@ - windows - shell - vs2019 - - msvc-19.28 + - msvc-19.28-16.9 - concurrent ## 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 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: ``<prefix>/include/<arch>`` 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: ``<prefix>/lib/<arch>`` 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: ``<prefix>/include/<arch>`` if :variable:`CMAKE_LIBRARY_ARCHITECTURE` is set, and |SYSTEM_ENVIRONMENT_PREFIX_PATH_XXX_SUBDIR|. 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`. diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index 7ad27c8..49c6793 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -400,3 +400,43 @@ 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. + +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. + +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. + +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 64f2e39..c4369ee 100644 --- a/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst +++ b/Help/variable/CMAKE_VS_PLATFORM_TOOLSET_VERSION.rst @@ -11,3 +11,23 @@ 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``. + +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/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/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 8ba6abc..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(_CRAYC) || defined(__cray__) +#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(_CRAYC) || defined(__cray__) +#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 672fff8..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(_CRAYC) || defined(__cray__) +#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(_CRAYC) || defined(__cray__) +#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 7e8828b..6b51e38 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(__CRAYXT_COMPUTE_LINUX_TARGET) PRINT *, 'INFO:compiler_wrapper[CrayPrgEnv]' #endif 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/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/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 "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") set(CMAKE_Fortran_CREATE_ASSEMBLY_SOURCE "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>") -set(CMAKE_Fortran_PREPROCESS_SOURCE - "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>") +if(CMAKE_HOST_WIN32) + # MSVC-like + set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -Fi<PREPROCESSED_SOURCE>") +else() + # GNU-like + set(CMAKE_Fortran_PREPROCESS_SOURCE + "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -P <SOURCE> -o <PREPROCESSED_SOURCE>") +endif() + set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp") set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_OFF "-nofpp") 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" 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. diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 25f5a1f..38388d9 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -360,9 +360,11 @@ 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) + if(return_value AND NOT HDF5_FIND_QUIETLY) message(STATUS "HDF5 ${language} compiler wrapper is unable to compile a minimal HDF5 program.") else() @@ -374,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() @@ -385,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() 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 "") 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) 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 "$<TARGET_FILE:${testee}>") - 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 "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>") + else() + set(_output_directory "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>/PlugIns") + endif() set_target_properties(${target} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "$<TARGET_BUNDLE_CONTENT_DIR:${testee}>/PlugIns") + LIBRARY_OUTPUT_DIRECTORY "${_output_directory}") endif() else(XCODE) target_link_libraries(${target} 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) 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" ) 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 "") 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) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0f9f8e8..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 3) +set(CMake_VERSION_PATCH 7) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) 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); } 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() 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/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/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 201a9d9..b9f15b7 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -474,6 +474,12 @@ std::vector<std::string> const& cmComputeLinkInformation::GetFrameworkPaths() return this->FrameworkPaths; } +std::set<std::string> const& +cmComputeLinkInformation::GetFrameworkPathsEmitted() const +{ + return this->FrameworkPathsEmitted; +} + const std::set<const cmGeneratorTarget*>& cmComputeLinkInformation::GetSharedLibrariesLinked() const { @@ -699,9 +705,13 @@ void cmComputeLinkInformation::AddItem(BT<std::string> 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 +1316,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 @@ -1342,8 +1342,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$"); @@ -1351,7 +1351,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 543b6d7..9fec702 100644 --- a/Source/cmComputeLinkInformation.h +++ b/Source/cmComputeLinkInformation.h @@ -55,6 +55,7 @@ public: std::vector<BT<std::string>> GetDirectoriesWithBacktraces(); std::vector<std::string> const& GetDepends() const; std::vector<std::string> const& GetFrameworkPaths() const; + std::set<std::string> const& GetFrameworkPathsEmitted() const; std::string GetLinkLanguage() const { return this->LinkLanguage; } std::vector<std::string> const& GetRuntimeSearchPath() const; std::string const& GetRuntimeFlag() const { return this->RuntimeFlag; } @@ -155,7 +156,6 @@ private: void AddFullItem(BT<std::string> const& item); bool CheckImplicitDirItem(std::string const& item); void AddUserItem(BT<std::string> 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); @@ -165,7 +165,7 @@ private: // Framework info. void ComputeFrameworkInfo(); void AddFrameworkPath(std::string const& p); - std::set<std::string> FrameworkPathsEmmitted; + std::set<std::string> FrameworkPathsEmitted; cmsys::RegularExpression SplitFramework; // Linker search path computation. 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()) { diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7794df3..badce2e 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -3,6 +3,7 @@ #include "cmGlobalVisualStudio10Generator.h" #include <algorithm> +#include <utility> #include <cm/memory> @@ -302,16 +303,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 << @@ -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/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..fb518a2 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -2,6 +2,11 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmGlobalVisualStudioVersionedGenerator.h" +#include <cmext/string_view> + +#include "cmsys/FStream.hxx" +#include "cmsys/Glob.hxx" + #include "cmAlgorithms.h" #include "cmDocumentationEntry.h" #include "cmLocalVisualStudio10Generator.h" @@ -391,27 +396,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 +430,92 @@ 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); + + // 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); + 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) @@ -540,7 +587,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..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; @@ -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; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index df45b35..5b44851 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<std::string> 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,8 +3642,12 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) const auto fwName = cmSystemTools::GetFilenameWithoutExtension(libPath); const auto fwDir = cmSystemTools::GetParentDirectory(libPath); - libPaths.Add("-F " + this->XCodeEscapePath(fwDir)); - libPaths.Add("-framework " + fwName); + 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 " + this->XCodeEscapePath(fwName)); } else { libPaths.Add(this->XCodeEscapePath(cleanPath)); } 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<std::string> 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<cmSourceFile const*, std::string>& mapping, cmGeneratorTarget const* gt = nullptr) override; diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index 0203779..64c1645 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -6,7 +6,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 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) diff --git a/Tests/Framework/CMakeLists.txt b/Tests/Framework/CMakeLists.txt index a313c2c..aabf6b4 100644 --- a/Tests/Framework/CMakeLists.txt +++ b/Tests/Framework/CMakeLists.txt @@ -83,4 +83,30 @@ 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) + 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=<INSTALL_DIR> + ) + + 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/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/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(); +} 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(); +} 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__), 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 edf42d7..1a69059 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/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) 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/$<TARGET_FILE_NAME:testlib_conflict>" BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>" ) + + exec_get_runtime_dependencies( + deps7.txt udeps7.txt cdeps7.txt + EXECUTABLES + "${CMAKE_INSTALL_PREFIX}/executable/bin/$<TARGET_FILE_NAME:topexe_weak>" + LIBRARIES + "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>" + ) ]]) 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) |