summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly/DontResolveDeviceSymbols
stat options
Period:
Authors:

Commits per author per week (path 'Tests/CudaOnly/DontResolveDeviceSymbols')

AuthorW33 2025W34 2025W35 2025W36 2025Total
Total00000
2'>stat only
Diffstat
-rw-r--r--.clang-tidy10
-rw-r--r--.gitlab-ci.yml298
-rw-r--r--.gitlab/.gitignore5
-rw-r--r--[-rwxr-xr-x].gitlab/ci/borland-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/borland.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/clang-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/clang.ps10
-rw-r--r--.gitlab/ci/cmake-env.ps15
-rw-r--r--.gitlab/ci/cmake-env.sh3
-rw-r--r--[-rwxr-xr-x].gitlab/ci/cmake.ps10
-rw-r--r--.gitlab/ci/configure_cuda12.2_clang.cmake4
-rw-r--r--.gitlab/ci/configure_cuda12.2_nvidia.cmake5
-rw-r--r--.gitlab/ci/configure_debian12_aarch64_ninja.cmake7
-rw-r--r--.gitlab/ci/configure_debian12_makefiles_clang.cmake3
-rw-r--r--.gitlab/ci/configure_debian12_ninja.cmake2
-rw-r--r--.gitlab/ci/configure_debian12_ninja_common.cmake10
-rw-r--r--.gitlab/ci/configure_fedora39_clang_analyzer.cmake3
-rw-r--r--.gitlab/ci/configure_fedora39_common_clang.cmake5
-rw-r--r--.gitlab/ci/configure_fedora40_asan.cmake (renamed from .gitlab/ci/configure_fedora39_asan.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora40_clang_analyzer.cmake3
-rw-r--r--.gitlab/ci/configure_fedora40_common.cmake (renamed from .gitlab/ci/configure_fedora39_common.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora40_common_clang.cmake17
-rw-r--r--.gitlab/ci/configure_fedora40_extdeps.cmake (renamed from .gitlab/ci/configure_fedora39_extdeps.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora40_makefiles.cmake (renamed from .gitlab/ci/configure_fedora39_makefiles.cmake)12
-rw-r--r--.gitlab/ci/configure_fedora40_makefiles_clang.cmake (renamed from .gitlab/ci/configure_fedora39_makefiles_clang.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora40_makefiles_symlinked.cmake (renamed from .gitlab/ci/configure_fedora39_makefiles_symlinked.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora40_ninja.cmake (renamed from .gitlab/ci/configure_fedora39_ninja.cmake)4
-rw-r--r--.gitlab/ci/configure_fedora40_ninja_clang.cmake (renamed from .gitlab/ci/configure_fedora39_ninja_multi_clang.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora40_ninja_multi.cmake (renamed from .gitlab/ci/configure_fedora39_ninja_multi.cmake)1
-rw-r--r--.gitlab/ci/configure_fedora40_ninja_multi_clang.cmake (renamed from .gitlab/ci/configure_fedora39_ninja_clang.cmake)2
-rw-r--r--.gitlab/ci/configure_fedora40_sphinx.cmake (renamed from .gitlab/ci/configure_fedora39_sphinx.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora40_sphinx_package.cmake (renamed from .gitlab/ci/configure_fedora39_sphinx_package.cmake)0
-rw-r--r--.gitlab/ci/configure_fedora40_tidy.cmake (renamed from .gitlab/ci/configure_fedora39_tidy.cmake)2
-rw-r--r--.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake3
-rw-r--r--.gitlab/ci/configure_linux_gcc_cxx_modules_ninja_multi.cmake3
-rw-r--r--.gitlab/ci/configure_macos_arm64_ninja.cmake5
-rw-r--r--.gitlab/ci/configure_macos_x86_64_makefiles.cmake1
-rw-r--r--.gitlab/ci/configure_macos_x86_64_ninja.cmake4
-rw-r--r--.gitlab/ci/configure_windows_arm64_vs2022_ninja.cmake5
-rw-r--r--.gitlab/ci/configure_windows_clang_common.cmake9
-rw-r--r--.gitlab/ci/configure_windows_i386_package.cmake3
-rw-r--r--.gitlab/ci/configure_windows_msvc_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_msvc_cxx_modules_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_package_common.cmake2
-rw-r--r--.gitlab/ci/configure_windows_vs2019_x64.cmake1
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64.cmake4
-rw-r--r--.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake7
-rw-r--r--.gitlab/ci/configure_windows_wix_common.cmake5
-rw-r--r--.gitlab/ci/configure_windows_x86_64_package.cmake3
-rw-r--r--.gitlab/ci/ctest_exclusions.cmake7
-rw-r--r--.gitlab/ci/ctest_memcheck_fedora40_asan.lsan.supp (renamed from .gitlab/ci/ctest_memcheck_fedora39_asan.lsan.supp)0
-rw-r--r--.gitlab/ci/docker/cuda12.2/Dockerfile9
-rwxr-xr-x.gitlab/ci/docker/cuda12.2/install_deps.sh20
-rw-r--r--.gitlab/ci/docker/cuda12.2/llvm-snapshot.gpg.key52
-rw-r--r--.gitlab/ci/docker/cuda12.2/llvm.list2
-rw-r--r--.gitlab/ci/docker/debian12-x86_64/deps_packages.lst3
-rw-r--r--.gitlab/ci/docker/fedora39-hip/Dockerfile27
-rw-r--r--.gitlab/ci/docker/fedora39-hip/deps_packages.lst15
-rwxr-xr-x.gitlab/ci/docker/fedora39-hip/install_deps.sh10
-rw-r--r--.gitlab/ci/docker/fedora40/Dockerfile (renamed from .gitlab/ci/docker/fedora39/Dockerfile)2
-rw-r--r--.gitlab/ci/docker/fedora40/deps_packages.lst (renamed from .gitlab/ci/docker/fedora39/deps_packages.lst)15
-rwxr-xr-x.gitlab/ci/docker/fedora40/install_deps.sh (renamed from .gitlab/ci/docker/fedora39/install_deps.sh)0
-rwxr-xr-x.gitlab/ci/docker/fedora40/install_iwyu.sh (renamed from .gitlab/ci/docker/fedora39/install_iwyu.sh)10
-rwxr-xr-x.gitlab/ci/docker/fedora40/install_rvm.sh (renamed from .gitlab/ci/docker/fedora39/install_rvm.sh)0
-rw-r--r--.gitlab/ci/docker/fedora40/iwyu_packages.lst (renamed from .gitlab/ci/docker/fedora39/iwyu_packages.lst)0
-rw-r--r--.gitlab/ci/docker/fedora40/rvm_packages.lst (renamed from .gitlab/ci/docker/fedora39/rvm_packages.lst)0
-rw-r--r--.gitlab/ci/docker/gcc_cxx_modules/Dockerfile9
-rwxr-xr-x.gitlab/ci/docker/gcc_cxx_modules/install_deps.sh7
-rwxr-xr-x.gitlab/ci/docker/gcc_cxx_modules/install_gcc.sh25
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env.ps18
-rw-r--r--.gitlab/ci/env_cuda12.2_clang.sh3
-rw-r--r--.gitlab/ci/env_fedora39_common_clang.sh3
-rw-r--r--.gitlab/ci/env_fedora39_makefiles_clang.sh1
-rw-r--r--.gitlab/ci/env_fedora39_makefiles_symlinked.cmake1
-rw-r--r--.gitlab/ci/env_fedora39_makefiles_symlinked.sh1
-rw-r--r--.gitlab/ci/env_fedora39_ninja_clang.sh1
-rw-r--r--.gitlab/ci/env_fedora39_ninja_multi_clang.sh1
-rw-r--r--.gitlab/ci/env_fedora40_asan.sh (renamed from .gitlab/ci/env_fedora39_asan.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_clang_analyzer.sh (renamed from .gitlab/ci/env_fedora39_clang_analyzer.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_common_clang.sh3
-rw-r--r--.gitlab/ci/env_fedora40_extdeps.sh (renamed from .gitlab/ci/env_fedora39_extdeps.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_makefiles.cmake (renamed from .gitlab/ci/env_fedora39_makefiles.cmake)0
-rw-r--r--.gitlab/ci/env_fedora40_makefiles.sh (renamed from .gitlab/ci/env_fedora39_makefiles.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_makefiles_clang.sh1
-rw-r--r--.gitlab/ci/env_fedora40_makefiles_symlinked.cmake1
-rw-r--r--.gitlab/ci/env_fedora40_makefiles_symlinked.sh1
-rw-r--r--.gitlab/ci/env_fedora40_ninja.sh (renamed from .gitlab/ci/env_fedora39_ninja_multi.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_ninja_clang.sh1
-rw-r--r--.gitlab/ci/env_fedora40_ninja_multi.sh (renamed from .gitlab/ci/env_fedora39_ninja.sh)0
-rw-r--r--.gitlab/ci/env_fedora40_ninja_multi_clang.sh1
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_mingw_osdn_io_mingw_makefiles.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_mingw_osdn_io_msys_makefiles.ps10
-rw-r--r--.gitlab/ci/env_windows_arm64_package.ps11
-rw-r--r--.gitlab/ci/env_windows_arm64_vs2022_ninja.ps12
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_borland5.5.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_borland5.8.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_clang_ninja.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_clang_nmake.ps10
-rw-r--r--.gitlab/ci/env_windows_i386_package.ps11
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_intelclassic_ninja.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_inteloneapi_ninja.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_msvc_v71_nmake.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_openwatcom1.9.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_orangec6.73.1.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_vs2022_x64.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_vs2022_x64_jom.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_vs2022_x64_ninja.ps14
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/env_windows_vs2022_x64_nmake.ps10
-rw-r--r--.gitlab/ci/env_windows_x86_64_package.ps11
-rw-r--r--[-rwxr-xr-x].gitlab/ci/innosetup-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/innosetup.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/intel-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/intel-vars.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/intel.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/ispc-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/ispc.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/jom.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/mingw-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/mingw.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/msvc.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/ninja-env.ps10
-rw-r--r--.gitlab/ci/ninja-env.sh3
-rw-r--r--[-rwxr-xr-x].gitlab/ci/ninja-nightly.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/ninja.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/openwatcom-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/openwatcom.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/orangec-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/orangec.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/package_windows.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/post_build.ps10
-rw-r--r--.gitlab/ci/post_build_fedora40_tidy.sh (renamed from .gitlab/ci/post_build_fedora39_tidy.sh)0
-rw-r--r--[-rwxr-xr-x].gitlab/ci/post_build_windows_arm64_package.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/post_build_windows_i386_package.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/post_build_windows_x86_64_package.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/pre_build.ps10
-rw-r--r--.gitlab/ci/pre_build_fedora40_tidy.sh (renamed from .gitlab/ci/pre_build_fedora39_tidy.sh)0
-rw-r--r--[-rwxr-xr-x].gitlab/ci/python-env.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/python.ps10
-rw-r--r--[-rwxr-xr-x].gitlab/ci/qt-env.ps10
-rw-r--r--.gitlab/ci/repackage/wix.ps155
-rw-r--r--.gitlab/ci/sccache-env.ps11
-rw-r--r--.gitlab/ci/sccache-env.sh2
-rw-r--r--.gitlab/ci/swift-env.ps16
-rw-r--r--.gitlab/ci/swift.ps138
-rw-r--r--[-rwxr-xr-x].gitlab/ci/vcvarsall.ps10
-rw-r--r--.gitlab/ci/wix3-env.ps16
-rw-r--r--[-rwxr-xr-x].gitlab/ci/wix3.ps1 (renamed from .gitlab/ci/wix.ps1)3
-rw-r--r--.gitlab/ci/wix4.ps120
-rw-r--r--.gitlab/os-linux.yml157
-rw-r--r--.gitlab/os-macos.yml8
-rw-r--r--.gitlab/os-windows.yml24
-rw-r--r--.gitlab/rules.yml6
-rw-r--r--.gitlab/upload.yml4
-rw-r--r--Auxiliary/cmake-mode.el5
-rw-r--r--Auxiliary/vim/syntax/cmake.vim1
-rw-r--r--CMakeCPack.cmake9
-rw-r--r--CMakeCPackOptions.cmake.in7
-rw-r--r--CMakeLists.txt2
-rw-r--r--CTestCustom.cmake.in6
-rw-r--r--Help/command/add_custom_command.rst8
-rw-r--r--Help/command/add_custom_target.rst4
-rw-r--r--Help/command/add_dependencies.rst11
-rw-r--r--Help/command/add_library.rst7
-rw-r--r--Help/command/cmake_path.rst2
-rw-r--r--Help/command/enable_language.rst16
-rw-r--r--Help/command/file.rst651
-rw-r--r--Help/command/string.rst15
-rw-r--r--Help/command/target_compile_definitions.rst2
-rw-r--r--Help/command/target_compile_options.rst2
-rw-r--r--Help/command/target_include_directories.rst2
-rw-r--r--Help/command/target_link_directories.rst2
-rw-r--r--Help/command/target_link_libraries.rst2
-rw-r--r--Help/command/target_link_options.rst2
-rw-r--r--Help/command/target_precompile_headers.rst2
-rw-r--r--Help/command/target_sources.rst2
-rw-r--r--Help/cpack_gen/innosetup.rst6
-rw-r--r--Help/cpack_gen/wix.rst156
-rw-r--r--Help/dev/experimental.rst21
-rw-r--r--Help/envvar/CMAKE_TLS_VERIFY.rst15
-rw-r--r--Help/envvar/CMAKE_TLS_VERSION.rst16
-rw-r--r--Help/envvar/OBJCFLAGS.rst14
-rw-r--r--Help/envvar/OBJCXXFLAGS.rst14
-rw-r--r--Help/manual/OPTIONS_BUILD.txt4
-rw-r--r--Help/manual/cmake-buildsystem.7.rst423
-rw-r--r--Help/manual/cmake-cxxmodules.7.rst65
-rw-r--r--Help/manual/cmake-developer.7.rst3
-rw-r--r--Help/manual/cmake-env-variables.7.rst4
-rw-r--r--Help/manual/cmake-file-api.7.rst50
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst120
-rw-r--r--Help/manual/cmake-policies.7.rst18
-rw-r--r--Help/manual/cmake-presets.7.rst7
-rw-r--r--Help/manual/cmake-properties.7.rst3
-rw-r--r--Help/manual/cmake-variables.7.rst7
-rw-r--r--Help/manual/ctest.1.rst33
-rw-r--r--Help/manual/presets/schema.json18
-rw-r--r--Help/policy/CMP0066.rst2
-rw-r--r--Help/policy/CMP0099.rst19
-rw-r--r--Help/policy/CMP0118.rst35
-rw-r--r--Help/policy/CMP0135.rst18
-rw-r--r--Help/policy/CMP0162.rst47
-rw-r--r--Help/policy/CMP0163.rst37
-rw-r--r--Help/policy/CMP0164.rst31
-rw-r--r--Help/policy/CMP0165.rst26
-rw-r--r--Help/policy/CMP0166.rst40
-rw-r--r--Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst2
-rw-r--r--Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst2
-rw-r--r--Help/prop_sf/GENERATED.rst19
-rw-r--r--Help/prop_tgt/AUTOUIC_OPTIONS.rst2
-rw-r--r--Help/prop_tgt/CXX_MODULE_STD.rst41
-rw-r--r--Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst2
-rw-r--r--Help/prop_tgt/LANG_STANDARD.rst2
-rw-r--r--Help/prop_tgt/LANG_STANDARD_REQUIRED.rst2
-rw-r--r--Help/prop_tgt/SOURCES.rst2
-rw-r--r--Help/prop_tgt/VS_FILTER_PROPS.rst10
-rw-r--r--Help/prop_tgt/VS_USE_DEBUG_LIBRARIES-PURPOSE.txt18
-rw-r--r--Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst28
-rw-r--r--Help/release/3.20.rst5
-rw-r--r--Help/release/3.25.rst4
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/CXX_MODULE_STD-property.rst5
-rw-r--r--Help/release/dev/FindBacktrace-imported-library.rst4
-rw-r--r--Help/release/dev/FindCUDAToolkit-nvfatbin.rst5
-rw-r--r--Help/release/dev/FindOpenMP-runtime-msvc.rst5
-rw-r--r--Help/release/dev/add_library-no-static-fallback.rst6
-rw-r--r--Help/release/dev/cpack-innosetup-linux.rst5
-rw-r--r--Help/release/dev/cpack-wix.rst5
-rw-r--r--Help/release/dev/curl-tls-version.rst26
-rw-r--r--Help/release/dev/cxx-26.rst8
-rw-r--r--Help/release/dev/enable_language-before-project.rst6
-rw-r--r--Help/release/dev/fileapi-provide-glob-dependent.rst9
-rw-r--r--Help/release/dev/genex-link-properties.rst8
-rw-r--r--Help/release/dev/genex-quote.rst4
-rw-r--r--Help/release/dev/lang-standard-latest.rst5
-rw-r--r--Help/release/dev/preset-includes-macro-expansion.rst7
-rw-r--r--Help/release/dev/prop-GENERATED-visibility.rst6
-rw-r--r--Help/release/dev/rel-win-PATH.rst8
-rw-r--r--Help/release/dev/rel-zip-newlines.rst6
-rw-r--r--Help/release/dev/vs-UseDebugLibraries.rst10
-rw-r--r--Help/release/dev/vs-filter-props.rst6
-rw-r--r--Help/release/index.rst2
-rw-r--r--Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst14
-rw-r--r--Help/variable/CMAKE_CXX_MODULE_STD.rst15
-rw-r--r--Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst2
-rw-r--r--Help/variable/CMAKE_LANG_FLAGS.rst4
-rw-r--r--Help/variable/CMAKE_LANG_STANDARD_LATEST.rst64
-rw-r--r--Help/variable/CMAKE_TLS_VERIFY.rst4
-rw-r--r--Help/variable/CMAKE_TLS_VERSION-VALUES.txt7
-rw-r--r--Help/variable/CMAKE_TLS_VERSION.rst17
-rw-r--r--Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst29
-rw-r--r--Help/variable/CTEST_CURL_OPTIONS.rst4
-rw-r--r--Help/variable/CTEST_TLS_VERIFY.rst13
-rw-r--r--Help/variable/CTEST_TLS_VERSION.rst16
-rw-r--r--Modules/CMakeASM_NASMInformation.cmake11
-rw-r--r--Modules/CMakeCCompiler.cmake.in1
-rw-r--r--Modules/CMakeCCompilerId.c.in17
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDACompilerId.cu.in28
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in5
-rw-r--r--Modules/CMakeCXXCompilerId.cpp.in69
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake12
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake27
-rw-r--r--Modules/CMakeDetermineCompilerSupport.cmake (renamed from Modules/CMakeDetermineCompileFeatures.cmake)16
-rw-r--r--Modules/CMakeHIPCompiler.cmake.in2
-rw-r--r--Modules/CMakeHIPCompilerId.hip.in21
-rw-r--r--Modules/CMakeOBJCCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCCompilerId.m.in20
-rw-r--r--Modules/CMakeOBJCXXCompiler.cmake.in1
-rw-r--r--Modules/CMakeOBJCXXCompilerId.mm.in23
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake17
-rw-r--r--Modules/CMakeSwiftInformation.cmake6
-rw-r--r--Modules/CMakeTestCCompiler.cmake4
-rw-r--r--Modules/CMakeTestCUDACompiler.cmake4
-rw-r--r--Modules/CMakeTestCXXCompiler.cmake4
-rw-r--r--Modules/CMakeTestHIPCompiler.cmake4
-rw-r--r--Modules/CMakeTestOBJCCompiler.cmake4
-rw-r--r--Modules/CMakeTestOBJCXXCompiler.cmake4
-rw-r--r--Modules/CMakeVerifyManifest.cmake3
-rw-r--r--Modules/CTestTargets.cmake34
-rw-r--r--Modules/CXX-DetectStdlib.h10
-rw-r--r--Modules/CheckForPthreads.c2
-rw-r--r--Modules/CheckLibraryExists.lists.in8
-rw-r--r--Modules/CheckStructHasMember.cmake2
-rw-r--r--Modules/CheckSymbolExists.cmake24
-rw-r--r--Modules/CheckTypeSize.cmake1
-rw-r--r--Modules/Compiler/ADSP-C.cmake2
-rw-r--r--Modules/Compiler/ADSP-CXX.cmake2
-rw-r--r--Modules/Compiler/ARMClang-C.cmake10
-rw-r--r--Modules/Compiler/AppleClang-C.cmake4
-rw-r--r--Modules/Compiler/AppleClang-CXX.cmake9
-rw-r--r--Modules/Compiler/AppleClang-OBJC.cmake8
-rw-r--r--Modules/Compiler/AppleClang-OBJCXX.cmake7
-rw-r--r--Modules/Compiler/CMakeCommonCompilerMacros.cmake58
-rw-r--r--Modules/Compiler/Clang-C.cmake9
-rw-r--r--Modules/Compiler/Clang-CXX-CXXImportStd.cmake153
-rw-r--r--Modules/Compiler/Clang-OBJC.cmake6
-rw-r--r--Modules/Compiler/Clang.cmake23
-rw-r--r--Modules/Compiler/Cray-C.cmake2
-rw-r--r--Modules/Compiler/Cray-CXX.cmake3
-rw-r--r--Modules/Compiler/CrayClang-C.cmake2
-rw-r--r--Modules/Compiler/CrayClang-CXX.cmake2
-rw-r--r--Modules/Compiler/Fujitsu-C.cmake2
-rw-r--r--Modules/Compiler/Fujitsu-CXX.cmake2
-rw-r--r--Modules/Compiler/GNU-C.cmake35
-rw-r--r--Modules/Compiler/GNU-CXX.cmake50
-rw-r--r--Modules/Compiler/GNU-OBJC.cmake1
-rw-r--r--Modules/Compiler/GNU-OBJCXX.cmake1
-rw-r--r--Modules/Compiler/GNU.cmake111
-rw-r--r--Modules/Compiler/IBMClang-C.cmake3
-rw-r--r--Modules/Compiler/IBMClang-CXX.cmake3
-rw-r--r--Modules/Compiler/Intel-C.cmake28
-rw-r--r--Modules/Compiler/Intel-CXX.cmake87
-rw-r--r--Modules/Compiler/IntelLLVM-C.cmake35
-rw-r--r--Modules/Compiler/IntelLLVM-CXX.cmake18
-rw-r--r--Modules/Compiler/LCC-C.cmake4
-rw-r--r--Modules/Compiler/LCC-CXX.cmake6
-rw-r--r--Modules/Compiler/MSVC-C.cmake4
-rw-r--r--Modules/Compiler/MSVC-CXX-CXXImportStd.cmake103
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake12
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake10
-rw-r--r--Modules/Compiler/NVHPC-C.cmake1
-rw-r--r--Modules/Compiler/NVHPC-CXX.cmake1
-rw-r--r--Modules/Compiler/NVIDIA.cmake12
-rw-r--r--Modules/Compiler/OrangeC-C.cmake2
-rw-r--r--Modules/Compiler/OrangeC-CXX.cmake2
-rw-r--r--Modules/Compiler/PGI-C.cmake3
-rw-r--r--Modules/Compiler/PGI-CXX.cmake4
-rw-r--r--Modules/Compiler/SunPro-C.cmake4
-rw-r--r--Modules/Compiler/SunPro-CXX.cmake4
-rw-r--r--Modules/Compiler/TI-C.cmake5
-rw-r--r--Modules/Compiler/TI-CXX.cmake3
-rw-r--r--Modules/Compiler/TIClang-C.cmake10
-rw-r--r--Modules/Compiler/TIClang-CXX.cmake13
-rw-r--r--Modules/Compiler/Tasking-C.cmake2
-rw-r--r--Modules/Compiler/Tasking-CXX.cmake2
-rw-r--r--Modules/Compiler/XL-C.cmake3
-rw-r--r--Modules/Compiler/XL-CXX.cmake3
-rw-r--r--Modules/Compiler/XLClang-C.cmake3
-rw-r--r--Modules/Compiler/XLClang-CXX.cmake5
-rw-r--r--Modules/DartConfiguration.tcl.in3
-rw-r--r--Modules/ExternalProject.cmake218
-rw-r--r--Modules/ExternalProject/download.cmake.in3
-rw-r--r--Modules/FetchContent.cmake1
-rw-r--r--Modules/FindALSA.cmake5
-rw-r--r--Modules/FindArmadillo.cmake5
-rw-r--r--Modules/FindBZip2.cmake5
-rw-r--r--Modules/FindBacktrace.cmake22
-rw-r--r--Modules/FindBoost.cmake1
-rw-r--r--Modules/FindCUDA.cmake23
-rw-r--r--Modules/FindCUDAToolkit.cmake61
-rw-r--r--Modules/FindCURL.cmake9
-rw-r--r--Modules/FindCups.cmake5
-rw-r--r--Modules/FindEXPAT.cmake5
-rw-r--r--Modules/FindFontconfig.cmake4
-rw-r--r--Modules/FindFreetype.cmake5
-rw-r--r--Modules/FindGDAL.cmake5
-rw-r--r--Modules/FindGIF.cmake5
-rw-r--r--Modules/FindGLEW.cmake3
-rw-r--r--Modules/FindGSL.cmake5
-rw-r--r--Modules/FindGTK2.cmake27
-rw-r--r--Modules/FindGTest.cmake3
-rw-r--r--Modules/FindHDF5.cmake5
-rw-r--r--Modules/FindHSPELL.cmake5
-rw-r--r--Modules/FindICU.cmake114
-rw-r--r--Modules/FindIconv.cmake7
-rw-r--r--Modules/FindIntl.cmake5
-rw-r--r--Modules/FindJPEG.cmake5
-rw-r--r--Modules/FindJasper.cmake5
-rw-r--r--Modules/FindLTTngUST.cmake5
-rw-r--r--Modules/FindLibArchive.cmake5
-rw-r--r--Modules/FindLibLZMA.cmake5
-rw-r--r--Modules/FindLibXml2.cmake5
-rw-r--r--Modules/FindLibXslt.cmake5
-rw-r--r--Modules/FindLua.cmake1
-rw-r--r--Modules/FindLua51.cmake5
-rw-r--r--Modules/FindMPI.cmake1
-rw-r--r--Modules/FindMatlab.cmake296
-rw-r--r--Modules/FindOpenACC.cmake9
-rw-r--r--Modules/FindOpenMP.cmake25
-rw-r--r--Modules/FindOpenSP.cmake5
-rw-r--r--Modules/FindOpenSSL.cmake5
-rw-r--r--Modules/FindOpenSceneGraph.cmake5
-rw-r--r--Modules/FindPNG.cmake5
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake3
-rw-r--r--Modules/FindPkgConfig.cmake11
-rw-r--r--Modules/FindPostgreSQL.cmake1
-rw-r--r--Modules/FindProtobuf.cmake5
-rw-r--r--Modules/FindPython/Support.cmake18
-rw-r--r--Modules/FindPythonLibs.cmake6
-rw-r--r--Modules/FindQt3.cmake6
-rw-r--r--Modules/FindSDL.cmake5
-rw-r--r--Modules/FindSDL_gfx.cmake5
-rw-r--r--Modules/FindSDL_image.cmake5
-rw-r--r--Modules/FindSDL_mixer.cmake5
-rw-r--r--Modules/FindSDL_net.cmake5
-rw-r--r--Modules/FindSDL_sound.cmake5
-rw-r--r--Modules/FindSDL_ttf.cmake5
-rw-r--r--Modules/FindSQLite3.cmake18
-rw-r--r--Modules/FindSWIG.cmake74
-rw-r--r--Modules/FindTIFF.cmake1
-rw-r--r--Modules/FindVulkan.cmake1
-rw-r--r--Modules/FindXalanC.cmake5
-rw-r--r--Modules/FindXercesC.cmake5
-rw-r--r--Modules/FindZLIB.cmake5
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt8
-rw-r--r--Modules/FortranCInterface/Detect.cmake3
-rw-r--r--Modules/GenerateExportHeader.cmake4
-rw-r--r--Modules/GoogleTest.cmake45
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake2
-rw-r--r--Modules/Internal/CPack/CPackWIX.cmake28
-rw-r--r--Modules/Internal/CPack/WIX-v3/WIX.template.in53
-rw-r--r--Modules/Internal/CPack/WIX.template.in30
-rw-r--r--Modules/Internal/FeatureTesting.cmake3
-rw-r--r--Modules/KDE3Macros.cmake3
-rwxr-xr-xModules/Platform/AIX/ExportImportList2
-rw-r--r--Modules/Platform/Android-Determine.cmake1
-rw-r--r--Modules/Platform/Android/Determine-Compiler-NDK.cmake5
-rw-r--r--Modules/Platform/Apple-Apple-Swift.cmake3
-rw-r--r--Modules/Platform/Apple-NAG-Fortran.cmake11
-rw-r--r--Modules/Platform/CrayLinuxEnvironment.cmake3
-rw-r--r--Modules/Platform/Darwin-Initialize.cmake3
-rw-r--r--Modules/Platform/Linux-Apple-Swift.cmake2
-rw-r--r--Modules/Platform/Windows3x-OpenWatcom.cmake4
-rw-r--r--Modules/ProcessorCount.cmake3
-rw-r--r--Modules/TestBigEndian.cmake5
-rw-r--r--Modules/UseJava/ClearClassFiles.cmake5
-rw-r--r--Modules/UseJava/javaTargets.cmake.in2
-rw-r--r--Modules/UseSWIG.cmake6
-rw-r--r--Modules/exportheader.cmake.in1
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx7
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx182
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h5
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx45
-rw-r--r--Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h14
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx11
-rw-r--r--Source/CPack/WiX/cmWIXFeaturesSourceWriter.h3
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx5
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h3
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.cxx30
-rw-r--r--Source/CPack/WiX/cmWIXSourceWriter.h8
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackExternalGenerator.cxx4
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackGenerator.cxx331
-rw-r--r--Source/CPack/cmCPackGenerator.h12
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.cxx28
-rw-r--r--Source/CPack/cmCPackInnoSetupGenerator.h9
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx37
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx69
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.h6
-rw-r--r--Source/CTest/cmCTestCurl.cxx45
-rw-r--r--Source/CTest/cmCTestCurl.h24
-rw-r--r--Source/CTest/cmCTestGenericHandler.h2
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx10
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx8
-rw-r--r--Source/CTest/cmCTestSubmitCommand.cxx44
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx46
-rw-r--r--Source/CTest/cmCTestSubmitHandler.h6
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx13
-rw-r--r--Source/CTest/cmCTestTestHandler.h1
-rw-r--r--Source/CTest/cmCTestUploadHandler.cxx2
-rw-r--r--Source/Checks/Curses/CMakeLists.txt2
-rw-r--r--Source/Checks/cm_cxx_features.cmake2
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx2
-rw-r--r--Source/LexerParser/cmGccDepfileLexer.cxx92
-rw-r--r--Source/LexerParser/cmGccDepfileLexer.in.l4
-rw-r--r--Source/cmAddLibraryCommand.cxx40
-rw-r--r--Source/cmArgumentParserTypes.h2
-rw-r--r--Source/cmBinUtilsMacOSMachOLinker.cxx14
-rw-r--r--Source/cmCMakeLanguageCommand.cxx21
-rw-r--r--Source/cmCMakePresetsGraph.cxx234
-rw-r--r--Source/cmCMakePresetsGraphInternal.h103
-rw-r--r--Source/cmCMakePresetsGraphReadJSON.cxx52
-rw-r--r--Source/cmCTest.cxx56
-rw-r--r--Source/cmCTest.h8
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmCommonTargetGenerator.cxx5
-rw-r--r--Source/cmComputeLinkDepends.cxx21
-rw-r--r--Source/cmComputeLinkInformation.cxx4
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmConditionEvaluator.cxx6
-rw-r--r--Source/cmCoreTryCompile.cxx1
-rw-r--r--Source/cmCryptoHash.cxx33
-rw-r--r--Source/cmCryptoHash.h4
-rw-r--r--Source/cmCurl.cxx51
-rw-r--r--Source/cmCurl.h5
-rw-r--r--Source/cmDebugTools.h8
-rw-r--r--Source/cmELF.cxx28
-rw-r--r--Source/cmEnableLanguageCommand.cxx26
-rw-r--r--Source/cmExperimental.cxx23
-rw-r--r--Source/cmExperimental.h4
-rw-r--r--Source/cmExportFileGenerator.cxx48
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx18
-rw-r--r--Source/cmFileAPI.cxx2
-rw-r--r--Source/cmFileAPICMakeFiles.cxx42
-rw-r--r--Source/cmFileAPICodemodel.cxx14
-rw-r--r--Source/cmFileCommand.cxx114
-rw-r--r--Source/cmFindCommon.cxx4
-rw-r--r--Source/cmFindPackageCommand.cxx38
-rw-r--r--Source/cmGeneratorExpression.cxx9
-rw-r--r--Source/cmGeneratorExpression.h5
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx130
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h49
-rw-r--r--Source/cmGeneratorExpressionNode.cxx92
-rw-r--r--Source/cmGeneratorTarget.cxx275
-rw-r--r--Source/cmGeneratorTarget.h18
-rw-r--r--Source/cmGetPropertyCommand.cxx56
-rw-r--r--Source/cmGetSourceFilePropertyCommand.cxx51
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGlobCacheEntry.h30
-rw-r--r--Source/cmGlobVerificationManager.cxx29
-rw-r--r--Source/cmGlobVerificationManager.h9
-rw-r--r--Source/cmGlobalGenerator.cxx67
-rw-r--r--Source/cmGlobalGenerator.h1
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx8
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmGlobalVisualStudio14Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx74
-rw-r--r--Source/cmGlobalXCodeGenerator.h1
-rw-r--r--Source/cmGraphVizWriter.cxx3
-rw-r--r--Source/cmLinkLineDeviceComputer.cxx4
-rw-r--r--Source/cmList.h4
-rw-r--r--Source/cmLocalGenerator.cxx74
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefile.cxx19
-rw-r--r--Source/cmMakefile.h6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx24
-rw-r--r--Source/cmNinjaTargetGenerator.cxx31
-rw-r--r--Source/cmPolicies.h40
-rw-r--r--Source/cmQtAutoGenInitializer.cxx9
-rw-r--r--Source/cmSetPropertyCommand.cxx114
-rw-r--r--Source/cmSourceFile.cxx31
-rw-r--r--Source/cmStandardLevelResolver.cxx31
-rw-r--r--Source/cmStandardLevelResolver.h3
-rw-r--r--Source/cmState.cxx22
-rw-r--r--Source/cmState.h7
-rw-r--r--Source/cmStateDirectory.cxx2
-rw-r--r--Source/cmTarget.cxx7
-rw-r--r--Source/cmTest.cxx2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx110
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h2
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx11
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h5
-rw-r--r--Source/cmXCodeScheme.cxx34
-rw-r--r--Source/cmXCodeScheme.h6
-rw-r--r--Source/cmake.cxx34
-rw-r--r--Source/cmake.h7
-rw-r--r--Source/kwsys/CONTRIBUTING.rst2
-rw-r--r--Source/kwsys/CommandLineArguments.cxx16
-rw-r--r--Source/kwsys/Directory.cxx2
-rw-r--r--Source/kwsys/MD5.c2
-rw-r--r--Source/kwsys/SystemInformation.cxx8
-rw-r--r--Source/kwsys/SystemTools.cxx36
-rw-r--r--Source/kwsys/Terminal.c4
-rw-r--r--Source/kwsys/testSystemTools.cxx4
-rw-r--r--Tests/Architecture/CMakeLists.txt36
-rw-r--r--Tests/BuildDepends/CMakeLists.txt4
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt14
-rw-r--r--Tests/CMakeLib/CMakeLists.txt1
-rw-r--r--Tests/CMakeLib/testDebuggerNamedPipe.cxx2
-rw-r--r--Tests/CMakeLists.txt65
-rw-r--r--Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake79
-rw-r--r--Tests/CompatibleInterface/CMakeLists.txt121
-rw-r--r--Tests/CompatibleInterface/main.cpp112
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt36
-rw-r--r--Tests/CompileFeatures/c_std.h8
-rw-r--r--Tests/CompileFeatures/c_std_11.c5
-rw-r--r--Tests/CompileFeatures/c_std_17.c4
-rw-r--r--Tests/CompileFeatures/c_std_23.c5
-rw-r--r--Tests/CompileFeatures/c_std_90.c (renamed from Tests/CPackWiXGenerator/file with spaces.h)0
-rw-r--r--Tests/CompileFeatures/c_std_99.c4
-rw-r--r--Tests/CompileFeatures/cuda_std_03.cu0
-rw-r--r--Tests/CompileFeatures/cuda_std_11.cu4
-rw-r--r--Tests/CompileFeatures/cuda_std_14.cu4
-rw-r--r--Tests/CompileFeatures/cuda_std_17.cu4
-rw-r--r--Tests/CompileFeatures/cuda_std_20.cu4
-rw-r--r--Tests/CompileFeatures/cuda_std_23.cu4
-rw-r--r--Tests/CompileFeatures/cuda_std_26.cu4
-rw-r--r--Tests/CompileFeatures/cxx_std.h54
-rw-r--r--Tests/CompileFeatures/cxx_std_11.cpp6
-rw-r--r--Tests/CompileFeatures/cxx_std_14.cpp9
-rw-r--r--Tests/CompileFeatures/cxx_std_17.cpp4
-rw-r--r--Tests/CompileFeatures/cxx_std_20.cpp4
-rw-r--r--Tests/CompileFeatures/cxx_std_23.cpp4
-rw-r--r--Tests/CompileFeatures/cxx_std_26.cpp4
-rw-r--r--Tests/CompileFeatures/cxx_std_98.cpp0
-rw-r--r--Tests/CompileFeatures/default_dialect.c9
-rw-r--r--Tests/CompileFeatures/default_dialect.cpp35
-rw-r--r--Tests/CompileFeatures/default_dialect.cu1
-rw-r--r--Tests/FindBacktrace/CMakeLists.txt10
-rw-r--r--Tests/FindBacktrace/Test/CMakeLists.txt11
-rw-r--r--Tests/FindBacktrace/Test/backtrace.c56
-rw-r--r--Tests/FindGTK2/gdk/main.c2
-rw-r--r--Tests/FindJasper/Test/CMakeLists.txt2
-rw-r--r--Tests/FindJasper/Test/main.c18
-rw-r--r--Tests/FindOpenACC/CMakeLists.txt10
-rw-r--r--Tests/FindOpenMP/Test/CMakeLists.txt13
-rw-r--r--Tests/GeneratorExpression/CMakeLists.txt1
-rw-r--r--Tests/GeneratorExpression/check-part1.cmake1
-rw-r--r--Tests/GoogleTest/Test/CMakeLists.txt22
-rw-r--r--Tests/MSVCRuntimeLibrary/CMakeLists.txt4
-rw-r--r--Tests/NasmOnly/CMakeLists.txt7
-rw-r--r--Tests/NasmOnly/libnasm1.nasm6
-rw-r--r--Tests/NasmOnly/nasmonly.nasm19
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test16.cmake38
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test1b.cmake9
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test2b.cmake12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test2c.cmake12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test2d.cmake12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake4
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake4
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake4
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake4
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake4
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test8b.cmake51
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-Common-Test9b.cmake51
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test16.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt28
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-stderr.txt38
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test16.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-stderr.txt21
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt28
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-stderr.txt56
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-stderr.txt72
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b.cmake2
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test16.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt30
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt52
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b.cmake1
-rw-r--r--Tests/RunCMake/CMP0118/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMP0118/RunCMakeTest.cmake21
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test16/CMakeLists.txt10
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test8b/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/CMP0118/subdir-Common-Test9b/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-stderr.txt64
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2a.cmake3
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-stderr.txt167
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-stderr.txt135
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-stderr.txt126
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-stderr.txt64
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2a.cmake3
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-stderr.txt167
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-stderr.txt135
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-stderr.txt126
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-stderr.txt64
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2a.cmake3
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-stderr.txt167
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-stderr.txt135
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-stderr.txt126
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-stderr.txt64
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14-stderr.txt42
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15-stderr.txt55
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2a.cmake3
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-stderr.txt126
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-stderr.txt135
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-stderr.txt126
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b-stderr.txt36
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-stderr.txt90
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-stderr.txt90
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2a.cmake2
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-stderr.txt212
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-stderr.txt212
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-stderr.txt205
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-stderr.txt100
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-stderr.txt84
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-stderr.txt90
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-stderr.txt74
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-stderr.txt51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-stderr.txt90
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-stderr.txt27
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-stderr.txt10
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b.cmake6
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2a.cmake2
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d-stderr.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-stderr.txt79
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-stderr.txt212
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-stderr.txt212
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-stderr.txt205
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-stderr.txt100
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-stderr.txt45
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-stderr.txt84
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-result.txt1
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-stderr.txt61
-rw-r--r--Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b.cmake7
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Helper.cmake14
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test1.cmake9
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test10.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test11.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test12.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test13.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test14.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test15.cmake65
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test16.cmake38
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test1b.cmake9
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test2.cmake12
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test2b.cmake12
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test2c.cmake12
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test2d.cmake12
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test3.cmake66
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test3b.cmake66
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test4.cmake66
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test4b.cmake66
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test5.cmake78
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test6.cmake44
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test7.cmake44
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test8.cmake51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test8b.cmake51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test9.cmake51
-rw-r--r--Tests/RunCMake/CMP0163/CMP0163-Common-Test9b.cmake51
-rw-r--r--Tests/RunCMake/CMP0163/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/CMP0163/RunCMakeTest.cmake147
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test10/CMakeLists.txt33
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test11/CMakeLists.txt33
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test12/CMakeLists.txt33
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test13/CMakeLists.txt36
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test14/CMakeLists.txt33
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test15/CMakeLists.txt33
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test16/CMakeLists.txt10
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test6/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test7/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test8/CMakeLists.txt31
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test8b/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test9/CMakeLists.txt31
-rw-r--r--Tests/RunCMake/CMP0163/subdir-Common-Test9b/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-NEW-stderr.txt4
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/CMP0165/CMP0165-WARN.cmake2
-rw-r--r--Tests/RunCMake/CMP0165/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/CMP0165/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CMakeDependentOption/Regex-CMP0127-OLD-stderr.txt9
-rw-r--r--Tests/RunCMake/CMakeLists.txt38
-rw-r--r--Tests/RunCMake/CMakePackage/NestedConfigFile-stdout.txt6
-rw-r--r--Tests/RunCMake/CMakePackage/NestedConfigFile.cmake43
-rw-r--r--Tests/RunCMake/CMakePackage/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros-stdout.txt5
-rw-r--r--Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros.json.in10
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CPack/External/Prerequirements.cmake4
-rw-r--r--Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-check.cmake1
-rw-r--r--Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-stdout.txt11
-rw-r--r--Tests/RunCMake/CPack_WIX/3-AppWiX-verify-stdout.txt33
-rw-r--r--Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-check.cmake1
-rw-r--r--Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-stdout.txt11
-rw-r--r--Tests/RunCMake/CPack_WIX/4-AppWiX-verify-stdout.txt34
-rw-r--r--Tests/RunCMake/CPack_WIX/RunCMakeTest.cmake24
-rw-r--r--Tests/RunCMake/CPack_WIX/cpack-check-common.cmake6
-rw-r--r--Tests/RunCMake/CPack_WIX/print-msi.ps129
-rw-r--r--Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stdout.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1.cmake1
-rw-r--r--Tests/RunCMake/CTestCommandLine/FailDrop-common.cmake3
-rw-r--r--Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake47
-rw-r--r--Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake2
-rw-r--r--Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-result.txt1
-rw-r--r--Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-stderr.txt2
-rw-r--r--Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py12
-rw-r--r--Tests/RunCMake/CTestCommandLine/testDir-presets.json.in20
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake10
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt6
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt4
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-stderr.txt8
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-result.txt1
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-stderr.txt15
-rw-r--r--Tests/RunCMake/CTestResourceAllocation/invalid.json1
-rw-r--r--Tests/RunCMake/CXXModules/CMP0155-NEW.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/CMP0155-OLD.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdConfig-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdConfig-stderr.txt3
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdConfig.cmake10
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-stderr.txt9
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdHeadTarget.cmake10
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdInvalidGenex.cmake11
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-stderr.txt7
-rw-r--r--Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage.cmake10
-rw-r--r--Tests/RunCMake/CXXModules/ImplicitCXX20.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/Inspect.cmake17
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX20.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX23TargetNotRequired.cmake11
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX23TargetRequired-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX23TargetRequired-stderr.txt4
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX23TargetRequired.cmake11
-rw-r--r--Tests/RunCMake/CXXModules/NoCXX23TargetUnset.cmake13
-rw-r--r--Tests/RunCMake/CXXModules/NoScanningVariable.cmake3
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake40
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/CMakeLists.txt59
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/impl-uses-std.cxx3
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/test/CMakeLists.txt45
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/uses-std.cxx8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/CMakeLists.txt61
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/impl-uses-std.cxx3
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/test/CMakeLists.txt45
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/uses-std.cxx9
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-result.txt1
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-stdout.txt1
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-no-std-property-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-no-std-property/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-no-std-property/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/CMakeLists.txt54
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/test/CMakeLists.txt45
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/uses-std.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/CMakeLists.txt58
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/test/CMakeLists.txt45
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/uses-std.cxx7
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-build-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-install-stderr.txt8
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-transitive/CMakeLists.txt28
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std-transitive/main.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt15
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-std/main.cxx10
-rw-r--r--Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CommandLine/E_capabilities-stdout.txt2
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnMatch-stderr.txt11
-rw-r--r--Tests/RunCMake/CompileFeatures/CMP0128WarnUnset-stderr.txt11
-rw-r--r--Tests/RunCMake/CompileFeatures/compiler_introspection.cmake4
-rw-r--r--Tests/RunCMake/Configure/RunCMakeTest.cmake87
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadArg-result.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadArg-stderr.txt10
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadArg.cmake4
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadEnv-result.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadEnv-stderr.txt10
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadEnv.cmake3
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadVar-result.txt1
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadVar-stderr.txt10
-rw-r--r--Tests/RunCMake/ExternalProject/TLSVersionBadVar.cmake4
-rw-r--r--Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt6
-rw-r--r--Tests/RunCMake/FPHSA/BeforeProject-Error-result.txt1
-rw-r--r--Tests/RunCMake/FPHSA/BeforeProject-Error-stderr.txt12
-rw-r--r--Tests/RunCMake/FPHSA/BeforeProject-Error.cmake2
-rw-r--r--Tests/RunCMake/FPHSA/BeforeProject-Missing-stdout.txt2
-rw-r--r--Tests/RunCMake/FPHSA/BeforeProject-Missing.cmake2
-rw-r--r--Tests/RunCMake/FPHSA/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/FPHSA/FindBeforeProject.cmake3
-rw-r--r--Tests/RunCMake/FPHSA/NameMismatch-stderr.txt12
-rw-r--r--Tests/RunCMake/FPHSA/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/FetchContent/VarPassthroughs.cmake5
-rw-r--r--Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py44
-rw-r--r--Tests/RunCMake/FileAPI/cmakeFiles-v1.cmake10
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt3
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_MULTIPLE_VALUES.cmake31
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild-check.cmake25
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild.cmake66
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-check.cmake8
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-check.cmake8
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD.cmake2
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-check-common.cmake12
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-common.cmake42
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.h0
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.c0
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.h0
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.h0
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.h0
-rw-r--r--Tests/RunCMake/GenEx-TARGET_PROPERTY/main.c4
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h1
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h1
-rw-r--r--Tests/RunCMake/GoogleTest/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/IAR/RunCMakeTest.cmake49
-rw-r--r--Tests/RunCMake/IAR/iar-asm.cmake3
-rw-r--r--Tests/RunCMake/IAR/iar-c.cmake4
-rw-r--r--Tests/RunCMake/IAR/iar-cxx.cmake4
-rw-r--r--Tests/RunCMake/IAR/iar-lib.cmake9
-rw-r--r--Tests/RunCMake/LanguageStandards/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/LanguageStandards/Inspect.cmake14
-rw-r--r--Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake32
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-C.c4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-C.cmake4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake5
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt1
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake4
-rw-r--r--Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm4
-rw-r--r--Tests/RunCMake/README.rst12
-rw-r--r--Tests/RunCMake/RunCMake.cmake5
-rw-r--r--Tests/RunCMake/RunCPack.cmake112
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/CMakeLists.txt (renamed from Tests/CPackWiXGenerator/CMakeLists.txt)5
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/file with spaces.h0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/license.txt (renamed from Tests/CPackWiXGenerator/license.txt)0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/mylib.cpp (renamed from Tests/CPackWiXGenerator/mylib.cpp)0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/mylib.h (renamed from Tests/CPackWiXGenerator/mylib.h)0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/mylibapp.cpp (renamed from Tests/CPackWiXGenerator/mylibapp.cpp)0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/myotherapp.cpp (renamed from Tests/CPackWiXGenerator/myotherapp.cpp)0
-rw-r--r--Tests/RunCMake/RunCPack/AppWiX/patch.xml (renamed from Tests/CPackWiXGenerator/patch.xml)0
-rw-r--r--Tests/RunCMake/RunCPack/verify.cmake14
-rw-r--r--Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt4
-rw-r--r--Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt1
-rw-r--r--Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake2
-rw-r--r--Tests/RunCMake/VS10Project/VsCustomProps-check.cmake45
-rw-r--r--Tests/RunCMake/VS10Project/VsCustomProps.cmake3
-rw-r--r--Tests/RunCMake/VS10Project/VsJustMyCode-check.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake8
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake8
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake8
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake10
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake1
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake1
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake2
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake10
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake20
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake42
-rw-r--r--Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx0
-rw-r--r--Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake2
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaGeneration-check.cmake19
-rw-r--r--Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt2
-rw-r--r--Tests/RunCMake/add_custom_command/CommentGenex.cmake2
-rw-r--r--Tests/RunCMake/add_library/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-result.txt1
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-stderr.txt5
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW.cmake4
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_OLD.cmake9
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN-stderr.txt7
-rw-r--r--Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN.cmake3
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake11
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/CxxImportStd-unset.cmake8
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set.cmake11
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-unset.cmake8
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/Unknown-result.txt1
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/Unknown-stderr.txt4
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/Unknown.cmake8
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set-stderr.txt6
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake11
-rw-r--r--Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-unset.cmake8
-rw-r--r--Tests/RunCMake/cmake_language/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_fixtures/cyclicCleanup-stderr.txt5
-rw-r--r--Tests/RunCMake/ctest_fixtures/cyclicSetup-stderr.txt5
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/CMakeLists.txt.in2
-rw-r--r--Tests/RunCMake/ctest_submit/CTestConfig.cmake.in4
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-result.txt1
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stdout.txt4
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt2
-rw-r--r--Tests/RunCMake/ctest_submit/RunCMakeTest.cmake33
-rw-r--r--Tests/RunCMake/ctest_submit/test.cmake.in1
-rw-r--r--Tests/RunCMake/ctest_upload/UploadQuiet-check.cmake12
-rw-r--r--Tests/RunCMake/detect_jobserver.c3
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt8
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake40
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt14
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake10
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-good.cmake6
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-result.txt1
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-stderr.txt4
-rw-r--r--Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing.cmake1
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-parent-rpath-propagation.cmake44
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/main.c8
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/one.c6
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/three.c3
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/two.c6
-rw-r--r--Tests/RunCMake/file-RPATH/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/file-RPATH/LargeELF.c26
-rw-r--r--Tests/RunCMake/file-RPATH/LargeELF.cmake5
-rw-r--r--Tests/RunCMake/file-RPATH/RunCMakeTest.cmake12
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-result.txt1
-rw-r--r--Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-stderr.txt4
-rw-r--r--Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing.cmake1
-rw-r--r--Tests/RunCMake/property_init/CompileSources.cmake1
-rw-r--r--Tests/RunCMake/separate_arguments/ProgramCommand.cmake17
-rw-r--r--Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake13
-rw-r--r--Tests/SwiftOnly/CMakeLists.txt13
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt2
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/main.swift3
-rw-r--r--Tests/SwiftOnly/SwiftPlugin/plugin.swift2
-rw-r--r--Tests/TestsWorkingDirectory/CMakeLists.txt14
-rw-r--r--Tests/TestsWorkingDirectory/subdir/CMakeLists.txt14
-rw-r--r--Tests/VSAndroid/CMakeLists.txt2
-rw-r--r--Utilities/CMakeLists.txt2
-rw-r--r--Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx17
-rw-r--r--Utilities/Doxygen/CMakeLists.txt2
-rw-r--r--Utilities/Release/WiX/WIX.template.in12
-rw-r--r--Utilities/Release/WiX/cmake_extra_dialog.wxs36
-rw-r--r--Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs36
-rw-r--r--Utilities/Release/WiX/custom_action_dll.wxs.in8
-rw-r--r--Utilities/Release/WiX/install_dir.wxs110
-rw-r--r--Utilities/Release/WiX/options.wxs36
-rw-r--r--Utilities/Release/WiX/options_dlg.wxs28
-rw-r--r--Utilities/Release/WiX/patch_desktop_shortcut.xml2
-rw-r--r--Utilities/Release/WiX/patch_path_env.xml11
-rw-r--r--[-rwxr-xr-x]Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps10
-rw-r--r--[-rwxr-xr-x]Utilities/Release/win/sign-package.ps10
-rwxr-xr-xUtilities/Scripts/update-curl.bash2
-rwxr-xr-xUtilities/Scripts/update-zlib.bash4
-rwxr-xr-xUtilities/Scripts/update-zstd.bash2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt2
-rw-r--r--Utilities/Sphinx/CTestCustom.cmake.in1
-rw-r--r--Utilities/Sphinx/conf.py.in1
-rw-r--r--Utilities/cmcurl/CMake/Macros.cmake29
-rw-r--r--Utilities/cmcurl/CMake/Utilities.cmake2
-rw-r--r--Utilities/cmcurl/CMakeLists.txt81
-rw-r--r--Utilities/cmcurl/include/curl/curl.h3
-rw-r--r--Utilities/cmcurl/include/curl/curlver.h8
-rw-r--r--Utilities/cmcurl/lib/Makefile.inc6
-rw-r--r--Utilities/cmcurl/lib/altsvc.c18
-rw-r--r--Utilities/cmcurl/lib/asyn-ares.c18
-rw-r--r--Utilities/cmcurl/lib/asyn-thread.c2
-rw-r--r--Utilities/cmcurl/lib/bufq.c23
-rw-r--r--Utilities/cmcurl/lib/bufq.h7
-rw-r--r--Utilities/cmcurl/lib/c-hyper.c320
-rw-r--r--Utilities/cmcurl/lib/c-hyper.h8
-rw-r--r--Utilities/cmcurl/lib/cf-h1-proxy.c39
-rw-r--r--Utilities/cmcurl/lib/cf-h2-proxy.c11
-rw-r--r--Utilities/cmcurl/lib/cf-haproxy.c23
-rw-r--r--Utilities/cmcurl/lib/cf-socket.c93
-rw-r--r--Utilities/cmcurl/lib/cf-socket.h9
-rw-r--r--Utilities/cmcurl/lib/cfilters.c74
-rw-r--r--Utilities/cmcurl/lib/cfilters.h34
-rw-r--r--Utilities/cmcurl/lib/conncache.c8
-rw-r--r--Utilities/cmcurl/lib/connect.c29
-rw-r--r--Utilities/cmcurl/lib/connect.h3
-rw-r--r--Utilities/cmcurl/lib/cookie.c33
-rw-r--r--Utilities/cmcurl/lib/curl_config.h.cmake3
-rw-r--r--Utilities/cmcurl/lib/curl_des.c2
-rw-r--r--Utilities/cmcurl/lib/curl_get_line.c55
-rw-r--r--Utilities/cmcurl/lib/curl_get_line.h7
-rw-r--r--Utilities/cmcurl/lib/curl_ntlm_wb.c2
-rw-r--r--Utilities/cmcurl/lib/curl_rtmp.c4
-rw-r--r--Utilities/cmcurl/lib/curl_setup.h18
-rw-r--r--Utilities/cmcurl/lib/curl_sha512_256.c844
-rw-r--r--Utilities/cmcurl/lib/curl_sha512_256.h44
-rw-r--r--Utilities/cmcurl/lib/curl_trc.c35
-rw-r--r--Utilities/cmcurl/lib/curl_trc.h18
-rw-r--r--Utilities/cmcurl/lib/cw-out.c437
-rw-r--r--Utilities/cmcurl/lib/cw-out.h53
-rw-r--r--Utilities/cmcurl/lib/dict.c25
-rw-r--r--Utilities/cmcurl/lib/doh.c33
-rw-r--r--Utilities/cmcurl/lib/doh.h2
-rw-r--r--Utilities/cmcurl/lib/easy.c70
-rw-r--r--Utilities/cmcurl/lib/easygetopt.c2
-rw-r--r--Utilities/cmcurl/lib/easyif.h2
-rw-r--r--Utilities/cmcurl/lib/easyoptions.c2
-rw-r--r--Utilities/cmcurl/lib/file.c52
-rw-r--r--Utilities/cmcurl/lib/fopen.c5
-rw-r--r--Utilities/cmcurl/lib/ftp.c218
-rw-r--r--Utilities/cmcurl/lib/getinfo.c26
-rw-r--r--Utilities/cmcurl/lib/gopher.c10
-rw-r--r--Utilities/cmcurl/lib/headers.c61
-rw-r--r--Utilities/cmcurl/lib/headers.h7
-rw-r--r--Utilities/cmcurl/lib/hostip.c2
-rw-r--r--Utilities/cmcurl/lib/hsts.c17
-rw-r--r--Utilities/cmcurl/lib/http.c2725
-rw-r--r--Utilities/cmcurl/lib/http.h59
-rw-r--r--Utilities/cmcurl/lib/http2.c329
-rw-r--r--Utilities/cmcurl/lib/http_chunks.c221
-rw-r--r--Utilities/cmcurl/lib/http_chunks.h7
-rw-r--r--Utilities/cmcurl/lib/imap.c36
-rw-r--r--Utilities/cmcurl/lib/krb5.c25
-rw-r--r--Utilities/cmcurl/lib/ldap.c16
-rw-r--r--Utilities/cmcurl/lib/md4.c1
-rw-r--r--Utilities/cmcurl/lib/mime.c227
-rw-r--r--Utilities/cmcurl/lib/mime.h13
-rw-r--r--Utilities/cmcurl/lib/mprintf.c17
-rw-r--r--Utilities/cmcurl/lib/mqtt.c17
-rw-r--r--Utilities/cmcurl/lib/multi.c264
-rw-r--r--Utilities/cmcurl/lib/multihandle.h9
-rw-r--r--Utilities/cmcurl/lib/multiif.h49
-rw-r--r--Utilities/cmcurl/lib/netrc.c10
-rw-r--r--Utilities/cmcurl/lib/openldap.c2
-rw-r--r--Utilities/cmcurl/lib/pingpong.c39
-rw-r--r--Utilities/cmcurl/lib/pingpong.h2
-rw-r--r--Utilities/cmcurl/lib/pop3.c5
-rw-r--r--Utilities/cmcurl/lib/request.c409
-rw-r--r--Utilities/cmcurl/lib/request.h227
-rw-r--r--Utilities/cmcurl/lib/rtsp.c121
-rw-r--r--Utilities/cmcurl/lib/sendf.c1395
-rw-r--r--Utilities/cmcurl/lib/sendf.h250
-rw-r--r--Utilities/cmcurl/lib/setopt.c24
-rw-r--r--Utilities/cmcurl/lib/smb.c51
-rw-r--r--Utilities/cmcurl/lib/smb.h1
-rw-r--r--Utilities/cmcurl/lib/smtp.c350
-rw-r--r--Utilities/cmcurl/lib/smtp.h13
-rw-r--r--Utilities/cmcurl/lib/socks.c4
-rw-r--r--Utilities/cmcurl/lib/socks_gssapi.c2
-rw-r--r--Utilities/cmcurl/lib/strtoofft.c21
-rw-r--r--Utilities/cmcurl/lib/telnet.c22
-rw-r--r--Utilities/cmcurl/lib/tftp.c15
-rw-r--r--Utilities/cmcurl/lib/transfer.c713
-rw-r--r--Utilities/cmcurl/lib/transfer.h39
-rw-r--r--Utilities/cmcurl/lib/url.c124
-rw-r--r--Utilities/cmcurl/lib/url.h6
-rw-r--r--Utilities/cmcurl/lib/urlapi.c4
-rw-r--r--Utilities/cmcurl/lib/urldata.h230
-rw-r--r--Utilities/cmcurl/lib/vauth/digest.c67
-rw-r--r--Utilities/cmcurl/lib/version.c6
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_msh3.c21
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_ngtcp2.c179
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_osslq.c124
-rw-r--r--Utilities/cmcurl/lib/vquic/curl_quiche.c13
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic-tls.c4
-rw-r--r--Utilities/cmcurl/lib/vquic/vquic.c24
-rw-r--r--Utilities/cmcurl/lib/vssh/libssh.c28
-rw-r--r--Utilities/cmcurl/lib/vssh/libssh2.c42
-rw-r--r--Utilities/cmcurl/lib/vssh/wolfssh.c16
-rw-r--r--Utilities/cmcurl/lib/vtls/bearssl.c2
-rw-r--r--Utilities/cmcurl/lib/vtls/gtls.c4
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls.c77
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls_threadlock.c12
-rw-r--r--Utilities/cmcurl/lib/vtls/mbedtls_threadlock.h4
-rw-r--r--Utilities/cmcurl/lib/vtls/openssl.c74
-rw-r--r--Utilities/cmcurl/lib/vtls/rustls.c73
-rw-r--r--Utilities/cmcurl/lib/vtls/schannel.c14
-rw-r--r--Utilities/cmcurl/lib/vtls/sectransp.c2
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls.c55
-rw-r--r--Utilities/cmcurl/lib/vtls/vtls_int.h1
-rw-r--r--Utilities/cmcurl/lib/vtls/wolfssl.c6
-rw-r--r--Utilities/cmcurl/lib/ws.c58
-rw-r--r--Utilities/cmcurl/lib/ws.h2
-rw-r--r--Utilities/cmzlib/Copyright.txt4
-rw-r--r--Utilities/cmzlib/README19
-rw-r--r--Utilities/cmzlib/adler32.c32
-rw-r--r--Utilities/cmzlib/compress.c21
-rw-r--r--Utilities/cmzlib/crc32.c248
-rw-r--r--Utilities/cmzlib/deflate.c612
-rw-r--r--Utilities/cmzlib/deflate.h51
-rw-r--r--Utilities/cmzlib/gzclose.c4
-rw-r--r--Utilities/cmzlib/gzguts.h31
-rw-r--r--Utilities/cmzlib/gzlib.c113
-rw-r--r--Utilities/cmzlib/gzread.c88
-rw-r--r--Utilities/cmzlib/gzwrite.c84
-rw-r--r--Utilities/cmzlib/inffast.c5
-rw-r--r--Utilities/cmzlib/inffast.h2
-rw-r--r--Utilities/cmzlib/inflate.c131
-rw-r--r--Utilities/cmzlib/inftrees.c17
-rw-r--r--Utilities/cmzlib/inftrees.h10
-rw-r--r--Utilities/cmzlib/trees.c542
-rw-r--r--Utilities/cmzlib/uncompr.c16
-rw-r--r--Utilities/cmzlib/zconf.h18
-rw-r--r--Utilities/cmzlib/zlib.h391
-rw-r--r--Utilities/cmzlib/zutil.c60
-rw-r--r--Utilities/cmzlib/zutil.h47
-rw-r--r--Utilities/cmzstd/CMakeLists.txt9
-rw-r--r--Utilities/cmzstd/LICENSE8
-rw-r--r--Utilities/cmzstd/README.md88
-rw-r--r--Utilities/cmzstd/lib/common/allocations.h55
-rw-r--r--Utilities/cmzstd/lib/common/bits.h200
-rw-r--r--Utilities/cmzstd/lib/common/bitstream.h92
-rw-r--r--Utilities/cmzstd/lib/common/compiler.h163
-rw-r--r--Utilities/cmzstd/lib/common/cpu.h2
-rw-r--r--Utilities/cmzstd/lib/common/debug.c2
-rw-r--r--Utilities/cmzstd/lib/common/debug.h2
-rw-r--r--Utilities/cmzstd/lib/common/entropy_common.c52
-rw-r--r--Utilities/cmzstd/lib/common/error_private.c11
-rw-r--r--Utilities/cmzstd/lib/common/error_private.h81
-rw-r--r--Utilities/cmzstd/lib/common/fse.h91
-rw-r--r--Utilities/cmzstd/lib/common/fse_decompress.c108
-rw-r--r--Utilities/cmzstd/lib/common/huf.h253
-rw-r--r--Utilities/cmzstd/lib/common/mem.h103
-rw-r--r--Utilities/cmzstd/lib/common/pool.c53
-rw-r--r--Utilities/cmzstd/lib/common/pool.h12
-rw-r--r--Utilities/cmzstd/lib/common/portability_macros.h156
-rw-r--r--Utilities/cmzstd/lib/common/threading.c82
-rw-r--r--Utilities/cmzstd/lib/common/threading.h15
-rw-r--r--Utilities/cmzstd/lib/common/xxhash.c814
-rw-r--r--Utilities/cmzstd/lib/common/xxhash.h5733
-rw-r--r--Utilities/cmzstd/lib/common/zstd_common.c37
-rw-r--r--Utilities/cmzstd/lib/common/zstd_deps.h2
-rw-r--r--Utilities/cmzstd/lib/common/zstd_internal.h192
-rw-r--r--Utilities/cmzstd/lib/common/zstd_trace.h15
-rw-r--r--Utilities/cmzstd/lib/compress/clevels.h134
-rw-r--r--Utilities/cmzstd/lib/compress/fse_compress.c223
-rw-r--r--Utilities/cmzstd/lib/compress/hist.c2
-rw-r--r--Utilities/cmzstd/lib/compress/hist.h2
-rw-r--r--Utilities/cmzstd/lib/compress/huf_compress.c978
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress.c2325
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_internal.h519
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_literals.c153
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_literals.h22
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_sequences.c35
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_sequences.h2
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_superblock.c51
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_compress_superblock.h2
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_cwksp.h248
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_double_fast.c501
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_double_fast.h5
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_fast.c978
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_fast.h5
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_lazy.c1252
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_lazy.h6
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_ldm.c24
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_ldm.h4
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_ldm_geartab.h7
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_opt.c521
-rw-r--r--Utilities/cmzstd/lib/compress/zstd_opt.h2
-rw-r--r--Utilities/cmzstd/lib/compress/zstdmt_compress.c132
-rw-r--r--Utilities/cmzstd/lib/compress/zstdmt_compress.h7
-rw-r--r--Utilities/cmzstd/lib/decompress/huf_decompress.c1569
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_ddict.c8
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_ddict.h2
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_decompress.c354
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_decompress_block.c1198
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_decompress_block.h17
-rw-r--r--Utilities/cmzstd/lib/decompress/zstd_decompress_internal.h43
-rw-r--r--Utilities/cmzstd/lib/deprecated/zbuff.h2
-rw-r--r--Utilities/cmzstd/lib/deprecated/zbuff_common.c2
-rw-r--r--Utilities/cmzstd/lib/deprecated/zbuff_compress.c28
-rw-r--r--Utilities/cmzstd/lib/deprecated/zbuff_decompress.c4
-rw-r--r--Utilities/cmzstd/lib/dictBuilder/cover.c45
-rw-r--r--Utilities/cmzstd/lib/dictBuilder/cover.h2
-rw-r--r--Utilities/cmzstd/lib/dictBuilder/fastcover.c19
-rw-r--r--Utilities/cmzstd/lib/dictBuilder/zdict.c159
-rw-r--r--Utilities/cmzstd/lib/zdict.h92
-rw-r--r--Utilities/cmzstd/lib/zstd.h996
-rw-r--r--Utilities/cmzstd/lib/zstd_errors.h35
-rwxr-xr-xbootstrap15
1739 files changed, 46138 insertions, 15798 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 03e6a51..6d2edd4 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -5,12 +5,16 @@ bugprone-*,\
-bugprone-easily-swappable-parameters,\
-bugprone-empty-catch,\
-bugprone-implicit-widening-of-multiplication-result,\
+-bugprone-inc-dec-in-conditions,\
-bugprone-macro-parentheses,\
-bugprone-misplaced-widening-cast,\
+-bugprone-multi-level-implicit-pointer-conversion,\
-bugprone-narrowing-conversions,\
-bugprone-switch-missing-default-case,\
-bugprone-too-small-loop-variable,\
-bugprone-unchecked-optional-access,\
+-bugprone-unused-local-non-trivial-variable,\
+-bugprone-unused-return-value,\
misc-*,\
-misc-confusable-identifiers,\
-misc-const-correctness,\
@@ -31,9 +35,12 @@ modernize-*,\
-modernize-use-transparent-functors,\
performance-*,\
-performance-avoid-endl,\
+-performance-enum-size,\
-performance-inefficient-vector-operation,\
-performance-noexcept-swap,\
readability-*,\
+-readability-avoid-nested-conditional-operator,\
+-readability-avoid-return-with-void-value,\
-readability-avoid-unconditional-preprocessor-if,\
-readability-convert-member-functions-to-static,\
-readability-function-cognitive-complexity,\
@@ -45,8 +52,11 @@ readability-*,\
-readability-magic-numbers,\
-readability-make-member-function-const,\
-readability-named-parameter,\
+-readability-redundant-casting,\
-readability-redundant-declaration,\
+-readability-redundant-inline-specifier,\
-readability-redundant-member-init,\
+-readability-reference-to-constructed-temporary,\
-readability-simplify-boolean-expr,\
-readability-static-accessed-through-instance,\
-readability-suspicious-call-argument,\
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b2c90eb..a3d959c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -59,7 +59,7 @@ p:source-package:
p:doc-package:
extends:
- - .fedora39_sphinx_package
+ - .fedora40_sphinx_package
- .cmake_prep_doc_linux
- .linux_x86_64_tags
- .cmake_doc_artifacts
@@ -108,18 +108,18 @@ l:iwyu-debian12:
- .cmake_cdash_artifacts
- .run_automatically
-l:tidy-fedora39:
+l:tidy-fedora40:
extends:
- - .fedora39_tidy
+ - .fedora40_tidy
- .cmake_build_linux
- .cmake_tidy_artifacts
- .linux_x86_64_tags
- .cmake_cdash_artifacts
- .run_automatically
-l:sphinx-fedora39:
+l:sphinx-fedora40:
extends:
- - .fedora39_sphinx
+ - .fedora40_sphinx
- .cmake_build_linux
- .cmake_sphinx_artifacts
- .linux_x86_64_tags
@@ -128,9 +128,9 @@ l:sphinx-fedora39:
CMAKE_CI_JOB_CONTINUOUS: "true"
CMAKE_CI_JOB_HELP: "true"
-l:clang-analyzer-fedora39:
+l:clang-analyzer-fedora40:
extends:
- - .fedora39_clang_analyzer
+ - .fedora40_clang_analyzer
- .cmake_build_linux
- .linux_x86_64_tags
- .run_automatically
@@ -222,7 +222,7 @@ t:debian12-hip-radeon:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:fedora39-hip-radeon:
extends:
@@ -232,11 +232,11 @@ t:fedora39-hip-radeon:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-ninja-clang:
+t:fedora40-ninja-clang:
extends:
- - .fedora39_ninja_clang
+ - .fedora40_ninja_clang
- .cmake_test_linux_release
- .linux_x86_64_tags
- .run_dependent
@@ -244,9 +244,9 @@ t:fedora39-ninja-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-ninja-multi-clang:
+t:fedora40-ninja-multi-clang:
extends:
- - .fedora39_ninja_multi_clang
+ - .fedora40_ninja_multi_clang
- .cmake_test_linux_release
- .linux_x86_64_tags
- .run_dependent
@@ -254,9 +254,9 @@ t:fedora39-ninja-multi-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-makefiles-clang:
+t:fedora40-makefiles-clang:
extends:
- - .fedora39_makefiles_clang
+ - .fedora40_makefiles_clang
- .cmake_test_linux_release
- .linux_x86_64_tags
- .run_dependent
@@ -264,17 +264,17 @@ t:fedora39-makefiles-clang:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-makefiles:
+t:fedora40-makefiles:
extends:
- - .fedora39_makefiles
+ - .fedora40_makefiles
- .cmake_test_linux_release
- .linux_x86_64_tags
- .run_dependent
- .needs_centos7_x86_64
-t:fedora39-makefiles-nospace:
+t:fedora40-makefiles-nospace:
extends:
- - .fedora39_makefiles
+ - .fedora40_makefiles
- .cmake_test_linux_release
- .linux_x86_64_tags
- .cmake_junit_artifacts
@@ -282,7 +282,7 @@ t:fedora39-makefiles-nospace:
- .needs_centos7_x86_64
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake-ci"
- CMAKE_CI_BUILD_NAME: fedora39_makefiles_nospace
+ CMAKE_CI_BUILD_NAME: fedora40_makefiles_nospace
CMAKE_CI_JOB_NIGHTLY: "true"
t:nvhpc22.11-ninja:
@@ -303,7 +303,7 @@ t:cuda9.2-nvidia:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda10.2-nvidia:
extends:
@@ -313,6 +313,8 @@ t:cuda10.2-nvidia:
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda10.2-clang:
extends:
@@ -322,7 +324,7 @@ t:cuda10.2-clang:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda11.6-nvidia:
extends:
@@ -332,6 +334,8 @@ t:cuda11.6-nvidia:
- .cmake_junit_artifacts
- .run_dependent
- .needs_centos7_x86_64
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda11.6-clang:
extends:
@@ -341,7 +345,7 @@ t:cuda11.6-clang:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda11.8-minimal-ninja:
extends:
@@ -351,7 +355,7 @@ t:cuda11.8-minimal-ninja:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
t:cuda11.8-minimal-splayed-ninja:
extends:
@@ -361,43 +365,42 @@ t:cuda11.8-minimal-splayed-ninja:
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
-t:hip5.5-nvidia:
+t:cuda12.2-nvidia:
extends:
- - .hip5.5_nvidia
+ - .cuda12.2_nvidia
- .cmake_test_linux_release
- .linux_x86_64_tags_cuda
+ - .cmake_junit_artifacts
- .run_dependent
- .needs_centos7_x86_64
- variables:
- CMAKE_CI_NO_MR: "true"
-t:hip5.5-radeon:
+t:cuda12.2-clang:
extends:
- - .hip5.5_radeon
+ - .cuda12.2_clang
- .cmake_test_linux_release
- - .linux_x86_64_tags_radeon
+ - .linux_x86_64_tags_cuda
- .run_dependent
- .needs_centos7_x86_64
variables:
- CMAKE_CI_NO_MR: "true"
+ CMAKE_CI_JOB_NIGHTLY: "true"
-t:linux-gcc-cxx-modules-ninja:
+t:hip5.5-nvidia:
extends:
- - .gcc_cxx_modules_ninja
+ - .hip5.5_nvidia
- .cmake_test_linux_release
- - .linux_x86_64_tags
+ - .linux_x86_64_tags_cuda
- .run_dependent
- .needs_centos7_x86_64
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:linux-gcc-cxx-modules-ninja-multi:
+t:hip5.5-radeon:
extends:
- - .gcc_cxx_modules_ninja_multi
+ - .hip5.5_radeon
- .cmake_test_linux_release
- - .linux_x86_64_tags
+ - .linux_x86_64_tags_radeon
- .run_dependent
- .needs_centos7_x86_64
variables:
@@ -414,9 +417,9 @@ t:debian10-legacy:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-b:fedora39-ninja:
+b:fedora40-ninja:
extends:
- - .fedora39_ninja
+ - .fedora40_ninja
- .cmake_build_linux
- .cmake_build_artifacts
- .linux_x86_64_tags
@@ -424,9 +427,9 @@ b:fedora39-ninja:
variables:
CMAKE_CI_JOB_CONTINUOUS: "true"
-b:fedora39-makefiles-symlinked:
+b:fedora40-makefiles-symlinked:
extends:
- - .fedora39_makefiles_symlinked
+ - .fedora40_makefiles_symlinked
- .cmake_build_linux
- .cmake_build_artifacts
- .linux_x86_64_tags
@@ -461,68 +464,54 @@ b:debian12-aarch64-extdeps:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-b:fedora39-extdeps:
+b:fedora40-extdeps:
extends:
- - .fedora39_extdeps
+ - .fedora40_extdeps
- .cmake_build_linux_standalone
- .linux_x86_64_tags
- .run_manually
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-ninja:
+t:fedora40-ninja:
extends:
- - .fedora39_ninja
+ - .fedora40_ninja
- .cmake_test_linux
- .linux_x86_64_tags_x11
- .cmake_test_artifacts
- .run_dependent
dependencies:
- - b:fedora39-ninja
+ - b:fedora40-ninja
needs:
- - b:fedora39-ninja
+ - b:fedora40-ninja
variables:
CMAKE_CI_JOB_CONTINUOUS: "true"
-t:fedora39-makefiles-symlinked:
+t:fedora40-makefiles-symlinked:
extends:
- - .fedora39_makefiles_symlinked
+ - .fedora40_makefiles_symlinked
- .cmake_test_linux
- .linux_x86_64_tags_x11
- .cmake_test_artifacts
- .run_dependent
dependencies:
- - b:fedora39-makefiles-symlinked
+ - b:fedora40-makefiles-symlinked
needs:
- - b:fedora39-makefiles-symlinked
+ - b:fedora40-makefiles-symlinked
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-ninja-multi:
+t:fedora40-ninja-multi:
extends:
- - .fedora39_ninja_multi
+ - .fedora40_ninja_multi
- .cmake_test_linux_external
- .linux_x86_64_tags
- .cmake_junit_artifacts
- .run_dependent
dependencies:
- - t:fedora39-ninja
+ - t:fedora40-ninja
needs:
- - t:fedora39-ninja
-
-t:intel2016-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2016_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2016-el7
-
-t:intel2016u1-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2016u1_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2016u1-el7
+ - t:fedora40-ninja
t:intel2016u2-makefiles:
extends:
@@ -531,62 +520,6 @@ t:intel2016u2-makefiles:
CMAKE_CI_BUILD_NAME: intel2016u2_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2016u2-el7
-t:intel2017-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017-el7
-
-t:intel2017u1-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u1_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u1-el7
-
-t:intel2017u2-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u2_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u2-el7
-
-t:intel2017u3-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u3_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u3-el7
-
-t:intel2017u4-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u4_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u4-el7
-
-t:intel2017u5-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u5_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u5-el7
-
-t:intel2017u6-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u6_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u6-el7
-
-t:intel2017u7-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2017u7_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u7-el7
-
t:intel2017u8-makefiles:
extends:
- .cmake_test_linux_intelclassic_makefiles
@@ -594,34 +527,6 @@ t:intel2017u8-makefiles:
CMAKE_CI_BUILD_NAME: intel2017u8_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2017u8-el7
-t:intel2018-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2018_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2018-el7
-
-t:intel2018u1-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2018u1_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2018u1-el7
-
-t:intel2018u2-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2018u2_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2018u2-el7
-
-t:intel2018u3-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2018u3_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2018u3-el7
-
t:intel2018u4-makefiles:
extends:
- .cmake_test_linux_intelclassic_makefiles
@@ -629,34 +534,6 @@ t:intel2018u4-makefiles:
CMAKE_CI_BUILD_NAME: intel2018u4_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2018u4-el7
-t:intel2019-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2019_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2019-el7
-
-t:intel2019u1-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2019u1_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2019u1-el7
-
-t:intel2019u2-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2019u2_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2019u2-el7
-
-t:intel2019u3-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2019u3_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2019u3-el7
-
t:intel2019u4-makefiles:
extends:
- .cmake_test_linux_intelclassic_makefiles
@@ -664,20 +541,6 @@ t:intel2019u4-makefiles:
CMAKE_CI_BUILD_NAME: intel2019u4_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2019u4-el7
-t:intel2020-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2020_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2020-el8
-
-t:intel2020u2-makefiles:
- extends:
- - .cmake_test_linux_intelclassic_makefiles
- variables:
- CMAKE_CI_BUILD_NAME: intel2020u2_makefiles
- CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2020u2-el8
-
t:intel2020u4-makefiles:
extends:
- .cmake_test_linux_intelclassic_makefiles
@@ -846,6 +709,13 @@ t:oneapi2024.0.0-makefiles:
CMAKE_CI_BUILD_NAME: oneapi2024.0.0_makefiles
CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2024.0.0-el8
+t:oneapi2024.1.0-makefiles:
+ extends:
+ - .cmake_test_linux_inteloneapi_makefiles
+ variables:
+ CMAKE_CI_BUILD_NAME: oneapi2024.1.0_makefiles
+ CMAKE_CI_INTELCOMPILER_IMAGE_TAG: 2024.1.0-el8
+
b:linux-x86_64-package:
extends:
- .linux_package
@@ -896,9 +766,9 @@ u:linux-aarch64-package:
## Sanitizer builds
-b:fedora39-asan:
+b:fedora40-asan:
extends:
- - .fedora39_asan
+ - .fedora40_asan
- .cmake_build_linux
- .cmake_build_artifacts
- .linux_x86_64_tags
@@ -906,16 +776,16 @@ b:fedora39-asan:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:fedora39-asan:
+t:fedora40-asan:
extends:
- - .fedora39_asan
+ - .fedora40_asan
- .cmake_memcheck_linux
- .linux_x86_64_tags
- .run_dependent
dependencies:
- - b:fedora39-asan
+ - b:fedora40-asan
needs:
- - b:fedora39-asan
+ - b:fedora40-asan
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
@@ -1160,6 +1030,8 @@ b:windows-vs2022-x64-ninja:
- .cmake_build_artifacts
- .windows_x86_64_tags_nonconcurrent_vs2022
- .run_manually
+ variables:
+ CMAKE_CI_JOB_CONTINUOUS: "true"
b:windows-vs2022-x64-pch:
extends:
@@ -1182,6 +1054,7 @@ t:windows-vs2022-x64-ninja:
needs:
- b:windows-vs2022-x64-ninja
variables:
+ CMAKE_CI_JOB_CONTINUOUS: "true"
CMAKE_CI_JOB_NIGHTLY_NINJA: "true"
t:windows-vs2022-x64-ninja-multi:
@@ -1198,11 +1071,10 @@ t:windows-vs2022-x64-ninja-multi:
variables:
CMAKE_CI_JOB_NIGHTLY: "true"
-t:windows-vs2022-x64:
+.t:windows-vs2022-x64:
extends:
- .windows_vs2022_x64
- .cmake_test_windows_external
- - .windows_x86_64_tags_concurrent_vs2022
- .cmake_junit_artifacts
- .run_dependent
dependencies:
@@ -1210,11 +1082,25 @@ t:windows-vs2022-x64:
needs:
- t:windows-vs2022-x64-ninja
+t:windows-vs2022-x64:
+ extends:
+ - .t:windows-vs2022-x64
+ - .windows_x86_64_tags_concurrent_vs2022
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "false"
+
+t:windows-vs2022-x64-nightly:
+ extends:
+ - .t:windows-vs2022-x64
+ - .windows_x86_64_tags_concurrent_vs2022_android
+ variables:
+ CMAKE_CI_JOB_NIGHTLY: "true"
+
t:windows-vs2019-x64:
extends:
- .windows_vs2019_x64
- .cmake_test_windows_external
- - .windows_x86_64_tags_concurrent_vs2019
+ - .windows_x86_64_tags_concurrent_vs2019_android
- .cmake_junit_artifacts
- .run_dependent
dependencies:
diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore
index d8efc1e..552c02c 100644
--- a/.gitlab/.gitignore
+++ b/.gitlab/.gitignore
@@ -16,9 +16,12 @@
/python*
/qt*
/sccache*
+/swift
/ticlang
+/tmp
/unstable-jom*
/watcom
-/wix*
+/wix3
+/wix4
/clang-tidy-fixes
/num_warnings.txt
diff --git a/.gitlab/ci/borland-env.ps1 b/.gitlab/ci/borland-env.ps1
index b3b532e..b3b532e 100755..100644
--- a/.gitlab/ci/borland-env.ps1
+++ b/.gitlab/ci/borland-env.ps1
diff --git a/.gitlab/ci/borland.ps1 b/.gitlab/ci/borland.ps1
index 146a047..146a047 100755..100644
--- a/.gitlab/ci/borland.ps1
+++ b/.gitlab/ci/borland.ps1
diff --git a/.gitlab/ci/clang-env.ps1 b/.gitlab/ci/clang-env.ps1
index 451fca3..451fca3 100755..100644
--- a/.gitlab/ci/clang-env.ps1
+++ b/.gitlab/ci/clang-env.ps1
diff --git a/.gitlab/ci/clang.ps1 b/.gitlab/ci/clang.ps1
index e455ebc..e455ebc 100755..100644
--- a/.gitlab/ci/clang.ps1
+++ b/.gitlab/ci/clang.ps1
diff --git a/.gitlab/ci/cmake-env.ps1 b/.gitlab/ci/cmake-env.ps1
new file mode 100644
index 0000000..505fa44
--- /dev/null
+++ b/.gitlab/ci/cmake-env.ps1
@@ -0,0 +1,5 @@
+$pwdpath = $pwd.Path
+& "$pwsh" -File ".gitlab/ci/cmake.ps1"
+Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\cmake\bin;$env:PATH"
+cmake --version
+$cmake = "cmake"
diff --git a/.gitlab/ci/cmake-env.sh b/.gitlab/ci/cmake-env.sh
new file mode 100644
index 0000000..686a78f
--- /dev/null
+++ b/.gitlab/ci/cmake-env.sh
@@ -0,0 +1,3 @@
+.gitlab/ci/cmake.sh
+export PATH="$PWD/.gitlab/cmake/bin:$PATH"
+cmake --version
diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1
index f6b5cc7..f6b5cc7 100755..100644
--- a/.gitlab/ci/cmake.ps1
+++ b/.gitlab/ci/cmake.ps1
diff --git a/.gitlab/ci/configure_cuda12.2_clang.cmake b/.gitlab/ci/configure_cuda12.2_clang.cmake
new file mode 100644
index 0000000..8f10f86
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.2_clang.cmake
@@ -0,0 +1,4 @@
+set(CMake_TEST_CUDA "Clang" CACHE STRING "")
+set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20;23" CACHE STRING "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_cuda12.2_nvidia.cmake b/.gitlab/ci/configure_cuda12.2_nvidia.cmake
new file mode 100644
index 0000000..51a2511
--- /dev/null
+++ b/.gitlab/ci/configure_cuda12.2_nvidia.cmake
@@ -0,0 +1,5 @@
+set(CMake_TEST_CUDA "NVIDIA" CACHE STRING "")
+set(CMake_TEST_CUDA_CUPTI "ON" CACHE STRING "")
+set(CMake_TEST_CUDA_STANDARDS "03;11;14;17;20" CACHE STRING "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_debian12_aarch64_ninja.cmake b/.gitlab/ci/configure_debian12_aarch64_ninja.cmake
index 5b97e4f..24be975 100644
--- a/.gitlab/ci/configure_debian12_aarch64_ninja.cmake
+++ b/.gitlab/ci/configure_debian12_aarch64_ninja.cmake
@@ -1,3 +1,6 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
set(CMake_TEST_CTestUpdate_BZR "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_CVS "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_GIT "ON" CACHE BOOL "")
@@ -61,6 +64,9 @@ set(CMake_TEST_FindMPI_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI "ON" CACHE BOOL "")
set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
@@ -92,6 +98,7 @@ set(CMake_TEST_IPO_WORKS_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "")
set(CMake_TEST_Qt5 "ON" CACHE BOOL "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
set(CMake_TEST_UseSWIG "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_debian12_makefiles_clang.cmake b/.gitlab/ci/configure_debian12_makefiles_clang.cmake
index 69f1e7c..7cba6f3 100644
--- a/.gitlab/ci/configure_debian12_makefiles_clang.cmake
+++ b/.gitlab/ci/configure_debian12_makefiles_clang.cmake
@@ -1,3 +1,6 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_TICLANG_TOOLCHAINS "$ENV{CI_PROJECT_DIR}/.gitlab/ticlang" CACHE PATH "")
endif()
diff --git a/.gitlab/ci/configure_debian12_ninja.cmake b/.gitlab/ci/configure_debian12_ninja.cmake
index 89c1108..efca7a1 100644
--- a/.gitlab/ci/configure_debian12_ninja.cmake
+++ b/.gitlab/ci/configure_debian12_ninja.cmake
@@ -1,2 +1,4 @@
+set(CMake_TEST_ASM_NASM "ON" CACHE BOOL "")
+
include("${CMAKE_CURRENT_LIST_DIR}/configure_debian12_ninja_common.cmake")
set(CMake_TEST_UseSWIG "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_debian12_ninja_common.cmake b/.gitlab/ci/configure_debian12_ninja_common.cmake
index d4d117b..98ae771 100644
--- a/.gitlab/ci/configure_debian12_ninja_common.cmake
+++ b/.gitlab/ci/configure_debian12_ninja_common.cmake
@@ -1,3 +1,6 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
set(CMake_TEST_CTestUpdate_BZR "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_CVS "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_GIT "ON" CACHE BOOL "")
@@ -8,6 +11,7 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
endif()
set(CMake_TEST_FindALSA "ON" CACHE BOOL "")
+set(CMake_TEST_FindBacktrace "ON" CACHE BOOL "")
set(CMake_TEST_FindBLAS "All;static=1;Generic" CACHE STRING "")
set(CMake_TEST_FindBoost "ON" CACHE BOOL "")
set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "")
@@ -65,6 +69,9 @@ set(CMake_TEST_FindMPI_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindMPI "ON" CACHE BOOL "")
set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
@@ -90,6 +97,8 @@ set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "")
set(CMake_TEST_FindX11 "ON" CACHE BOOL "")
set(CMake_TEST_FindXalanC "ON" CACHE BOOL "")
set(CMake_TEST_FindXercesC "ON" CACHE BOOL "")
+
+set(CMake_TEST_ELF_LARGE "ON" CACHE BOOL "")
set(CMake_TEST_Fortran_SUBMODULES "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
@@ -97,6 +106,7 @@ set(CMake_TEST_IPO_WORKS_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "")
set(CMake_TEST_Qt5 "ON" CACHE BOOL "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
if (NOT "$ENV{SWIFTC}" STREQUAL "")
set(CMAKE_Swift_COMPILER "$ENV{SWIFTC}" CACHE FILEPATH "")
diff --git a/.gitlab/ci/configure_fedora39_clang_analyzer.cmake b/.gitlab/ci/configure_fedora39_clang_analyzer.cmake
deleted file mode 100644
index 1bfb3fb..0000000
--- a/.gitlab/ci/configure_fedora39_clang_analyzer.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(configure_no_sccache 1)
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
diff --git a/.gitlab/ci/configure_fedora39_common_clang.cmake b/.gitlab/ci/configure_fedora39_common_clang.cmake
deleted file mode 100644
index 1b3835a..0000000
--- a/.gitlab/ci/configure_fedora39_common_clang.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-set(CMAKE_Fortran_COMPILER "/usr/bin/flang-new" CACHE FILEPATH "")
-set(CMAKE_Fortran_COMPILER_ID "LLVMFlang" CACHE STRING "")
-set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 "1" CACHE BOOL "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_fedora39_asan.cmake b/.gitlab/ci/configure_fedora40_asan.cmake
index 872517c..ccdba4e 100644
--- a/.gitlab/ci/configure_fedora39_asan.cmake
+++ b/.gitlab/ci/configure_fedora40_asan.cmake
@@ -1,4 +1,4 @@
set(CMAKE_C_FLAGS "-fsanitize=address" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-fsanitize=address" CACHE STRING "")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common.cmake")
diff --git a/.gitlab/ci/configure_fedora40_clang_analyzer.cmake b/.gitlab/ci/configure_fedora40_clang_analyzer.cmake
new file mode 100644
index 0000000..c210126
--- /dev/null
+++ b/.gitlab/ci/configure_fedora40_clang_analyzer.cmake
@@ -0,0 +1,3 @@
+set(configure_no_sccache 1)
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common.cmake")
diff --git a/.gitlab/ci/configure_fedora39_common.cmake b/.gitlab/ci/configure_fedora40_common.cmake
index 4484e26..4484e26 100644
--- a/.gitlab/ci/configure_fedora39_common.cmake
+++ b/.gitlab/ci/configure_fedora40_common.cmake
diff --git a/.gitlab/ci/configure_fedora40_common_clang.cmake b/.gitlab/ci/configure_fedora40_common_clang.cmake
new file mode 100644
index 0000000..a4ae3f3
--- /dev/null
+++ b/.gitlab/ci/configure_fedora40_common_clang.cmake
@@ -0,0 +1,17 @@
+set(CMAKE_Fortran_COMPILER "/usr/bin/flang-new" CACHE FILEPATH "")
+set(CMAKE_Fortran_COMPILER_ID "LLVMFlang" CACHE STRING "")
+set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 "1" CACHE BOOL "")
+
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23;26" CACHE STRING "")
+
+set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_Fortran "OFF" CACHE BOOL "") # flang-new fails producing LLVM IR
+set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP_Fortran "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
+
+include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_fedora39_extdeps.cmake b/.gitlab/ci/configure_fedora40_extdeps.cmake
index 8e545f5..8e545f5 100644
--- a/.gitlab/ci/configure_fedora39_extdeps.cmake
+++ b/.gitlab/ci/configure_fedora40_extdeps.cmake
diff --git a/.gitlab/ci/configure_fedora39_makefiles.cmake b/.gitlab/ci/configure_fedora40_makefiles.cmake
index 953b2a8..478ba11 100644
--- a/.gitlab/ci/configure_fedora39_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora40_makefiles.cmake
@@ -1,3 +1,6 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23;26" CACHE STRING "")
+
set(CMake_TEST_CTestUpdate_BZR "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_GIT "ON" CACHE BOOL "")
set(CMake_TEST_CTestUpdate_HG "ON" CACHE BOOL "")
@@ -6,7 +9,9 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_CTestUpdate_P4 "ON" CACHE BOOL "")
endif()
+set(CMake_TEST_ASM_NASM "ON" CACHE BOOL "")
set(CMake_TEST_FindALSA "ON" CACHE BOOL "")
+set(CMake_TEST_FindBacktrace "ON" CACHE BOOL "")
set(CMake_TEST_FindBLAS "All;static=1;Generic" CACHE STRING "")
set(CMake_TEST_FindBoost "ON" CACHE BOOL "")
set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "")
@@ -44,6 +49,7 @@ set(CMake_TEST_FindIconv "ON" CACHE BOOL "")
set(CMake_TEST_FindICU "ON" CACHE BOOL "")
set(CMake_TEST_FindImageMagick "ON" CACHE BOOL "")
set(CMake_TEST_FindIntl "ON" CACHE BOOL "")
+set(CMake_TEST_FindJasper "ON" CACHE BOOL "")
set(CMake_TEST_FindJNI "ON" CACHE BOOL "")
set(CMake_TEST_FindJPEG "ON" CACHE BOOL "")
set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "")
@@ -61,6 +67,9 @@ set(CMake_TEST_FindMPI_ENVMOD "PATH=path_list_prepend:/usr/lib64/mpich/bin;LD_LI
set(CMake_TEST_FindMPI "ON" CACHE BOOL "")
set(CMake_TEST_FindODBC "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenACC "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_C "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_CXX "ON" CACHE BOOL "")
+set(CMake_TEST_FindOpenACC_Fortran "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenGL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
@@ -89,6 +98,8 @@ set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "")
set(CMake_TEST_FindX11 "ON" CACHE BOOL "")
set(CMake_TEST_FindXalanC "ON" CACHE BOOL "")
set(CMake_TEST_FindXercesC "ON" CACHE BOOL "")
+
+set(CMake_TEST_ELF_LARGE "ON" CACHE BOOL "")
set(CMake_TEST_Fortran_SUBMODULES "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_C "ON" CACHE BOOL "")
set(CMake_TEST_IPO_WORKS_CXX "ON" CACHE BOOL "")
@@ -98,6 +109,7 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
endif()
set(CMake_TEST_Qt5 "ON" CACHE BOOL "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
set(CMake_TEST_UseSWIG "ON" CACHE BOOL "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_fedora39_makefiles_clang.cmake b/.gitlab/ci/configure_fedora40_makefiles_clang.cmake
index a85ae70..d5739c3 100644
--- a/.gitlab/ci/configure_fedora39_makefiles_clang.cmake
+++ b/.gitlab/ci/configure_fedora40_makefiles_clang.cmake
@@ -2,4 +2,4 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "")
endif()
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common_clang.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common_clang.cmake")
diff --git a/.gitlab/ci/configure_fedora39_makefiles_symlinked.cmake b/.gitlab/ci/configure_fedora40_makefiles_symlinked.cmake
index b53ab66..6a677fd 100644
--- a/.gitlab/ci/configure_fedora39_makefiles_symlinked.cmake
+++ b/.gitlab/ci/configure_fedora40_makefiles_symlinked.cmake
@@ -1,2 +1,2 @@
include("${CMAKE_CURRENT_LIST_DIR}/configure_symlinked_common.cmake")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common.cmake")
diff --git a/.gitlab/ci/configure_fedora39_ninja.cmake b/.gitlab/ci/configure_fedora40_ninja.cmake
index ff233a3..b16e928 100644
--- a/.gitlab/ci/configure_fedora39_ninja.cmake
+++ b/.gitlab/ci/configure_fedora40_ninja.cmake
@@ -2,7 +2,9 @@ set(CMake_TEST_GUI "ON" CACHE BOOL "")
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
endif()
+set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,shared,bmionly" CACHE STRING "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
# "Release" flags without "-DNDEBUG" so we get assertions.
set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
@@ -11,4 +13,4 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
# Cover compilation with C++11 only and not higher standards.
set(CMAKE_CXX_STANDARD "11" CACHE STRING "")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common.cmake")
diff --git a/.gitlab/ci/configure_fedora39_ninja_multi_clang.cmake b/.gitlab/ci/configure_fedora40_ninja_clang.cmake
index 79d3eaa..c760603 100644
--- a/.gitlab/ci/configure_fedora39_ninja_multi_clang.cmake
+++ b/.gitlab/ci/configure_fedora40_ninja_clang.cmake
@@ -1,3 +1,3 @@
set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,shared,bmionly" CACHE STRING "")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common_clang.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common_clang.cmake")
diff --git a/.gitlab/ci/configure_fedora39_ninja_multi.cmake b/.gitlab/ci/configure_fedora40_ninja_multi.cmake
index 94af721..f77606e 100644
--- a/.gitlab/ci/configure_fedora39_ninja_multi.cmake
+++ b/.gitlab/ci/configure_fedora40_ninja_multi.cmake
@@ -1,5 +1,6 @@
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
endif()
+set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,shared,bmionly" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_fedora39_ninja_clang.cmake b/.gitlab/ci/configure_fedora40_ninja_multi_clang.cmake
index 79d3eaa..c760603 100644
--- a/.gitlab/ci/configure_fedora39_ninja_clang.cmake
+++ b/.gitlab/ci/configure_fedora40_ninja_multi_clang.cmake
@@ -1,3 +1,3 @@
set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,shared,bmionly" CACHE STRING "")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common_clang.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common_clang.cmake")
diff --git a/.gitlab/ci/configure_fedora39_sphinx.cmake b/.gitlab/ci/configure_fedora40_sphinx.cmake
index 90d159b..90d159b 100644
--- a/.gitlab/ci/configure_fedora39_sphinx.cmake
+++ b/.gitlab/ci/configure_fedora40_sphinx.cmake
diff --git a/.gitlab/ci/configure_fedora39_sphinx_package.cmake b/.gitlab/ci/configure_fedora40_sphinx_package.cmake
index e839de8..e839de8 100644
--- a/.gitlab/ci/configure_fedora39_sphinx_package.cmake
+++ b/.gitlab/ci/configure_fedora40_sphinx_package.cmake
diff --git a/.gitlab/ci/configure_fedora39_tidy.cmake b/.gitlab/ci/configure_fedora40_tidy.cmake
index 7a3eaa6..037732c 100644
--- a/.gitlab/ci/configure_fedora39_tidy.cmake
+++ b/.gitlab/ci/configure_fedora40_tidy.cmake
@@ -3,4 +3,4 @@ set(CMake_USE_CLANG_TIDY_MODULE ON CACHE BOOL "")
set(CMake_CLANG_TIDY_MODULE "$ENV{CI_PROJECT_DIR}/Utilities/ClangTidyModule/build/libcmake-clang-tidy-module.so" CACHE FILEPATH "")
set(CMake_CLANG_TIDY_EXPORT_FIXES_DIR "$ENV{CI_PROJECT_DIR}/.gitlab/clang-tidy-fixes" CACHE PATH "")
-include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora39_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora40_common.cmake")
diff --git a/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake b/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake
deleted file mode 100644
index f0ba9eb..0000000
--- a/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,bmionly" CACHE STRING "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja_multi.cmake b/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja_multi.cmake
deleted file mode 100644
index f0ba9eb..0000000
--- a/.gitlab/ci/configure_linux_gcc_cxx_modules_ninja_multi.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,export_bmi,install_bmi,bmionly" CACHE STRING "")
-
-include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_macos_arm64_ninja.cmake b/.gitlab/ci/configure_macos_arm64_ninja.cmake
index f2068a1..672f5d4 100644
--- a/.gitlab/ci/configure_macos_arm64_ninja.cmake
+++ b/.gitlab/ci/configure_macos_arm64_ninja.cmake
@@ -1,8 +1,13 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
set(CMake_TEST_GUI "ON" CACHE BOOL "")
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
+
include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_macos_x86_64_makefiles.cmake b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
index 5d1620d..f0bf1c0 100644
--- a/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
+++ b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake
@@ -7,6 +7,7 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
endif()
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_macos_x86_64_ninja.cmake b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
index 5d1620d..8fdaba8 100644
--- a/.gitlab/ci/configure_macos_x86_64_ninja.cmake
+++ b/.gitlab/ci/configure_macos_x86_64_ninja.cmake
@@ -1,3 +1,6 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
@@ -7,6 +10,7 @@ if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
endif()
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.3" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_windows_arm64_vs2022_ninja.cmake b/.gitlab/ci/configure_windows_arm64_vs2022_ninja.cmake
index a12ee6c..cd9780b 100644
--- a/.gitlab/ci/configure_windows_arm64_vs2022_ninja.cmake
+++ b/.gitlab/ci/configure_windows_arm64_vs2022_ninja.cmake
@@ -1,8 +1,11 @@
# Qt host tools are not yet available natively on windows-arm64.
set(CMake_TEST_GUI "OFF" CACHE BOOL "")
-set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
set(BUILD_QtDialog "OFF" CACHE BOOL "")
set(CMAKE_PREFIX_PATH "" CACHE STRING "")
+set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.2" CACHE STRING "")
+
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_cxx_modules_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_wix_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common_ninja.cmake")
diff --git a/.gitlab/ci/configure_windows_clang_common.cmake b/.gitlab/ci/configure_windows_clang_common.cmake
index 3d93aae..89d0c9c 100644
--- a/.gitlab/ci/configure_windows_clang_common.cmake
+++ b/.gitlab/ci/configure_windows_clang_common.cmake
@@ -1,3 +1,12 @@
+if("$ENV{CMAKE_CI_BUILD_NAME}" MATCHES "(^|_)gnu(_|$)")
+ set(CMake_TEST_C_STANDARDS "90;99;11;17;23" CACHE STRING "")
+ set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23;26" CACHE STRING "")
+else()
+ # FIXME: Implement C23 and C++23 support for clang-cl.
+ set(CMake_TEST_C_STANDARDS "90;99;11;17" CACHE STRING "")
+ set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20" CACHE STRING "")
+endif()
+
set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "")
set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_windows_i386_package.cmake b/.gitlab/ci/configure_windows_i386_package.cmake
index 65e1dcb..c80ebcc 100644
--- a/.gitlab/ci/configure_windows_i386_package.cmake
+++ b/.gitlab/ci/configure_windows_i386_package.cmake
@@ -1,6 +1,9 @@
# CPack package file name component for this platform.
set(CPACK_SYSTEM_NAME "windows-i386" CACHE STRING "")
+# Tell WiX to package for this architecture.
+set(CPACK_WIX_ARCHITECTURE "x86" CACHE STRING "")
+
# Use APIs from at most Windows 7
set(CMAKE_C_FLAGS "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-GR -EHsc -D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000" CACHE STRING "")
diff --git a/.gitlab/ci/configure_windows_msvc_common.cmake b/.gitlab/ci/configure_windows_msvc_common.cmake
index 6d66a05..946eca7 100644
--- a/.gitlab/ci/configure_windows_msvc_common.cmake
+++ b/.gitlab/ci/configure_windows_msvc_common.cmake
@@ -1,2 +1,4 @@
+set(CMake_TEST_Java OFF CACHE BOOL "")
+
set(configure_no_sccache 1)
include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake")
diff --git a/.gitlab/ci/configure_windows_msvc_cxx_modules_common.cmake b/.gitlab/ci/configure_windows_msvc_cxx_modules_common.cmake
index e378d62..207f2a5 100644
--- a/.gitlab/ci/configure_windows_msvc_cxx_modules_common.cmake
+++ b/.gitlab/ci/configure_windows_msvc_cxx_modules_common.cmake
@@ -1 +1 @@
-set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,shared,export_bmi,install_bmi,bmionly" CACHE STRING "")
+set(CMake_TEST_MODULE_COMPILATION "named,compile_commands,collation,partitions,internal_partitions,shared,export_bmi,install_bmi,bmionly,import_std23" CACHE STRING "")
diff --git a/.gitlab/ci/configure_windows_package_common.cmake b/.gitlab/ci/configure_windows_package_common.cmake
index 541a541..11bfad5 100644
--- a/.gitlab/ci/configure_windows_package_common.cmake
+++ b/.gitlab/ci/configure_windows_package_common.cmake
@@ -19,6 +19,8 @@ set(CMake_TEST_Qt5 OFF CACHE BOOL "")
set(CMake_TEST_Qt6 OFF CACHE BOOL "")
set(Python_FIND_REGISTRY NEVER CACHE STRING "")
+set(CMake_BUILD_WIX_CUSTOM_ACTION ON CACHE BOOL "")
+
set(CMake_CPACK_CUSTOM_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/CMakeCPack.cmake" CACHE FILEPATH "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2019_x64.cmake b/.gitlab/ci/configure_windows_vs2019_x64.cmake
index b859525..e4795b9 100644
--- a/.gitlab/ci/configure_windows_vs2019_x64.cmake
+++ b/.gitlab/ci/configure_windows_vs2019_x64.cmake
@@ -1,4 +1,5 @@
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
+ set(CMake_TEST_ANDROID_VS16 ON CACHE BOOL "")
set(CMAKE_TESTS_CDASH_SERVER "https://open.cdash.org" CACHE STRING "")
endif()
diff --git a/.gitlab/ci/configure_windows_vs2022_x64.cmake b/.gitlab/ci/configure_windows_vs2022_x64.cmake
index 51ee514..c29a9ec 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64.cmake
@@ -1,3 +1,7 @@
+if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
+ set(CMake_TEST_ANDROID_VS17 ON CACHE BOOL "")
+endif()
+
set(CMake_TEST_MODULE_COMPILATION "named,partitions,internal_partitions,shared" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_cxx_modules_common.cmake")
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
index 54abf72..e449d80 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
@@ -1,8 +1,15 @@
+set(CMake_TEST_C_STANDARDS "90;99;11;17" CACHE STRING "")
+set(CMake_TEST_CXX_STANDARDS "98;11;14;17;20;23" CACHE STRING "")
+
if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
set(CMake_TEST_CPACK_INNOSETUP "ON" CACHE STRING "")
set(CMake_TEST_ISPC "ON" CACHE STRING "")
+ set(CMake_TEST_Swift "ON" CACHE STRING "")
endif()
+
set(CMake_TEST_TLS_VERIFY_URL "https://gitlab.kitware.com" CACHE STRING "")
+set(CMake_TEST_TLS_VERSION "1.2" CACHE STRING "")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_msvc_cxx_modules_common.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_wix_common.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_vs_common_ninja.cmake")
diff --git a/.gitlab/ci/configure_windows_wix_common.cmake b/.gitlab/ci/configure_windows_wix_common.cmake
new file mode 100644
index 0000000..4219c41
--- /dev/null
+++ b/.gitlab/ci/configure_windows_wix_common.cmake
@@ -0,0 +1,5 @@
+get_filename_component(wix3_dir "${CMAKE_CURRENT_LIST_DIR}/../wix3" ABSOLUTE)
+set(CMake_TEST_CPACK_WIX3 "${wix3_dir}" CACHE PATH "")
+
+get_filename_component(wix4_dir "${CMAKE_CURRENT_LIST_DIR}/../wix4" ABSOLUTE)
+set(CMake_TEST_CPACK_WIX4 "${wix4_dir}" CACHE PATH "")
diff --git a/.gitlab/ci/configure_windows_x86_64_package.cmake b/.gitlab/ci/configure_windows_x86_64_package.cmake
index 3a141a7..051e3fc 100644
--- a/.gitlab/ci/configure_windows_x86_64_package.cmake
+++ b/.gitlab/ci/configure_windows_x86_64_package.cmake
@@ -1,6 +1,9 @@
# CPack package file name component for this platform.
set(CPACK_SYSTEM_NAME "windows-x86_64" CACHE STRING "")
+# Tell WiX to package for this architecture.
+set(CPACK_WIX_ARCHITECTURE "x64" CACHE STRING "")
+
# Use APIs from at most Windows 7
set(CMAKE_C_FLAGS "-D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000" CACHE STRING "")
set(CMAKE_CXX_FLAGS "-GR -EHsc -D_WIN32_WINNT=0x601 -DNTDDI_VERSION=0x06010000" CACHE STRING "")
diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake
index a2789c3..ed5e1dd 100644
--- a/.gitlab/ci/ctest_exclusions.cmake
+++ b/.gitlab/ci/ctest_exclusions.cmake
@@ -34,6 +34,13 @@ if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "nvhpc_")
)
endif()
+if ("$ENV{CMAKE_CONFIGURATION}" STREQUAL "windows_vs2022_x64_ninja")
+ list(APPEND test_exclusions
+ # FIXME(#25573): This test failure needs further investigation.
+ "^SwiftMixLib$"
+ )
+endif()
+
string(REPLACE ";" "|" test_exclusions "${test_exclusions}")
if (test_exclusions)
set(test_exclusions "(${test_exclusions})")
diff --git a/.gitlab/ci/ctest_memcheck_fedora39_asan.lsan.supp b/.gitlab/ci/ctest_memcheck_fedora40_asan.lsan.supp
index 8ec1a03..8ec1a03 100644
--- a/.gitlab/ci/ctest_memcheck_fedora39_asan.lsan.supp
+++ b/.gitlab/ci/ctest_memcheck_fedora40_asan.lsan.supp
diff --git a/.gitlab/ci/docker/cuda12.2/Dockerfile b/.gitlab/ci/docker/cuda12.2/Dockerfile
new file mode 100644
index 0000000..e46f228
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.2/Dockerfile
@@ -0,0 +1,9 @@
+FROM kitware/nvidia-cuda:12.2.2-devel-ubuntu22.04
+MAINTAINER Brad King <brad.king@kitware.com>
+
+COPY llvm.list /etc/apt/sources.list.d/llvm.list
+COPY llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key
+RUN apt-key add /root/llvm-snapshot.gpg.key
+
+COPY install_deps.sh /root/install_deps.sh
+RUN sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/cuda12.2/install_deps.sh b/.gitlab/ci/docker/cuda12.2/install_deps.sh
new file mode 100755
index 0000000..94fbd98
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.2/install_deps.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+set -e
+
+apt-get update
+
+# Install dependency without interaction.
+env DEBIAN_FRONTEND=noninteractive \
+ TZ=America/New_York \
+ apt-get install -y \
+ tzdata
+
+# Install development tools.
+apt-get install -y \
+ g++ \
+ clang-18 \
+ curl \
+ git
+
+apt-get clean
diff --git a/.gitlab/ci/docker/cuda12.2/llvm-snapshot.gpg.key b/.gitlab/ci/docker/cuda12.2/llvm-snapshot.gpg.key
new file mode 100644
index 0000000..aa6b105
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.2/llvm-snapshot.gpg.key
@@ -0,0 +1,52 @@
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.12 (GNU/Linux)
+
+mQINBFE9lCwBEADi0WUAApM/mgHJRU8lVkkw0CHsZNpqaQDNaHefD6Rw3S4LxNmM
+EZaOTkhP200XZM8lVdbfUW9xSjA3oPldc1HG26NjbqqCmWpdo2fb+r7VmU2dq3NM
+R18ZlKixiLDE6OUfaXWKamZsXb6ITTYmgTO6orQWYrnW6ckYHSeaAkW0wkDAryl2
+B5v8aoFnQ1rFiVEMo4NGzw4UX+MelF7rxaaregmKVTPiqCOSPJ1McC1dHFN533FY
+Wh/RVLKWo6npu+owtwYFQW+zyQhKzSIMvNujFRzhIxzxR9Gn87MoLAyfgKEzrbbT
+DhqqNXTxS4UMUKCQaO93TzetX/EBrRpJj+vP640yio80h4Dr5pAd7+LnKwgpTDk1
+G88bBXJAcPZnTSKu9I2c6KY4iRNbvRz4i+ZdwwZtdW4nSdl2792L7Sl7Nc44uLL/
+ZqkKDXEBF6lsX5XpABwyK89S/SbHOytXv9o4puv+65Ac5/UShspQTMSKGZgvDauU
+cs8kE1U9dPOqVNCYq9Nfwinkf6RxV1k1+gwtclxQuY7UpKXP0hNAXjAiA5KS5Crq
+7aaJg9q2F4bub0mNU6n7UI6vXguF2n4SEtzPRk6RP+4TiT3bZUsmr+1ktogyOJCc
+Ha8G5VdL+NBIYQthOcieYCBnTeIH7D3Sp6FYQTYtVbKFzmMK+36ERreL/wARAQAB
+tD1TeWx2ZXN0cmUgTGVkcnUgLSBEZWJpYW4gTExWTSBwYWNrYWdlcyA8c3lsdmVz
+dHJlQGRlYmlhbi5vcmc+iQI4BBMBAgAiBQJRPZQsAhsDBgsJCAcDAgYVCAIJCgsE
+FgIDAQIeAQIXgAAKCRAVz00Yr090Ibx+EADArS/hvkDF8juWMXxh17CgR0WZlHCC
+9CTBWkg5a0bNN/3bb97cPQt/vIKWjQtkQpav6/5JTVCSx2riL4FHYhH0iuo4iAPR
+udC7Cvg8g7bSPrKO6tenQZNvQm+tUmBHgFiMBJi92AjZ/Qn1Shg7p9ITivFxpLyX
+wpmnF1OKyI2Kof2rm4BFwfSWuf8Fvh7kDMRLHv+MlnK/7j/BNpKdozXxLcwoFBmn
+l0WjpAH3OFF7Pvm1LJdf1DjWKH0Dc3sc6zxtmBR/KHHg6kK4BGQNnFKujcP7TVdv
+gMYv84kun14pnwjZcqOtN3UJtcx22880DOQzinoMs3Q4w4o05oIF+sSgHViFpc3W
+R0v+RllnH05vKZo+LDzc83DQVrdwliV12eHxrMQ8UYg88zCbF/cHHnlzZWAJgftg
+hB08v1BKPgYRUzwJ6VdVqXYcZWEaUJmQAPuAALyZESw94hSo28FAn0/gzEc5uOYx
+K+xG/lFwgAGYNb3uGM5m0P6LVTfdg6vDwwOeTNIExVk3KVFXeSQef2ZMkhwA7wya
+KJptkb62wBHFE+o9TUdtMCY6qONxMMdwioRE5BYNwAsS1PnRD2+jtlI0DzvKHt7B
+MWd8hnoUKhMeZ9TNmo+8CpsAtXZcBho0zPGz/R8NlJhAWpdAZ1CmcPo83EW86Yq7
+BxQUKnNHcwj2ebkCDQRRPZQsARAA4jxYmbTHwmMjqSizlMJYNuGOpIidEdx9zQ5g
+zOr431/VfWq4S+VhMDhs15j9lyml0y4ok215VRFwrAREDg6UPMr7ajLmBQGau0Fc
+bvZJ90l4NjXp5p0NEE/qOb9UEHT7EGkEhaZ1ekkWFTWCgsy7rRXfZLxB6sk7pzLC
+DshyW3zjIakWAnpQ5j5obiDy708pReAuGB94NSyb1HoW/xGsGgvvCw4r0w3xPStw
+F1PhmScE6NTBIfLliea3pl8vhKPlCh54Hk7I8QGjo1ETlRP4Qll1ZxHJ8u25f/ta
+RES2Aw8Hi7j0EVcZ6MT9JWTI83yUcnUlZPZS2HyeWcUj+8nUC8W4N8An+aNps9l/
+21inIl2TbGo3Yn1JQLnA1YCoGwC34g8QZTJhElEQBN0X29ayWW6OdFx8MDvllbBV
+ymmKq2lK1U55mQTfDli7S3vfGz9Gp/oQwZ8bQpOeUkc5hbZszYwP4RX+68xDPfn+
+M9udl+qW9wu+LyePbW6HX90LmkhNkkY2ZzUPRPDHZANU5btaPXc2H7edX4y4maQa
+xenqD0lGh9LGz/mps4HEZtCI5CY8o0uCMF3lT0XfXhuLksr7Pxv57yue8LLTItOJ
+d9Hmzp9G97SRYYeqU+8lyNXtU2PdrLLq7QHkzrsloG78lCpQcalHGACJzrlUWVP/
+fN3Ht3kAEQEAAYkCHwQYAQIACQUCUT2ULAIbDAAKCRAVz00Yr090IbhWEADbr50X
+OEXMIMGRLe+YMjeMX9NG4jxs0jZaWHc/WrGR+CCSUb9r6aPXeLo+45949uEfdSsB
+pbaEdNWxF5Vr1CSjuO5siIlgDjmT655voXo67xVpEN4HhMrxugDJfCa6z97P0+ML
+PdDxim57uNqkam9XIq9hKQaurxMAECDPmlEXI4QT3eu5qw5/knMzDMZj4Vi6hovL
+wvvAeLHO/jsyfIdNmhBGU2RWCEZ9uo/MeerPHtRPfg74g+9PPfP6nyHD2Wes6yGd
+oVQwtPNAQD6Cj7EaA2xdZYLJ7/jW6yiPu98FFWP74FN2dlyEA2uVziLsfBrgpS4l
+tVOlrO2YzkkqUGrybzbLpj6eeHx+Cd7wcjI8CalsqtL6cG8cUEjtWQUHyTbQWAgG
+5VPEgIAVhJ6RTZ26i/G+4J8neKyRs4vz+57UGwY6zI4AB1ZcWGEE3Bf+CDEDgmnP
+LSwbnHefK9IljT9XU98PelSryUO/5UPw7leE0akXKB4DtekToO226px1VnGp3Bov
+1GBGvpHvL2WizEwdk+nfk8LtrLzej+9FtIcq3uIrYnsac47Pf7p0otcFeTJTjSq3
+krCaoG4Hx0zGQG2ZFpHrSrZTVy6lxvIdfi0beMgY6h78p6M9eYZHQHc02DjFkQXN
+bXb5c6gCHESH5PXwPU4jQEE7Ib9J6sbk7ZT2Mw==
+=j+4q
+-----END PGP PUBLIC KEY BLOCK-----
diff --git a/.gitlab/ci/docker/cuda12.2/llvm.list b/.gitlab/ci/docker/cuda12.2/llvm.list
new file mode 100644
index 0000000..350a712
--- /dev/null
+++ b/.gitlab/ci/docker/cuda12.2/llvm.list
@@ -0,0 +1,2 @@
+deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
+deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main
diff --git a/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
index a59f2c9..014c7ea 100644
--- a/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
+++ b/.gitlab/ci/docker/debian12-x86_64/deps_packages.lst
@@ -32,6 +32,9 @@ cvs
subversion
mercurial
+# Install ASM_NASM language toolchain.
+nasm
+
# Install HIP language toolchain.
hipcc
diff --git a/.gitlab/ci/docker/fedora39-hip/Dockerfile b/.gitlab/ci/docker/fedora39-hip/Dockerfile
new file mode 100644
index 0000000..0347cc4
--- /dev/null
+++ b/.gitlab/ci/docker/fedora39-hip/Dockerfile
@@ -0,0 +1,27 @@
+# syntax=docker/dockerfile:1
+
+ARG BASE_IMAGE=fedora:39
+
+FROM ${BASE_IMAGE} AS dnf-cache
+# Populate DNF cache w/ the fresh metadata and prefetch packages.
+RUN --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
+ --mount=type=tmpfs,target=/var/log \
+ --mount=type=tmpfs,target=/tmp \
+ dnf install \
+ --setopt=install_weak_deps=False \
+ --setopt=fastestmirror=True \
+ --setopt=max_parallel_downloads=10 \
+ --downloadonly \
+ -y \
+ $(grep -h '^[^#]\+$' /root/*.lst)
+
+FROM ${BASE_IMAGE}
+LABEL maintainer="Brad King <brad.king@kitware.com>"
+
+RUN --mount=type=bind,source=install_deps.sh,target=/root/install_deps.sh \
+ --mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
+ --mount=type=cache,from=dnf-cache,source=/var/cache/dnf,target=/var/cache/dnf,sharing=private \
+ --mount=type=cache,target=/var/cache/pip \
+ --mount=type=tmpfs,target=/var/log \
+ --mount=type=tmpfs,target=/tmp \
+ sh /root/install_deps.sh
diff --git a/.gitlab/ci/docker/fedora39-hip/deps_packages.lst b/.gitlab/ci/docker/fedora39-hip/deps_packages.lst
new file mode 100644
index 0000000..70b114c
--- /dev/null
+++ b/.gitlab/ci/docker/fedora39-hip/deps_packages.lst
@@ -0,0 +1,15 @@
+# Install development tools.
+clang
+clang-tools-extra
+compiler-rt
+gcc-c++
+git-core
+make
+
+# Install HIP language toolchain.
+hsakmt-devel
+lld
+llvm
+rocm-comgr-devel
+rocm-hip-devel
+rocm-runtime-devel
diff --git a/.gitlab/ci/docker/fedora39-hip/install_deps.sh b/.gitlab/ci/docker/fedora39-hip/install_deps.sh
new file mode 100755
index 0000000..eedff9c
--- /dev/null
+++ b/.gitlab/ci/docker/fedora39-hip/install_deps.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+dnf install \
+ --setopt=install_weak_deps=False \
+ --setopt=fastestmirror=True \
+ --setopt=max_parallel_downloads=10 \
+ -y \
+ $(grep '^[^#]\+$' /root/deps_packages.lst)
diff --git a/.gitlab/ci/docker/fedora39/Dockerfile b/.gitlab/ci/docker/fedora40/Dockerfile
index f14e017..896456c 100644
--- a/.gitlab/ci/docker/fedora39/Dockerfile
+++ b/.gitlab/ci/docker/fedora40/Dockerfile
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
-ARG BASE_IMAGE=fedora:39
+ARG BASE_IMAGE=fedora:40
FROM ${BASE_IMAGE} AS dnf-cache
# Populate DNF cache w/ the fresh metadata and prefetch packages.
diff --git a/.gitlab/ci/docker/fedora39/deps_packages.lst b/.gitlab/ci/docker/fedora40/deps_packages.lst
index 7656cbc..c7bad7c 100644
--- a/.gitlab/ci/docker/fedora39/deps_packages.lst
+++ b/.gitlab/ci/docker/fedora40/deps_packages.lst
@@ -11,7 +11,6 @@ clang-tools-extra
clang-tools-extra-devel
compiler-rt
flang
-flang-devel
gcc-c++
git-core
llvm-devel
@@ -32,6 +31,7 @@ zlib-devel
# Install documentation tools.
python3-sphinx
+python3-sphinxcontrib-qthelp
texinfo
qt5-qttools-devel
qt6-qttools-devel
@@ -46,12 +46,8 @@ file
jq
which
-# Install HIP language toolchain.
-hsakmt-devel
-lld
-rocm-comgr-devel
-rocm-hip-devel
-rocm-runtime-devel
+# Install ASM_NASM language toolchain.
+nasm
# Packages needed to test CTest.
breezy
@@ -87,6 +83,7 @@ hdf5-devel
hdf5-mpich-devel
hdf5-openmpi-devel
ImageMagick-c++-devel
+jasper-devel
java-11-openjdk-devel
jsoncpp-devel
lapack-devel
@@ -95,6 +92,7 @@ libcurl-devel
libicu-devel
libinput-devel systemd-devel
libjpeg-turbo-devel
+libomp-devel
libpng-devel
opensp-devel
postgresql-server-devel
@@ -122,3 +120,6 @@ wxGTK-devel
xalan-c-devel
xerces-c-devel
xz-devel
+
+# Packages needed to test third-party binaries.
+ncurses-compat-libs
diff --git a/.gitlab/ci/docker/fedora39/install_deps.sh b/.gitlab/ci/docker/fedora40/install_deps.sh
index 70e2293..70e2293 100755
--- a/.gitlab/ci/docker/fedora39/install_deps.sh
+++ b/.gitlab/ci/docker/fedora40/install_deps.sh
diff --git a/.gitlab/ci/docker/fedora39/install_iwyu.sh b/.gitlab/ci/docker/fedora40/install_iwyu.sh
index 684e355..50ed612 100755
--- a/.gitlab/ci/docker/fedora39/install_iwyu.sh
+++ b/.gitlab/ci/docker/fedora40/install_iwyu.sh
@@ -18,13 +18,13 @@ readonly llvm_version="$( echo "$llvm_full_version" | cut -d. -f-1 )"
git checkout "clang_$llvm_version"
git apply <<EOF
diff --git a/iwyu_driver.cc b/iwyu_driver.cc
-index 42fea35..fbb77a9 100644
+index dd4b046..cfd568a 100644
--- a/iwyu_driver.cc
+++ b/iwyu_driver.cc
-@@ -167,6 +167,7 @@ CompilerInstance* CreateCompilerInstance(int argc, const char **argv) {
- DiagnosticsEngine diagnostics(diagnostic_id, &*diagnostic_options,
- diagnostic_client);
- Driver driver(path, getDefaultTargetTriple(), diagnostics);
+@@ -249,6 +249,7 @@ bool ExecuteAction(int argc, const char** argv,
+ /*CodeGenOpts=*/nullptr);
+
+ Driver driver(path, getDefaultTargetTriple(), *diagnostics);
+ driver.ResourceDir = "/usr/lib64/clang/$llvm_full_version";
driver.setTitle("include what you use");
diff --git a/.gitlab/ci/docker/fedora39/install_rvm.sh b/.gitlab/ci/docker/fedora40/install_rvm.sh
index 10e7545..10e7545 100755
--- a/.gitlab/ci/docker/fedora39/install_rvm.sh
+++ b/.gitlab/ci/docker/fedora40/install_rvm.sh
diff --git a/.gitlab/ci/docker/fedora39/iwyu_packages.lst b/.gitlab/ci/docker/fedora40/iwyu_packages.lst
index e3551bd..e3551bd 100644
--- a/.gitlab/ci/docker/fedora39/iwyu_packages.lst
+++ b/.gitlab/ci/docker/fedora40/iwyu_packages.lst
diff --git a/.gitlab/ci/docker/fedora39/rvm_packages.lst b/.gitlab/ci/docker/fedora40/rvm_packages.lst
index 1dc852e..1dc852e 100644
--- a/.gitlab/ci/docker/fedora39/rvm_packages.lst
+++ b/.gitlab/ci/docker/fedora40/rvm_packages.lst
diff --git a/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile b/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile
deleted file mode 100644
index d8e8238..0000000
--- a/.gitlab/ci/docker/gcc_cxx_modules/Dockerfile
+++ /dev/null
@@ -1,9 +0,0 @@
-FROM fedora:38
-MAINTAINER Ben Boeckel <ben.boeckel@kitware.com>
-
-# Install build dependencies for packages.
-COPY install_deps.sh /root/install_deps.sh
-RUN sh /root/install_deps.sh
-
-COPY install_gcc.sh /root/install_gcc.sh
-RUN sh /root/install_gcc.sh
diff --git a/.gitlab/ci/docker/gcc_cxx_modules/install_deps.sh b/.gitlab/ci/docker/gcc_cxx_modules/install_deps.sh
deleted file mode 100755
index b8b706b..0000000
--- a/.gitlab/ci/docker/gcc_cxx_modules/install_deps.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-set -e
-
-dnf install -y --setopt=install_weak_deps=False \
- gcc-c++ mpfr-devel libmpc-devel isl-devel flex bison file findutils diffutils git-core
-dnf clean all
diff --git a/.gitlab/ci/docker/gcc_cxx_modules/install_gcc.sh b/.gitlab/ci/docker/gcc_cxx_modules/install_gcc.sh
deleted file mode 100755
index 15cfe39..0000000
--- a/.gitlab/ci/docker/gcc_cxx_modules/install_gcc.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-set -e
-
-readonly revision="29862e21f6d656eca59284c927d0c4c0698eb99c" # master as of 21 Sep 2023
-readonly tarball="git://gcc.gnu.org/git/gcc.git"
-
-readonly workdir="$HOME/gcc"
-readonly srcdir="$workdir/gcc"
-readonly builddir="$workdir/build"
-readonly njobs="$( nproc )"
-
-mkdir -p "$workdir"
-cd "$workdir"
-git clone "$tarball" "$srcdir"
-git -C "$srcdir" checkout "$revision"
-mkdir -p "$builddir"
-cd "$builddir"
-"$srcdir/configure" \
- --disable-multilib \
- --enable-languages=c,c++ \
- --prefix="/opt/gcc-p1689"
-make "-j$njobs"
-make "-j$njobs" install-strip
-rm -rf "$workdir"
diff --git a/.gitlab/ci/env.ps1 b/.gitlab/ci/env.ps1
index 72a8cb8..754521b 100755..100644
--- a/.gitlab/ci/env.ps1
+++ b/.gitlab/ci/env.ps1
@@ -1,4 +1,12 @@
$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
+
+# Place temporary files inside job directory.
+$tmp = New-Item -Force -ItemType Directory -Path "$pwd\.gitlab\tmp"
+$tmp = (New-Object -ComObject Scripting.FileSystemObject).GetFolder("$tmp").ShortPath
+Set-Item -Force -Path "env:TEMP" -Value "$tmp"
+Set-Item -Force -Path "env:TMP" -Value "$tmp"
+$tmp = $null
+
if (Test-Path -Path ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
. ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1"
}
diff --git a/.gitlab/ci/env_cuda12.2_clang.sh b/.gitlab/ci/env_cuda12.2_clang.sh
new file mode 100644
index 0000000..4b71b42
--- /dev/null
+++ b/.gitlab/ci/env_cuda12.2_clang.sh
@@ -0,0 +1,3 @@
+export CC=/usr/bin/clang-18
+export CXX=/usr/bin/clang++-18
+export CUDACXX=/usr/bin/clang++-18
diff --git a/.gitlab/ci/env_fedora39_common_clang.sh b/.gitlab/ci/env_fedora39_common_clang.sh
deleted file mode 100644
index 076669b..0000000
--- a/.gitlab/ci/env_fedora39_common_clang.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-export CC=/usr/bin/clang-17
-export CXX=/usr/bin/clang++-17
-export FC=/usr/bin/flang-new
diff --git a/.gitlab/ci/env_fedora39_makefiles_clang.sh b/.gitlab/ci/env_fedora39_makefiles_clang.sh
deleted file mode 100644
index 6200f82..0000000
--- a/.gitlab/ci/env_fedora39_makefiles_clang.sh
+++ /dev/null
@@ -1 +0,0 @@
-. .gitlab/ci/env_fedora39_common_clang.sh
diff --git a/.gitlab/ci/env_fedora39_makefiles_symlinked.cmake b/.gitlab/ci/env_fedora39_makefiles_symlinked.cmake
deleted file mode 100644
index 052e9a7..0000000
--- a/.gitlab/ci/env_fedora39_makefiles_symlinked.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include("${CMAKE_CURRENT_LIST_DIR}/env_fedora39_makefiles.cmake")
diff --git a/.gitlab/ci/env_fedora39_makefiles_symlinked.sh b/.gitlab/ci/env_fedora39_makefiles_symlinked.sh
deleted file mode 100644
index 39ac189..0000000
--- a/.gitlab/ci/env_fedora39_makefiles_symlinked.sh
+++ /dev/null
@@ -1 +0,0 @@
-. .gitlab/ci/env_fedora39_makefiles.sh
diff --git a/.gitlab/ci/env_fedora39_ninja_clang.sh b/.gitlab/ci/env_fedora39_ninja_clang.sh
deleted file mode 100644
index 6200f82..0000000
--- a/.gitlab/ci/env_fedora39_ninja_clang.sh
+++ /dev/null
@@ -1 +0,0 @@
-. .gitlab/ci/env_fedora39_common_clang.sh
diff --git a/.gitlab/ci/env_fedora39_ninja_multi_clang.sh b/.gitlab/ci/env_fedora39_ninja_multi_clang.sh
deleted file mode 100644
index 6200f82..0000000
--- a/.gitlab/ci/env_fedora39_ninja_multi_clang.sh
+++ /dev/null
@@ -1 +0,0 @@
-. .gitlab/ci/env_fedora39_common_clang.sh
diff --git a/.gitlab/ci/env_fedora39_asan.sh b/.gitlab/ci/env_fedora40_asan.sh
index e976486..e976486 100644
--- a/.gitlab/ci/env_fedora39_asan.sh
+++ b/.gitlab/ci/env_fedora40_asan.sh
diff --git a/.gitlab/ci/env_fedora39_clang_analyzer.sh b/.gitlab/ci/env_fedora40_clang_analyzer.sh
index d732c0b..d732c0b 100644
--- a/.gitlab/ci/env_fedora39_clang_analyzer.sh
+++ b/.gitlab/ci/env_fedora40_clang_analyzer.sh
diff --git a/.gitlab/ci/env_fedora40_common_clang.sh b/.gitlab/ci/env_fedora40_common_clang.sh
new file mode 100644
index 0000000..a3861d0
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_common_clang.sh
@@ -0,0 +1,3 @@
+export CC=/usr/bin/clang-18
+export CXX=/usr/bin/clang++-18
+export FC=/usr/bin/flang-new
diff --git a/.gitlab/ci/env_fedora39_extdeps.sh b/.gitlab/ci/env_fedora40_extdeps.sh
index 7076e18..7076e18 100644
--- a/.gitlab/ci/env_fedora39_extdeps.sh
+++ b/.gitlab/ci/env_fedora40_extdeps.sh
diff --git a/.gitlab/ci/env_fedora39_makefiles.cmake b/.gitlab/ci/env_fedora40_makefiles.cmake
index ef13cda..ef13cda 100644
--- a/.gitlab/ci/env_fedora39_makefiles.cmake
+++ b/.gitlab/ci/env_fedora40_makefiles.cmake
diff --git a/.gitlab/ci/env_fedora39_makefiles.sh b/.gitlab/ci/env_fedora40_makefiles.sh
index c482642..c482642 100644
--- a/.gitlab/ci/env_fedora39_makefiles.sh
+++ b/.gitlab/ci/env_fedora40_makefiles.sh
diff --git a/.gitlab/ci/env_fedora40_makefiles_clang.sh b/.gitlab/ci/env_fedora40_makefiles_clang.sh
new file mode 100644
index 0000000..2021086
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_makefiles_clang.sh
@@ -0,0 +1 @@
+. .gitlab/ci/env_fedora40_common_clang.sh
diff --git a/.gitlab/ci/env_fedora40_makefiles_symlinked.cmake b/.gitlab/ci/env_fedora40_makefiles_symlinked.cmake
new file mode 100644
index 0000000..d381807
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_makefiles_symlinked.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/env_fedora40_makefiles.cmake")
diff --git a/.gitlab/ci/env_fedora40_makefiles_symlinked.sh b/.gitlab/ci/env_fedora40_makefiles_symlinked.sh
new file mode 100644
index 0000000..5a7584a
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_makefiles_symlinked.sh
@@ -0,0 +1 @@
+. .gitlab/ci/env_fedora40_makefiles.sh
diff --git a/.gitlab/ci/env_fedora39_ninja_multi.sh b/.gitlab/ci/env_fedora40_ninja.sh
index 217ff30..217ff30 100644
--- a/.gitlab/ci/env_fedora39_ninja_multi.sh
+++ b/.gitlab/ci/env_fedora40_ninja.sh
diff --git a/.gitlab/ci/env_fedora40_ninja_clang.sh b/.gitlab/ci/env_fedora40_ninja_clang.sh
new file mode 100644
index 0000000..2021086
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_ninja_clang.sh
@@ -0,0 +1 @@
+. .gitlab/ci/env_fedora40_common_clang.sh
diff --git a/.gitlab/ci/env_fedora39_ninja.sh b/.gitlab/ci/env_fedora40_ninja_multi.sh
index 217ff30..217ff30 100644
--- a/.gitlab/ci/env_fedora39_ninja.sh
+++ b/.gitlab/ci/env_fedora40_ninja_multi.sh
diff --git a/.gitlab/ci/env_fedora40_ninja_multi_clang.sh b/.gitlab/ci/env_fedora40_ninja_multi_clang.sh
new file mode 100644
index 0000000..2021086
--- /dev/null
+++ b/.gitlab/ci/env_fedora40_ninja_multi_clang.sh
@@ -0,0 +1 @@
+. .gitlab/ci/env_fedora40_common_clang.sh
diff --git a/.gitlab/ci/env_mingw_osdn_io_mingw_makefiles.ps1 b/.gitlab/ci/env_mingw_osdn_io_mingw_makefiles.ps1
index f6e1f0a..f6e1f0a 100755..100644
--- a/.gitlab/ci/env_mingw_osdn_io_mingw_makefiles.ps1
+++ b/.gitlab/ci/env_mingw_osdn_io_mingw_makefiles.ps1
diff --git a/.gitlab/ci/env_mingw_osdn_io_msys_makefiles.ps1 b/.gitlab/ci/env_mingw_osdn_io_msys_makefiles.ps1
index f6e1f0a..f6e1f0a 100755..100644
--- a/.gitlab/ci/env_mingw_osdn_io_msys_makefiles.ps1
+++ b/.gitlab/ci/env_mingw_osdn_io_msys_makefiles.ps1
diff --git a/.gitlab/ci/env_windows_arm64_package.ps1 b/.gitlab/ci/env_windows_arm64_package.ps1
new file mode 100644
index 0000000..a898007
--- /dev/null
+++ b/.gitlab/ci/env_windows_arm64_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/wix3-env.ps1
diff --git a/.gitlab/ci/env_windows_arm64_vs2022_ninja.ps1 b/.gitlab/ci/env_windows_arm64_vs2022_ninja.ps1
new file mode 100644
index 0000000..eb7bf6e
--- /dev/null
+++ b/.gitlab/ci/env_windows_arm64_vs2022_ninja.ps1
@@ -0,0 +1,2 @@
+& "$pwsh" -File .gitlab/ci/wix3.ps1
+& "$pwsh" -File .gitlab/ci/wix4.ps1
diff --git a/.gitlab/ci/env_windows_borland5.5.ps1 b/.gitlab/ci/env_windows_borland5.5.ps1
index 0d2e46b..0d2e46b 100755..100644
--- a/.gitlab/ci/env_windows_borland5.5.ps1
+++ b/.gitlab/ci/env_windows_borland5.5.ps1
diff --git a/.gitlab/ci/env_windows_borland5.8.ps1 b/.gitlab/ci/env_windows_borland5.8.ps1
index 0d2e46b..0d2e46b 100755..100644
--- a/.gitlab/ci/env_windows_borland5.8.ps1
+++ b/.gitlab/ci/env_windows_borland5.8.ps1
diff --git a/.gitlab/ci/env_windows_clang_ninja.ps1 b/.gitlab/ci/env_windows_clang_ninja.ps1
index 17002ef..17002ef 100755..100644
--- a/.gitlab/ci/env_windows_clang_ninja.ps1
+++ b/.gitlab/ci/env_windows_clang_ninja.ps1
diff --git a/.gitlab/ci/env_windows_clang_nmake.ps1 b/.gitlab/ci/env_windows_clang_nmake.ps1
index 89fa360..89fa360 100755..100644
--- a/.gitlab/ci/env_windows_clang_nmake.ps1
+++ b/.gitlab/ci/env_windows_clang_nmake.ps1
diff --git a/.gitlab/ci/env_windows_i386_package.ps1 b/.gitlab/ci/env_windows_i386_package.ps1
new file mode 100644
index 0000000..a898007
--- /dev/null
+++ b/.gitlab/ci/env_windows_i386_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/wix3-env.ps1
diff --git a/.gitlab/ci/env_windows_intelclassic_ninja.ps1 b/.gitlab/ci/env_windows_intelclassic_ninja.ps1
index 99f83b9..99f83b9 100755..100644
--- a/.gitlab/ci/env_windows_intelclassic_ninja.ps1
+++ b/.gitlab/ci/env_windows_intelclassic_ninja.ps1
diff --git a/.gitlab/ci/env_windows_inteloneapi_ninja.ps1 b/.gitlab/ci/env_windows_inteloneapi_ninja.ps1
index 3bd1d46..3bd1d46 100755..100644
--- a/.gitlab/ci/env_windows_inteloneapi_ninja.ps1
+++ b/.gitlab/ci/env_windows_inteloneapi_ninja.ps1
diff --git a/.gitlab/ci/env_windows_msvc_v71_nmake.ps1 b/.gitlab/ci/env_windows_msvc_v71_nmake.ps1
index cb3806d..cb3806d 100755..100644
--- a/.gitlab/ci/env_windows_msvc_v71_nmake.ps1
+++ b/.gitlab/ci/env_windows_msvc_v71_nmake.ps1
diff --git a/.gitlab/ci/env_windows_openwatcom1.9.ps1 b/.gitlab/ci/env_windows_openwatcom1.9.ps1
index 49c28f7..49c28f7 100755..100644
--- a/.gitlab/ci/env_windows_openwatcom1.9.ps1
+++ b/.gitlab/ci/env_windows_openwatcom1.9.ps1
diff --git a/.gitlab/ci/env_windows_orangec6.73.1.ps1 b/.gitlab/ci/env_windows_orangec6.73.1.ps1
index 96e36a1..96e36a1 100755..100644
--- a/.gitlab/ci/env_windows_orangec6.73.1.ps1
+++ b/.gitlab/ci/env_windows_orangec6.73.1.ps1
diff --git a/.gitlab/ci/env_windows_vs2022_x64.ps1 b/.gitlab/ci/env_windows_vs2022_x64.ps1
index 42aec11..42aec11 100755..100644
--- a/.gitlab/ci/env_windows_vs2022_x64.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64.ps1
diff --git a/.gitlab/ci/env_windows_vs2022_x64_jom.ps1 b/.gitlab/ci/env_windows_vs2022_x64_jom.ps1
index c933421..c933421 100755..100644
--- a/.gitlab/ci/env_windows_vs2022_x64_jom.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_jom.ps1
diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
index 50a03ca..ae4a058 100755..100644
--- a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
@@ -1,4 +1,8 @@
if ("$env:CMAKE_CI_NIGHTLY" -eq "true") {
. ".gitlab/ci/innosetup-env.ps1"
. ".gitlab/ci/ispc-env.ps1"
+ . ".gitlab/ci/swift-env.ps1"
}
+
+& "$pwsh" -File .gitlab/ci/wix3.ps1
+& "$pwsh" -File .gitlab/ci/wix4.ps1
diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
index 44bb090..44bb090 100755..100644
--- a/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_ninja_multi.ps1
diff --git a/.gitlab/ci/env_windows_vs2022_x64_nmake.ps1 b/.gitlab/ci/env_windows_vs2022_x64_nmake.ps1
index 62463cd..62463cd 100755..100644
--- a/.gitlab/ci/env_windows_vs2022_x64_nmake.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_nmake.ps1
diff --git a/.gitlab/ci/env_windows_x86_64_package.ps1 b/.gitlab/ci/env_windows_x86_64_package.ps1
new file mode 100644
index 0000000..a898007
--- /dev/null
+++ b/.gitlab/ci/env_windows_x86_64_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/wix3-env.ps1
diff --git a/.gitlab/ci/innosetup-env.ps1 b/.gitlab/ci/innosetup-env.ps1
index 96e9d8c..96e9d8c 100755..100644
--- a/.gitlab/ci/innosetup-env.ps1
+++ b/.gitlab/ci/innosetup-env.ps1
diff --git a/.gitlab/ci/innosetup.ps1 b/.gitlab/ci/innosetup.ps1
index a7f4eb3..a7f4eb3 100755..100644
--- a/.gitlab/ci/innosetup.ps1
+++ b/.gitlab/ci/innosetup.ps1
diff --git a/.gitlab/ci/intel-env.ps1 b/.gitlab/ci/intel-env.ps1
index 75f7286..75f7286 100755..100644
--- a/.gitlab/ci/intel-env.ps1
+++ b/.gitlab/ci/intel-env.ps1
diff --git a/.gitlab/ci/intel-vars.ps1 b/.gitlab/ci/intel-vars.ps1
index dde0aa2..dde0aa2 100755..100644
--- a/.gitlab/ci/intel-vars.ps1
+++ b/.gitlab/ci/intel-vars.ps1
diff --git a/.gitlab/ci/intel.ps1 b/.gitlab/ci/intel.ps1
index 2262669..2262669 100755..100644
--- a/.gitlab/ci/intel.ps1
+++ b/.gitlab/ci/intel.ps1
diff --git a/.gitlab/ci/ispc-env.ps1 b/.gitlab/ci/ispc-env.ps1
index 816c485..816c485 100755..100644
--- a/.gitlab/ci/ispc-env.ps1
+++ b/.gitlab/ci/ispc-env.ps1
diff --git a/.gitlab/ci/ispc.ps1 b/.gitlab/ci/ispc.ps1
index 524896f..524896f 100755..100644
--- a/.gitlab/ci/ispc.ps1
+++ b/.gitlab/ci/ispc.ps1
diff --git a/.gitlab/ci/jom.ps1 b/.gitlab/ci/jom.ps1
index 6c28005..6c28005 100755..100644
--- a/.gitlab/ci/jom.ps1
+++ b/.gitlab/ci/jom.ps1
diff --git a/.gitlab/ci/mingw-env.ps1 b/.gitlab/ci/mingw-env.ps1
index d68a7f7..d68a7f7 100755..100644
--- a/.gitlab/ci/mingw-env.ps1
+++ b/.gitlab/ci/mingw-env.ps1
diff --git a/.gitlab/ci/mingw.ps1 b/.gitlab/ci/mingw.ps1
index a1b5b11..a1b5b11 100755..100644
--- a/.gitlab/ci/mingw.ps1
+++ b/.gitlab/ci/mingw.ps1
diff --git a/.gitlab/ci/msvc.ps1 b/.gitlab/ci/msvc.ps1
index e8388a4..e8388a4 100755..100644
--- a/.gitlab/ci/msvc.ps1
+++ b/.gitlab/ci/msvc.ps1
diff --git a/.gitlab/ci/ninja-env.ps1 b/.gitlab/ci/ninja-env.ps1
index 67c7036..67c7036 100755..100644
--- a/.gitlab/ci/ninja-env.ps1
+++ b/.gitlab/ci/ninja-env.ps1
diff --git a/.gitlab/ci/ninja-env.sh b/.gitlab/ci/ninja-env.sh
new file mode 100644
index 0000000..744b9f3
--- /dev/null
+++ b/.gitlab/ci/ninja-env.sh
@@ -0,0 +1,3 @@
+.gitlab/ci/ninja.sh
+export PATH=$PWD/.gitlab:$PATH
+ninja --version
diff --git a/.gitlab/ci/ninja-nightly.ps1 b/.gitlab/ci/ninja-nightly.ps1
index 071b077..071b077 100755..100644
--- a/.gitlab/ci/ninja-nightly.ps1
+++ b/.gitlab/ci/ninja-nightly.ps1
diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1
index 0af3b4f..0af3b4f 100755..100644
--- a/.gitlab/ci/ninja.ps1
+++ b/.gitlab/ci/ninja.ps1
diff --git a/.gitlab/ci/openwatcom-env.ps1 b/.gitlab/ci/openwatcom-env.ps1
index 14ea523..14ea523 100755..100644
--- a/.gitlab/ci/openwatcom-env.ps1
+++ b/.gitlab/ci/openwatcom-env.ps1
diff --git a/.gitlab/ci/openwatcom.ps1 b/.gitlab/ci/openwatcom.ps1
index 4f1012c..4f1012c 100755..100644
--- a/.gitlab/ci/openwatcom.ps1
+++ b/.gitlab/ci/openwatcom.ps1
diff --git a/.gitlab/ci/orangec-env.ps1 b/.gitlab/ci/orangec-env.ps1
index 3a5d232..3a5d232 100755..100644
--- a/.gitlab/ci/orangec-env.ps1
+++ b/.gitlab/ci/orangec-env.ps1
diff --git a/.gitlab/ci/orangec.ps1 b/.gitlab/ci/orangec.ps1
index 2201e12..2201e12 100755..100644
--- a/.gitlab/ci/orangec.ps1
+++ b/.gitlab/ci/orangec.ps1
diff --git a/.gitlab/ci/package_windows.ps1 b/.gitlab/ci/package_windows.ps1
index 9ec2942..9ec2942 100755..100644
--- a/.gitlab/ci/package_windows.ps1
+++ b/.gitlab/ci/package_windows.ps1
diff --git a/.gitlab/ci/post_build.ps1 b/.gitlab/ci/post_build.ps1
index fbd8ae8..fbd8ae8 100755..100644
--- a/.gitlab/ci/post_build.ps1
+++ b/.gitlab/ci/post_build.ps1
diff --git a/.gitlab/ci/post_build_fedora39_tidy.sh b/.gitlab/ci/post_build_fedora40_tidy.sh
index a36663a..a36663a 100644
--- a/.gitlab/ci/post_build_fedora39_tidy.sh
+++ b/.gitlab/ci/post_build_fedora40_tidy.sh
diff --git a/.gitlab/ci/post_build_windows_arm64_package.ps1 b/.gitlab/ci/post_build_windows_arm64_package.ps1
index f98d995..f98d995 100755..100644
--- a/.gitlab/ci/post_build_windows_arm64_package.ps1
+++ b/.gitlab/ci/post_build_windows_arm64_package.ps1
diff --git a/.gitlab/ci/post_build_windows_i386_package.ps1 b/.gitlab/ci/post_build_windows_i386_package.ps1
index f98d995..f98d995 100755..100644
--- a/.gitlab/ci/post_build_windows_i386_package.ps1
+++ b/.gitlab/ci/post_build_windows_i386_package.ps1
diff --git a/.gitlab/ci/post_build_windows_x86_64_package.ps1 b/.gitlab/ci/post_build_windows_x86_64_package.ps1
index f98d995..f98d995 100755..100644
--- a/.gitlab/ci/post_build_windows_x86_64_package.ps1
+++ b/.gitlab/ci/post_build_windows_x86_64_package.ps1
diff --git a/.gitlab/ci/pre_build.ps1 b/.gitlab/ci/pre_build.ps1
index 3a56687..3a56687 100755..100644
--- a/.gitlab/ci/pre_build.ps1
+++ b/.gitlab/ci/pre_build.ps1
diff --git a/.gitlab/ci/pre_build_fedora39_tidy.sh b/.gitlab/ci/pre_build_fedora40_tidy.sh
index 7580ef1..7580ef1 100644
--- a/.gitlab/ci/pre_build_fedora39_tidy.sh
+++ b/.gitlab/ci/pre_build_fedora40_tidy.sh
diff --git a/.gitlab/ci/python-env.ps1 b/.gitlab/ci/python-env.ps1
index ce16493..ce16493 100755..100644
--- a/.gitlab/ci/python-env.ps1
+++ b/.gitlab/ci/python-env.ps1
diff --git a/.gitlab/ci/python.ps1 b/.gitlab/ci/python.ps1
index 27f1807..27f1807 100755..100644
--- a/.gitlab/ci/python.ps1
+++ b/.gitlab/ci/python.ps1
diff --git a/.gitlab/ci/qt-env.ps1 b/.gitlab/ci/qt-env.ps1
index 22b1099..22b1099 100755..100644
--- a/.gitlab/ci/qt-env.ps1
+++ b/.gitlab/ci/qt-env.ps1
diff --git a/.gitlab/ci/repackage/wix.ps1 b/.gitlab/ci/repackage/wix.ps1
new file mode 100644
index 0000000..6dbd466
--- /dev/null
+++ b/.gitlab/ci/repackage/wix.ps1
@@ -0,0 +1,55 @@
+# WiX Toolset 4+ is provided only via nuget packages.
+# Download the package artifacts, extract the parts we need, and repackage them.
+
+param (
+ [Parameter(Mandatory=$true)]
+ [string]$version
+ )
+
+$erroractionpreference = "stop"
+
+$version_major = $version.Substring(0, $version.IndexOf('.'))
+
+$release = "v" + $version
+$pkg_wix = "wix.$version.nupkg"
+$pkg_wixui = "WixToolset.UI.wixext.$version.nupkg"
+$packages = $pkg_wix, $pkg_wixui
+
+$wix_artifacts = "wix-artifacts.zip"
+
+$ProgressPreference = 'SilentlyContinue'
+Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix/releases/download/$release/artifacts.zip" -OutFile "$wix_artifacts"
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+
+$zip = [System.IO.Compression.ZipFile]::Open("$wix_artifacts", "read")
+$zip.Entries | Where-Object FullName -in $packages | ForEach-Object {
+ [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$($_.Name)", $true)
+}
+$zip.Dispose()
+Remove-Item "$wix_artifacts"
+
+$wix_dir = "wix-$version-win-any-1"
+[System.IO.Compression.ZipFile]::ExtractToDirectory($pkg_wix, "wix-tmp")
+Move-Item -Path "wix-tmp/tools/net6.0/any" -Destination "$wix_dir"
+Remove-Item "wix-tmp" -Recurse -Force
+Remove-Item "$pkg_wix"
+
+$ext_dir = New-Item -Force -ItemType Directory -Path "$wix_dir/.wix/extensions/WixToolset.UI.wixext/$version/wixext$version_major"
+$zip = [System.IO.Compression.ZipFile]::Open($pkg_wixui, "read")
+$zip.Entries | Where-Object Name -eq "WixToolset.UI.wixext.dll" | ForEach-Object {
+ [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, (Join-Path $ext_dir $_.Name), $true)
+}
+$zip.Dispose()
+Remove-Item "$pkg_wixui"
+
+@"
+This was extracted from WiX Toolset nuget packages and repackaged.
+Point both PATH and WIX_EXTENSIONS environment variables at this directory.
+
+"@ | Add-Content -NoNewline "$wix_dir/README.txt"
+
+$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
+$includeBaseDirectory = $true
+[System.IO.Compression.ZipFile]::CreateFromDirectory("$wix_dir", "$wix_dir.zip", $compressionLevel, $includeBaseDirectory)
+Remove-Item "$wix_dir" -Recurse -Force
diff --git a/.gitlab/ci/sccache-env.ps1 b/.gitlab/ci/sccache-env.ps1
new file mode 100644
index 0000000..66dc6eb
--- /dev/null
+++ b/.gitlab/ci/sccache-env.ps1
@@ -0,0 +1 @@
+Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH"
diff --git a/.gitlab/ci/sccache-env.sh b/.gitlab/ci/sccache-env.sh
new file mode 100644
index 0000000..4b170a4
--- /dev/null
+++ b/.gitlab/ci/sccache-env.sh
@@ -0,0 +1,2 @@
+.gitlab/ci/sccache.sh
+export PATH="$PWD/.gitlab:$PATH"
diff --git a/.gitlab/ci/swift-env.ps1 b/.gitlab/ci/swift-env.ps1
new file mode 100644
index 0000000..871b31c
--- /dev/null
+++ b/.gitlab/ci/swift-env.ps1
@@ -0,0 +1,6 @@
+$pwdpath = $pwd.Path
+& "$pwsh" -File ".gitlab/ci/swift.ps1"
+Set-Item -Force -Path "env:DEVELOPER_DIR" -Value "$pwdpath\.gitlab\swift"
+Set-Item -Force -Path "env:SDKROOT" -Value "$pwdpath\.gitlab\swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk"
+Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;$env:PATH"
+swiftc --version
diff --git a/.gitlab/ci/swift.ps1 b/.gitlab/ci/swift.ps1
new file mode 100644
index 0000000..b970dce
--- /dev/null
+++ b/.gitlab/ci/swift.ps1
@@ -0,0 +1,38 @@
+$erroractionpreference = "stop"
+
+$version = "5.9.2"
+$sha256sum = "8C053108528EB2DAD84C33D6F0834A3A1444D21BA1A89D591AB149304A62F6B5"
+$filename = "swift-$version-win-x86_64-1"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network. See above filename table.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$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")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\swift"
+Remove-Item "$outdir\$tarball"
+
+$bin = "$outdir\swift\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin"
+$null = New-Item -ItemType HardLink -Path "$bin\clang++.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\clang-cl.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\clang-cpp.exe" -Target "$bin\clang.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\ld.lld.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\ld64.lld.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\lld-link.exe" -Target "$bin\lld.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-dlltool.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-lib.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-ranlib.exe" -Target "$bin\llvm-ar.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\llvm-objcopy.exe" -Target "$bin\llvm-strip.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swiftc.exe" -Target "$bin\swift.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-api-digester.exe" -Target "$bin\swift-frontend.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-autolink-extract.exe" -Target "$bin\swift-frontend.exe"
+$null = New-Item -ItemType HardLink -Path "$bin\swift-symbolgraph-extract.exe" -Target "$bin\swift-frontend.exe"
+Clear-Variable -Name bin
diff --git a/.gitlab/ci/vcvarsall.ps1 b/.gitlab/ci/vcvarsall.ps1
index f91b100..f91b100 100755..100644
--- a/.gitlab/ci/vcvarsall.ps1
+++ b/.gitlab/ci/vcvarsall.ps1
diff --git a/.gitlab/ci/wix3-env.ps1 b/.gitlab/ci/wix3-env.ps1
new file mode 100644
index 0000000..a872b74
--- /dev/null
+++ b/.gitlab/ci/wix3-env.ps1
@@ -0,0 +1,6 @@
+& "$pwsh" -File .gitlab/ci/wix3.ps1
+
+$pwdpath = $pwd.Path
+Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\wix3;$env:PATH"
+
+light -help | Select -First 1
diff --git a/.gitlab/ci/wix.ps1 b/.gitlab/ci/wix3.ps1
index 9313c0f..8f5ae4b 100755..100644
--- a/.gitlab/ci/wix.ps1
+++ b/.gitlab/ci/wix3.ps1
@@ -17,4 +17,5 @@ if ($hash.Hash -ne $sha256sum) {
}
Add-Type -AssemblyName System.IO.Compression.FileSystem
-[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir\wix\bin")
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir\wix3")
+Remove-Item "$outdir\$tarball"
diff --git a/.gitlab/ci/wix4.ps1 b/.gitlab/ci/wix4.ps1
new file mode 100644
index 0000000..6209f2b
--- /dev/null
+++ b/.gitlab/ci/wix4.ps1
@@ -0,0 +1,20 @@
+$erroractionpreference = "stop"
+
+$version = "4.0.4"
+$sha256sum = "FB6E94C89B12FB65D3AA0CF9E9C630DAFCC7D57F1E66C7D6035CAD37A38CC284"
+$filename = "wix-$version-win-any-1"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/$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")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\wix4"
+Remove-Item "$outdir\$tarball"
diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml
index e0364a5..f9fd6c2 100644
--- a/.gitlab/os-linux.yml
+++ b/.gitlab/os-linux.yml
@@ -5,7 +5,7 @@
### Release
.linux_prep_source:
- image: "fedora:39"
+ image: "fedora:40"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -45,7 +45,7 @@
### Debian
.debian12:
- image: "kitware/cmake:ci-debian12-x86_64-2023-07-27"
+ image: "kitware/cmake:ci-debian12-x86_64-2024-03-04"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
@@ -68,45 +68,53 @@
### Fedora
-.fedora39:
- image: "kitware/cmake:ci-fedora39-x86_64-2023-11-16"
+.fedora40:
+ image: "kitware/cmake:ci-fedora40-x86_64-2024-04-24"
variables:
GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci/long file name for testing purposes"
CMAKE_ARCH: x86_64
+# FIXME(#25932): Our HIP tests do not fully work in CI with Fedora 40.
+.fedora39_hip:
+ image: "kitware/cmake:ci-fedora39-hip-x86_64-2024-04-24"
+
+ variables:
+ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
+ CMAKE_ARCH: x86_64
+
#### Lint builds
-.fedora39_tidy:
- extends: .fedora39
+.fedora40_tidy:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_tidy
+ CMAKE_CONFIGURATION: fedora40_tidy
CMAKE_CI_NO_INSTALL: 1
-.fedora39_clang_analyzer:
- extends: .fedora39
+.fedora40_clang_analyzer:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_clang_analyzer
+ CMAKE_CONFIGURATION: fedora40_clang_analyzer
CMAKE_CI_BUILD_TYPE: Debug
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_CI_NO_INSTALL: 1
-.fedora39_sphinx:
- extends: .fedora39
+.fedora40_sphinx:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_sphinx
+ CMAKE_CONFIGURATION: fedora40_sphinx
CTEST_NO_WARNINGS_ALLOWED: 1
CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
CMAKE_CI_NO_INSTALL: 1
-.fedora39_sphinx_package:
- extends: .fedora39
+.fedora40_sphinx_package:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_sphinx_package
+ CMAKE_CONFIGURATION: fedora40_sphinx_package
CTEST_SOURCE_SUBDIRECTORY: "Utilities/Sphinx"
#### Build and test
@@ -162,43 +170,43 @@
CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
-.fedora39_extdeps:
- extends: .fedora39
+.fedora40_extdeps:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_extdeps
+ CMAKE_CONFIGURATION: fedora40_extdeps
CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
-.fedora39_ninja:
- extends: .fedora39
+.fedora40_ninja:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_ninja
+ CMAKE_CONFIGURATION: fedora40_ninja
CMAKE_CI_BUILD_TYPE: Release
CTEST_NO_WARNINGS_ALLOWED: 1
-.fedora39_ninja_multi:
- extends: .fedora39
+.fedora40_ninja_multi:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_ninja_multi
+ CMAKE_CONFIGURATION: fedora40_ninja_multi
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_GENERATOR: "Ninja Multi-Config"
-.fedora39_makefiles:
- extends: .fedora39
+.fedora40_makefiles:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_makefiles
+ CMAKE_CONFIGURATION: fedora40_makefiles
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_GENERATOR: "Unix Makefiles"
-.fedora39_makefiles_symlinked:
- extends: .fedora39
+.fedora40_makefiles_symlinked:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_makefiles_symlinked
+ CMAKE_CONFIGURATION: fedora40_makefiles_symlinked
CTEST_NO_WARNINGS_ALLOWED: 1
CMAKE_GENERATOR: "Unix Makefiles"
CMAKE_CI_IN_SYMLINK_TREE: 1
@@ -219,24 +227,24 @@
variables:
CMAKE_CONFIGURATION: debian12_ninja_clang
-.fedora39_makefiles_clang:
- extends: .fedora39
+.fedora40_makefiles_clang:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_makefiles_clang
+ CMAKE_CONFIGURATION: fedora40_makefiles_clang
CMAKE_GENERATOR: "Unix Makefiles"
-.fedora39_ninja_clang:
- extends: .fedora39
+.fedora40_ninja_clang:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_ninja_clang
+ CMAKE_CONFIGURATION: fedora40_ninja_clang
-.fedora39_ninja_multi_clang:
- extends: .fedora39
+.fedora40_ninja_multi_clang:
+ extends: .fedora40
variables:
- CMAKE_CONFIGURATION: fedora39_ninja_multi_clang
+ CMAKE_CONFIGURATION: fedora40_ninja_multi_clang
CMAKE_GENERATOR: "Ninja Multi-Config"
### Sanitizers
@@ -252,13 +260,13 @@
CTEST_MEMORYCHECK_TYPE: AddressSanitizer
CTEST_MEMORYCHECK_SANITIZER_OPTIONS: ""
-.fedora39_asan:
+.fedora40_asan:
extends:
- - .fedora39
+ - .fedora40
- .fedora_asan_addon
variables:
- CMAKE_CONFIGURATION: fedora39_asan
+ CMAKE_CONFIGURATION: fedora40_asan
### Intel Compiler
@@ -367,6 +375,24 @@
CMAKE_CONFIGURATION: cuda11.8_splayed_nvidia
CTEST_NO_WARNINGS_ALLOWED: 1
+.cuda12.2:
+ extends: .cuda
+ image: "kitware/cmake:ci-cuda12.2-x86_64-2024-04-05"
+ variables:
+ CMAKE_ARCH: x86_64
+
+.cuda12.2_nvidia:
+ extends: .cuda12.2
+ variables:
+ CMAKE_CONFIGURATION: cuda12.2_nvidia
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
+.cuda12.2_clang:
+ extends: .cuda12.2
+ variables:
+ CMAKE_CONFIGURATION: cuda12.2_clang
+ CTEST_NO_WARNINGS_ALLOWED: 1
+
### HIP builds
.hip5.5:
@@ -392,7 +418,7 @@
CTEST_LABELS: "HIP"
.fedora39_hip_radeon:
- extends: .fedora39
+ extends: .fedora39_hip
variables:
CMAKE_CONFIGURATION: fedora39_hip_radeon
@@ -405,30 +431,6 @@
CMAKE_CONFIGURATION: hip5.5_nvidia
CTEST_LABELS: "HIP"
-### C++ modules
-
-.gcc_cxx_modules_x86_64:
- image: "kitware/cmake:ci-gcc_cxx_modules-x86_64-2023-09-21"
-
- variables:
- GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci"
- CMAKE_ARCH: x86_64
- CC: "/opt/gcc-p1689/bin/gcc"
- CXX: "/opt/gcc-p1689/bin/g++"
-
-.gcc_cxx_modules_ninja:
- extends: .gcc_cxx_modules_x86_64
-
- variables:
- CMAKE_CONFIGURATION: linux_gcc_cxx_modules_ninja
-
-.gcc_cxx_modules_ninja_multi:
- extends: .gcc_cxx_modules_x86_64
-
- variables:
- CMAKE_CONFIGURATION: linux_gcc_cxx_modules_ninja_multi
- CMAKE_GENERATOR: "Ninja Multi-Config"
-
### Debian 10 legacy packages
.debian10:
@@ -493,12 +495,8 @@
.before_script_linux: &before_script_linux
- source .gitlab/ci/env.sh
- - .gitlab/ci/cmake.sh
- - export PATH=$PWD/.gitlab/cmake/bin:$PATH
- - .gitlab/ci/ninja.sh
- - export PATH=$PWD/.gitlab:$PATH
- - cmake --version
- - ninja --version
+ - source .gitlab/ci/cmake-env.sh
+ - source .gitlab/ci/ninja-env.sh
.cmake_prep_source_linux:
stage: prep
@@ -508,8 +506,8 @@
- dnf install --setopt=install_weak_deps=False -y git-core
- v="$(.gitlab/ci/cmake_version.sh)"
- mkdir -p build/
- - git archive --format=tgz "--prefix=cmake-$v/" -o "build/cmake-$v.tar.gz" HEAD
- - git -c core.autocrlf=true -c core.eol=crlf archive --format=zip --prefix="cmake-$v/" -o "build/cmake-$v.zip" HEAD
+ - git archive --format=tgz --prefix="cmake-$v/" -o "build/cmake-$v.tar.gz" HEAD
+ - git archive --format=zip --prefix="cmake-$v/" -o "build/cmake-$v.zip" HEAD
interruptible: true
@@ -525,7 +523,7 @@
.cmake_codespell_linux:
stage: build
- extends: .fedora39
+ extends: .fedora40
script:
- .gitlab/ci/codespell.sh
interruptible: true
@@ -573,8 +571,7 @@
- mkdir -p build/
- cp Utilities/Release/linux/$CMAKE_ARCH/cache.txt build/CMakeCache.txt
# Make sccache available.
- - .gitlab/ci/sccache.sh
- - export PATH=$PWD/.gitlab:$PATH
+ - source .gitlab/ci/sccache-env.sh
# Append sccache settings to the cache.
- echo "CMAKE_C_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
- echo "CMAKE_CXX_COMPILER_LAUNCHER:STRING=sccache" >> build/CMakeCache.txt
@@ -669,7 +666,7 @@
.cmake_org_help:
stage: build
extends:
- - .fedora39
+ - .fedora40
- .linux_x86_64_tags
- .cmake_org_help_artifacts
script:
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 23c68d5..894d624 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -175,12 +175,8 @@
.before_script_macos: &before_script_macos
- source .gitlab/ci/env.sh
- - .gitlab/ci/cmake.sh
- - export PATH=$PWD/.gitlab/cmake/bin:$PATH
- - .gitlab/ci/ninja.sh
- - export PATH=$PWD/.gitlab:$PATH
- - cmake --version
- - ninja --version
+ - source .gitlab/ci/cmake-env.sh
+ - source .gitlab/ci/ninja-env.sh
# Download Qt
- cmake -P .gitlab/ci/download_qt.cmake
- export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt${CMAKE_PREFIX_PATH:+:$CMAKE_PREFIX_PATH}
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index c449ab8..1372136 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -337,12 +337,23 @@
- msvc-19.36
- concurrent
-.windows_x86_64_tags_concurrent_vs2019:
+.windows_x86_64_tags_concurrent_vs2022_android:
+ tags:
+ - cmake # Since this is a bare runner, pin to a project.
+ - windows-x86_64
+ - shell
+ - vs2022
+ - vs17-android
+ - msvc-19.36
+ - concurrent
+
+.windows_x86_64_tags_concurrent_vs2019_android:
tags:
- cmake # Since this is a bare runner, pin to a project.
- windows-x86_64
- shell
- vs2019
+ - vs16-android
- msvc-19.29-16.11
- concurrent
@@ -375,15 +386,8 @@
.before_script_windows: &before_script_windows
- . .gitlab/ci/env.ps1
- - $pwdpath = $pwd.Path
- - (& "$pwsh" -File ".gitlab/ci/wix.ps1")
- - Set-Item -Force -Path "env:WIX" -Value "$pwdpath\.gitlab\wix"
- - (& "$pwsh" -File ".gitlab/ci/cmake.ps1")
- - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\cmake\bin;$env:PATH"
- - $cmake = "cmake"
+ - . .gitlab/ci/cmake-env.ps1
- . .gitlab/ci/ninja-env.ps1
- - (& "$env:WIX\bin\light.exe" -help) | Select -First 1
- - cmake --version
- . .gitlab/ci/qt-env.ps1
- . .gitlab/ci/python-env.ps1
@@ -396,7 +400,7 @@
script:
- *before_script_windows
- - Set-Item -Force -Path "env:PATH" -Value "$env:PATH;$env:SCCACHE_PATH"
+ - . .gitlab/ci/sccache-env.ps1
- Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- sccache --start-server
- sccache --show-stats
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index b85b728..0402d33 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -4,6 +4,8 @@
rules:
- if: '$CMAKE_CI_PACKAGE != null'
when: never
+ - if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
+ when: never
- if: '$CMAKE_CI_NIGHTLY == "true"'
when: on_success
- if: '$CMAKE_CI_JOB_NIGHTLY == "true"'
@@ -25,6 +27,8 @@
rules:
- if: '$CMAKE_CI_PACKAGE != null'
when: never
+ - if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
+ when: never
- if: '$CMAKE_CI_NIGHTLY == "true"'
when: on_success
- if: '$CMAKE_CI_JOB_NIGHTLY == "true"'
@@ -46,6 +50,8 @@
rules:
- if: '$CMAKE_CI_PACKAGE != null'
when: never
+ - if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_JOB_NIGHTLY == "false")'
+ when: never
- if: '($CMAKE_CI_NIGHTLY == "true" && $CMAKE_CI_NIGHTLY_IGNORE_DEPS == "true")'
when: always
- if: '$CMAKE_CI_NIGHTLY == "true"'
diff --git a/.gitlab/upload.yml b/.gitlab/upload.yml
index 56793af..6b46313 100644
--- a/.gitlab/upload.yml
+++ b/.gitlab/upload.yml
@@ -1,7 +1,7 @@
# Steps for uploading artifacts
.rsync_upload_package:
- image: "fedora:39"
+ image: "fedora:40"
stage: upload
tags:
- cmake
@@ -21,7 +21,7 @@
.rsync_upload_help:
stage: upload
- image: "fedora:39"
+ image: "fedora:40"
tags:
- cmake
- docker
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index b5e5ff4..cfa0173 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -1,4 +1,4 @@
-;;; cmake-mode.el --- major-mode for editing CMake sources
+;;; cmake-mode.el --- major-mode for editing CMake sources -*- lexical-binding: t; -*-
;; Package-Requires: ((emacs "24.1"))
@@ -480,7 +480,8 @@ and store the result as a list in LISTVAR."
;;;###autoload
(defun cmake-help ()
- "Queries for any of the four available help topics and prints out the appropriate page."
+ "Queries for any of the four available help topics and prints out the
+appropriate page."
(interactive)
(let* ((default-entry (cmake-symbol-at-point))
(command-list (cmake-get-list "command"))
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim
index 5629356..5d412c2 100644
--- a/Auxiliary/vim/syntax/cmake.vim
+++ b/Auxiliary/vim/syntax/cmake.vim
@@ -450,6 +450,7 @@ syn keyword cmakeProperty contained
\ VS_STARTUP_PROJECT
\ VS_TOOL_OVERRIDE
\ VS_USER_PROPS
+ \ VS_FILTER_PROPS
\ VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
\ VS_WINRT_COMPONENT
\ VS_WINRT_EXTENSIONS
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index 798affd..a0c0e54 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -229,15 +229,12 @@ endif()
set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991")
-if(MSVC AND NOT "$ENV{WIX}" STREQUAL "")
- set(WIX_CUSTOM_ACTION_ENABLED TRUE)
+if(CMake_BUILD_WIX_CUSTOM_ACTION)
if(CMAKE_CONFIGURATION_TYPES)
- set(WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
+ set(CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG TRUE)
else()
- set(WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
+ set(CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG FALSE)
endif()
-else()
- set(WIX_CUSTOM_ACTION_ENABLED FALSE)
endif()
# Set the options file that needs to be included inside CMakeCPackOptions.cmake
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index 7aacf8e..cbe73e7 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -265,17 +265,18 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX")
set(CPACK_WIX_EXTRA_SOURCES
"@CMake_SOURCE_DIR@/Utilities/Release/WiX/install_dir.wxs"
- "@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_extra_dialog.wxs"
+ "@CMake_SOURCE_DIR@/Utilities/Release/WiX/options.wxs"
+ "@CMake_SOURCE_DIR@/Utilities/Release/WiX/options_dlg.wxs"
)
- set(_WIX_CUSTOM_ACTION_ENABLED "@WIX_CUSTOM_ACTION_ENABLED@")
+ set(_WIX_CUSTOM_ACTION_ENABLED "@CMake_BUILD_WIX_CUSTOM_ACTION@")
if(_WIX_CUSTOM_ACTION_ENABLED)
list(APPEND CPACK_WIX_EXTRA_SOURCES
"@CMake_SOURCE_DIR@/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs"
)
list(APPEND CPACK_WIX_CANDLE_EXTRA_FLAGS -dCHECK_NSIS=1)
- set(_WIX_CUSTOM_ACTION_MULTI_CONFIG "@WIX_CUSTOM_ACTION_MULTI_CONFIG@")
+ set(_WIX_CUSTOM_ACTION_MULTI_CONFIG "@CMake_BUILD_WIX_CUSTOM_ACTION_MULTI_CONFIG@")
if(_WIX_CUSTOM_ACTION_MULTI_CONFIG)
if(CPACK_BUILD_CONFIG)
set(_WIX_CUSTOM_ACTION_CONFIG "${CPACK_BUILD_CONFIG}")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfbb38d..5f661a9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
-cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.28 FATAL_ERROR)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 85af8ed..ae55715 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -12,11 +12,12 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"warning: \\(Long double usage is reported only once for each file"
"warning: To disable this warning use"
"could not be inlined"
- "libcmexpat.*has no symbols"
- "libcmcurl.*has no symbols"
+ "libcm(curl|expat).*has no symbols"
+ "cm(curl|expat).build/[^ ]*.o has no symbols"
"not sorted slower link editing will result"
"stl_deque.h:479"
"Utilities.cmzlib."
+ "Utilities.cmzstd."
"Utilities.cmbzip2."
"Source.CTest.Curl"
"Source.CursesDialog.form"
@@ -85,6 +86,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"[0-9]+ Warning\\(s\\) detected" # SunPro
# Ignore false positive on `cm::optional` usage from GCC
+ "cmFileCommand.cxx:[0-9]*:[0-9]*: warning: '\\*\\(\\(void\\*\\)& tls_verify \\+2\\)' may be used uninitialized in this function \\[-Wmaybe-uninitialized\\]"
"cmGlobalNinjaGenerator.cxx:[0-9]*:[0-9]*: warning: '.*cm::optional<CxxModuleMapFormat>::_mem\\)\\)' may be used uninitialized \\[-Wmaybe-uninitialized\\]"
"cmGlobalNinjaGenerator.cxx:[0-9]*:[0-9]*: note: '.*cm::optional<CxxModuleMapFormat>::_mem\\)\\)' was declared here"
"cmGlobalNinjaGenerator.cxx:[0-9]*:[0-9]*: warning: '\\*\\(\\(void\\*\\)& modmap_fmt \\+4\\)' may be used uninitialized in this function \\[-Wmaybe-uninitialized\\]"
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index bd80e6e..c184a96 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -84,8 +84,8 @@ The options are:
.. versionadded:: 3.20
Arguments to ``BYPRODUCTS`` may use a restricted set of
:manual:`generator expressions <cmake-generator-expressions(7)>`.
- :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
- permitted.
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
+ are not permitted.
.. versionchanged:: 3.28
In targets using :ref:`file sets`, custom command byproducts are now
@@ -272,8 +272,8 @@ The options are:
.. versionadded:: 3.20
Arguments to ``OUTPUT`` may use a restricted set of
:manual:`generator expressions <cmake-generator-expressions(7)>`.
- :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
- permitted.
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
+ are not permitted.
.. versionchanged:: 3.28
In targets using :ref:`file sets`, custom command outputs are now
diff --git a/Help/command/add_custom_target.rst b/Help/command/add_custom_target.rst
index 0385a93..d88e0f0 100644
--- a/Help/command/add_custom_target.rst
+++ b/Help/command/add_custom_target.rst
@@ -60,8 +60,8 @@ The options are:
.. versionadded:: 3.20
Arguments to ``BYPRODUCTS`` may use a restricted set of
:manual:`generator expressions <cmake-generator-expressions(7)>`.
- :ref:`Target-dependent expressions <Target-Dependent Queries>` are not
- permitted.
+ :ref:`Target-dependent expressions <Target-Dependent Expressions>`
+ are not permitted.
.. versionchanged:: 3.28
In custom targets using :ref:`file sets`, byproducts are now
diff --git a/Help/command/add_dependencies.rst b/Help/command/add_dependencies.rst
index 23cb405..3a51a30 100644
--- a/Help/command/add_dependencies.rst
+++ b/Help/command/add_dependencies.rst
@@ -20,6 +20,17 @@ transitively in its place since the target itself does not build.
.. versionadded:: 3.3
Allow adding dependencies to interface libraries.
+.. versionadded:: 3.8
+ Dependencies will populate the :prop_tgt:`MANUALLY_ADDED_DEPENDENCIES`
+ property of ``<target>``.
+
+.. versionchanged:: 3.9
+ The :ref:`Ninja Generators` use weaker ordering than
+ other generators in order to improve available concurrency.
+ They only guarantee that the dependencies' custom commands are
+ finished before sources in ``<target>`` start compiling; this
+ ensures generated sources are available.
+
See Also
^^^^^^^^
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index 5b22cb1..cab380e 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -84,6 +84,13 @@ See also :prop_sf:`HEADER_FILE_ONLY` on what to do if some sources are
pre-processed, and you want to have the original sources reachable from
within IDE.
+.. versionchanged:: 3.30
+
+ On platforms that do not support shared libraries, ``add_library``
+ now fails on calls creating ``SHARED`` libraries instead of
+ automatically converting them to ``STATIC`` libraries as before.
+ See policy :policy:`CMP0164`.
+
Object Libraries
^^^^^^^^^^^^^^^^
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst
index 4e6bedb..39b7b99 100644
--- a/Help/command/cmake_path.rst
+++ b/Help/command/cmake_path.rst
@@ -600,7 +600,7 @@ For example:
# filename is now already empty, the following removes nothing
cmake_path(REMOVE_FILENAME path)
- message("Second path is \"${result}\"")
+ message("Second path is \"${path}\"")
Output::
diff --git a/Help/command/enable_language.rst b/Help/command/enable_language.rst
index 2f1cc23..d587310 100644
--- a/Help/command/enable_language.rst
+++ b/Help/command/enable_language.rst
@@ -9,15 +9,19 @@ Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)
Enables support for the named languages in CMake. This is the same as
the :command:`project` command but does not create any of the extra
-variables that are created by the project command.
+variables that are created by the :command:`project` command.
.. include:: SUPPORTED_LANGUAGES.txt
-This command must be called in file scope, not in a function call.
-Furthermore, it must be called in the highest directory common to all
-targets using the named language directly for compiling sources or
-indirectly through link dependencies. It is simplest to enable all
-needed languages in the top-level directory of a project.
+The following restrictions apply to where ``enable_language()`` may be called:
+
+* It must be called in file scope, not in a function call.
+* It must not be called before the first call to :command:`project`.
+ See policy :policy:`CMP0165`.
+* It must be called in the highest directory common to all targets
+ using the named language directly for compiling sources or
+ indirectly through link dependencies. It is simplest to enable all
+ needed languages in the top-level directory of a project.
The ``OPTIONAL`` keyword is a placeholder for future implementation and
does not currently work. Instead you can use the :module:`CheckLanguage`
diff --git a/Help/command/file.rst b/Help/command/file.rst
index f373e24..ef49faa 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -28,7 +28,6 @@ Synopsis
file(`STRINGS`_ <filename> <out-var> [...])
file(`\<HASH\>`_ <filename> <out-var>)
file(`TIMESTAMP`_ <filename> <out-var> [...])
- file(`GET_RUNTIME_DEPENDENCIES`_ [...])
`Writing`_
file({`WRITE`_ | `APPEND`_} <filename> <content>...)
@@ -65,6 +64,10 @@ Synopsis
file(`ARCHIVE_CREATE`_ OUTPUT <archive> PATHS <paths>... [...])
file(`ARCHIVE_EXTRACT`_ INPUT <archive> [...])
+ `Handling Runtime Binaries`_
+ file(`GET_RUNTIME_DEPENDENCIES`_ [...])
+
+
Reading
^^^^^^^
@@ -157,323 +160,6 @@ Reading
See the :command:`string(TIMESTAMP)` command for documentation of
the ``<format>`` and ``UTC`` options.
-.. signature::
- file(GET_RUNTIME_DEPENDENCIES [...])
-
- .. versionadded:: 3.16
-
- Recursively get the list of libraries depended on by the given files:
-
- .. code-block:: cmake
-
- file(GET_RUNTIME_DEPENDENCIES
- [RESOLVED_DEPENDENCIES_VAR <deps_var>]
- [UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>]
- [CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>]
- [EXECUTABLES <executable_files>...]
- [LIBRARIES <library_files>...]
- [MODULES <module_files>...]
- [DIRECTORIES <directories>...]
- [BUNDLE_EXECUTABLE <bundle_executable_file>]
- [PRE_INCLUDE_REGEXES <regexes>...]
- [PRE_EXCLUDE_REGEXES <regexes>...]
- [POST_INCLUDE_REGEXES <regexes>...]
- [POST_EXCLUDE_REGEXES <regexes>...]
- [POST_INCLUDE_FILES <files>...]
- [POST_EXCLUDE_FILES <files>...]
- )
-
- Please note that this sub-command is not intended to be used in project mode.
- It is intended for use at install time, either from code generated by the
- :command:`install(RUNTIME_DEPENDENCY_SET)` command, or from code provided by
- the project via :command:`install(CODE)` or :command:`install(SCRIPT)`.
- For example:
-
- .. code-block:: cmake
-
- install(CODE [[
- file(GET_RUNTIME_DEPENDENCIES
- # ...
- )
- ]])
-
- The arguments are as follows:
-
- ``RESOLVED_DEPENDENCIES_VAR <deps_var>``
- Name of the variable in which to store the list of resolved dependencies.
-
- ``UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>``
- Name of the variable in which to store the list of unresolved
- dependencies. If this variable is not specified, and there are any
- unresolved dependencies, an error is issued.
-
- ``CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>``
- Variable prefix in which to store conflicting dependency information.
- Dependencies are conflicting if two files with the same name are found in
- two different directories. The list of filenames that conflict are stored
- in ``<conflicting_deps_prefix>_FILENAMES``. For each filename, the list
- of paths that were found for that filename are stored in
- ``<conflicting_deps_prefix>_<filename>``.
-
- ``EXECUTABLES <executable_files>...``
- List of executable files to read for dependencies. These are executables
- that are typically created with :command:`add_executable`, but they do
- not have to be created by CMake. On Apple platforms, the paths to these
- files determine the value of ``@executable_path`` when recursively
- resolving the libraries. Specifying any kind of library (``STATIC``,
- ``MODULE``, or ``SHARED``) here will result in undefined behavior.
-
- ``LIBRARIES <library_files>...``
- List of library files to read for dependencies. These are libraries that
- are typically created with :command:`add_library(SHARED)`, but they do
- not have to be created by CMake. Specifying ``STATIC`` libraries,
- ``MODULE`` libraries, or executables here will result in undefined
- behavior.
-
- ``MODULES <module_files>...``
- List of loadable module files to read for dependencies. These are modules
- that are typically created with :command:`add_library(MODULE)`, but they
- do not have to be created by CMake. They are typically used by calling
- ``dlopen()`` at runtime rather than linked at link time with ``ld -l``.
- Specifying ``STATIC`` libraries, ``SHARED`` libraries, or executables
- here will result in undefined behavior.
-
- ``DIRECTORIES <directories>...``
- List of additional directories to search for dependencies. On Linux
- platforms, these directories are searched if the dependency is not found
- in any of the other usual paths. If it is found in such a directory, a
- warning is issued, because it means that the file is incomplete (it does
- not list all of the directories that contain its dependencies).
- On Windows platforms, these directories are searched if the dependency
- is not found in any of the other search paths, but no warning is issued,
- because searching other paths is a normal part of Windows dependency
- resolution. On Apple platforms, this argument has no effect.
-
- ``BUNDLE_EXECUTABLE <bundle_executable_file>``
- Executable to treat as the "bundle executable" when resolving libraries.
- On Apple platforms, this argument determines the value of
- ``@executable_path`` when recursively resolving libraries for
- ``LIBRARIES`` and ``MODULES`` files. It has no effect on ``EXECUTABLES``
- files. On other platforms, it has no effect. This is typically (but not
- always) one of the executables in the ``EXECUTABLES`` argument which
- designates the "main" executable of the package.
-
- The following arguments specify filters for including or excluding libraries
- to be resolved. See below for a full description of how they work.
-
- ``PRE_INCLUDE_REGEXES <regexes>...``
- List of pre-include regexes through which to filter the names of
- not-yet-resolved dependencies.
-
- ``PRE_EXCLUDE_REGEXES <regexes>...``
- List of pre-exclude regexes through which to filter the names of
- not-yet-resolved dependencies.
-
- ``POST_INCLUDE_REGEXES <regexes>...``
- List of post-include regexes through which to filter the names of
- resolved dependencies.
-
- ``POST_EXCLUDE_REGEXES <regexes>...``
- List of post-exclude regexes through which to filter the names of
- resolved dependencies.
-
- ``POST_INCLUDE_FILES <files>...``
- .. versionadded:: 3.21
-
- List of post-include filenames through which to filter the names of
- resolved dependencies. Symlinks are resolved when attempting to match
- these filenames.
-
- ``POST_EXCLUDE_FILES <files>...``
- .. versionadded:: 3.21
-
- List of post-exclude filenames through which to filter the names of
- resolved dependencies. Symlinks are resolved when attempting to match
- these filenames.
-
- These arguments can be used to exclude unwanted system libraries when
- resolving the dependencies, or to include libraries from a specific
- directory. The filtering works as follows:
-
- 1. If the not-yet-resolved dependency matches any of the
- ``PRE_INCLUDE_REGEXES``, steps 2 and 3 are skipped, and the dependency
- resolution proceeds to step 4.
-
- 2. If the not-yet-resolved dependency matches any of the
- ``PRE_EXCLUDE_REGEXES``, dependency resolution stops for that dependency.
-
- 3. Otherwise, dependency resolution proceeds.
-
- 4. ``file(GET_RUNTIME_DEPENDENCIES)`` searches for the dependency according
- to the linking rules of the platform (see below).
-
- 5. If the dependency is found, and its full path matches one of the
- ``POST_INCLUDE_REGEXES`` or ``POST_INCLUDE_FILES``, the full path is added
- to the resolved dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)``
- recursively resolves that library's own dependencies. Otherwise, resolution
- proceeds to step 6.
-
- 6. If the dependency is found, but its full path matches one of the
- ``POST_EXCLUDE_REGEXES`` or ``POST_EXCLUDE_FILES``, it is not added to the
- resolved dependencies, and dependency resolution stops for that dependency.
-
- 7. If the dependency is found, and its full path does not match either
- ``POST_INCLUDE_REGEXES``, ``POST_INCLUDE_FILES``, ``POST_EXCLUDE_REGEXES``,
- or ``POST_EXCLUDE_FILES``, the full path is added to the resolved
- dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` recursively resolves
- that library's own dependencies.
-
- Different platforms have different rules for how dependencies are resolved.
- These specifics are described here.
-
- On Linux platforms, library resolution works as follows:
-
- 1. If the depending file does not have any ``RUNPATH`` entries, and the
- library exists in one of the depending file's ``RPATH`` entries, or its
- parents', in that order, the dependency is resolved to that file.
- 2. Otherwise, if the depending file has any ``RUNPATH`` entries, and the
- library exists in one of those entries, the dependency is resolved to that
- file.
- 3. Otherwise, if the library exists in one of the directories listed by
- ``ldconfig``, the dependency is resolved to that file.
- 4. Otherwise, if the library exists in one of the ``DIRECTORIES`` entries,
- the dependency is resolved to that file. In this case, a warning is
- issued, because finding a file in one of the ``DIRECTORIES`` means that
- the depending file is not complete (it does not list all the directories
- from which it pulls dependencies).
-
- 5. Otherwise, the dependency is unresolved.
-
- On Windows platforms, library resolution works as follows:
-
- 1. DLL dependency names are converted to lowercase for matching filters.
- Windows DLL names are case-insensitive, and some linkers mangle the
- case of the DLL dependency names. However, this makes it more difficult
- for ``PRE_INCLUDE_REGEXES``, ``PRE_EXCLUDE_REGEXES``,
- ``POST_INCLUDE_REGEXES``, and ``POST_EXCLUDE_REGEXES`` to properly
- filter DLL names - every regex would have to check for both uppercase
- and lowercase letters. For example:
-
- .. code-block:: cmake
-
- file(GET_RUNTIME_DEPENDENCIES
- # ...
- PRE_INCLUDE_REGEXES "^[Mm][Yy][Ll][Ii][Bb][Rr][Aa][Rr][Yy]\\.[Dd][Ll][Ll]$"
- )
-
- Converting the DLL name to lowercase allows the regexes to only match
- lowercase names, thus simplifying the regex. For example:
-
- .. code-block:: cmake
-
- file(GET_RUNTIME_DEPENDENCIES
- # ...
- PRE_INCLUDE_REGEXES "^mylibrary\\.dll$"
- )
-
- This regex will match ``mylibrary.dll`` regardless of how it is cased,
- either on disk or in the depending file. (For example, it will match
- ``mylibrary.dll``, ``MyLibrary.dll``, and ``MYLIBRARY.DLL``.)
-
- .. versionchanged:: 3.27
-
- The conversion to lowercase only applies while matching filters.
- Results reported after filtering case-preserve each DLL name as it is
- found on disk, if resolved, and otherwise as it is referenced by the
- dependent binary.
-
- Prior to CMake 3.27, the results were reported with lowercase DLL
- file names, but the directory portion retained its casing.
-
- 2. (**Not yet implemented**) If the depending file is a Windows Store app,
- and the dependency is listed as a dependency in the application's package
- manifest, the dependency is resolved to that file.
-
- 3. Otherwise, if the library exists in the same directory as the depending
- file, the dependency is resolved to that file.
-
- 4. Otherwise, if the library exists in either the operating system's
- ``system32`` directory or the ``Windows`` directory, in that order, the
- dependency is resolved to that file.
-
- 5. Otherwise, if the library exists in one of the directories specified by
- ``DIRECTORIES``, in the order they are listed, the dependency is resolved
- to that file. In this case, a warning is not issued, because searching
- other directories is a normal part of Windows library resolution.
-
- 6. Otherwise, the dependency is unresolved.
-
- On Apple platforms, library resolution works as follows:
-
- 1. If the dependency starts with ``@executable_path/``, and an
- ``EXECUTABLES`` argument is in the process of being resolved, and
- replacing ``@executable_path/`` with the directory of the executable
- yields an existing file, the dependency is resolved to that file.
-
- 2. Otherwise, if the dependency starts with ``@executable_path/``, and there
- is a ``BUNDLE_EXECUTABLE`` argument, and replacing ``@executable_path/``
- with the directory of the bundle executable yields an existing file, the
- dependency is resolved to that file.
-
- 3. Otherwise, if the dependency starts with ``@loader_path/``, and replacing
- ``@loader_path/`` with the directory of the depending file yields an
- existing file, the dependency is resolved to that file.
-
- 4. Otherwise, if the dependency starts with ``@rpath/``, and replacing
- ``@rpath/`` with one of the ``RPATH`` entries of the depending file
- yields an existing file, the dependency is resolved to that file.
- Note that ``RPATH`` entries that start with ``@executable_path/`` or
- ``@loader_path/`` also have these items replaced with the appropriate
- path.
-
- 5. Otherwise, if the dependency is an absolute file that exists,
- the dependency is resolved to that file.
-
- 6. Otherwise, the dependency is unresolved.
-
- This function accepts several variables that determine which tool is used for
- dependency resolution:
-
- .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
-
- Determines which operating system and executable format the files are built
- for. This could be one of several values:
-
- * ``linux+elf``
- * ``windows+pe``
- * ``macos+macho``
-
- If this variable is not specified, it is determined automatically by system
- introspection.
-
- .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
-
- Determines the tool to use for dependency resolution. It could be one of
- several values, depending on the value of
- :variable:`CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`:
-
- ================================================= =============================================
- ``CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`` ``CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL``
- ================================================= =============================================
- ``linux+elf`` ``objdump``
- ``windows+pe`` ``objdump`` or ``dumpbin``
- ``macos+macho`` ``otool``
- ================================================= =============================================
-
- If this variable is not specified, it is determined automatically by system
- introspection.
-
- .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
-
- Determines the path to the tool to use for dependency resolution. This is
- the actual path to ``objdump``, ``dumpbin``, or ``otool``.
-
- If this variable is not specified, it is determined by the value of
- ``CMAKE_OBJDUMP`` if set, else by system introspection.
-
- .. versionadded:: 3.18
- Use ``CMAKE_OBJDUMP`` if set.
-
Writing
^^^^^^^
@@ -1097,6 +783,15 @@ Transfer
is not specified, the value of the :variable:`CMAKE_NETRC_FILE` variable
will be used instead.
+ ``TLS_VERSION <min>``
+ .. versionadded:: 3.30
+
+ Specify minimum TLS version for ``https://`` URLs.
+ If this option is not specified, the value of the
+ :variable:`CMAKE_TLS_VERSION` variable or :envvar:`CMAKE_TLS_VERSION`
+ environment variable will be used instead.
+ See :variable:`CMAKE_TLS_VERSION` for allowed values.
+
``TLS_VERIFY <ON|OFF>``
Specify whether to verify the server certificate for ``https://`` URLs.
The default is to *not* verify. If this option is not specified, the
@@ -1266,3 +961,323 @@ Archiving
timestamp instead of extracting file timestamps from the archive.
With ``VERBOSE``, the command will produce verbose output.
+
+Handling Runtime Binaries
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. signature::
+ file(GET_RUNTIME_DEPENDENCIES [...])
+
+ .. versionadded:: 3.16
+
+ Recursively get the list of libraries depended on by the given files:
+
+ .. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ [RESOLVED_DEPENDENCIES_VAR <deps_var>]
+ [UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>]
+ [CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>]
+ [EXECUTABLES <executable_files>...]
+ [LIBRARIES <library_files>...]
+ [MODULES <module_files>...]
+ [DIRECTORIES <directories>...]
+ [BUNDLE_EXECUTABLE <bundle_executable_file>]
+ [PRE_INCLUDE_REGEXES <regexes>...]
+ [PRE_EXCLUDE_REGEXES <regexes>...]
+ [POST_INCLUDE_REGEXES <regexes>...]
+ [POST_EXCLUDE_REGEXES <regexes>...]
+ [POST_INCLUDE_FILES <files>...]
+ [POST_EXCLUDE_FILES <files>...]
+ )
+
+ Please note that this sub-command is not intended to be used in project mode.
+ It is intended for use at install time, either from code generated by the
+ :command:`install(RUNTIME_DEPENDENCY_SET)` command, or from code provided by
+ the project via :command:`install(CODE)` or :command:`install(SCRIPT)`.
+ For example:
+
+ .. code-block:: cmake
+
+ install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ )
+ ]])
+
+ The arguments are as follows:
+
+ ``RESOLVED_DEPENDENCIES_VAR <deps_var>``
+ Name of the variable in which to store the list of resolved dependencies.
+
+ ``UNRESOLVED_DEPENDENCIES_VAR <unresolved_deps_var>``
+ Name of the variable in which to store the list of unresolved
+ dependencies. If this variable is not specified, and there are any
+ unresolved dependencies, an error is issued.
+
+ ``CONFLICTING_DEPENDENCIES_PREFIX <conflicting_deps_prefix>``
+ Variable prefix in which to store conflicting dependency information.
+ Dependencies are conflicting if two files with the same name are found in
+ two different directories. The list of filenames that conflict are stored
+ in ``<conflicting_deps_prefix>_FILENAMES``. For each filename, the list
+ of paths that were found for that filename are stored in
+ ``<conflicting_deps_prefix>_<filename>``.
+
+ ``EXECUTABLES <executable_files>...``
+ List of executable files to read for dependencies. These are executables
+ that are typically created with :command:`add_executable`, but they do
+ not have to be created by CMake. On Apple platforms, the paths to these
+ files determine the value of ``@executable_path`` when recursively
+ resolving the libraries. Specifying any kind of library (``STATIC``,
+ ``MODULE``, or ``SHARED``) here will result in undefined behavior.
+
+ ``LIBRARIES <library_files>...``
+ List of library files to read for dependencies. These are libraries that
+ are typically created with :command:`add_library(SHARED)`, but they do
+ not have to be created by CMake. Specifying ``STATIC`` libraries,
+ ``MODULE`` libraries, or executables here will result in undefined
+ behavior.
+
+ ``MODULES <module_files>...``
+ List of loadable module files to read for dependencies. These are modules
+ that are typically created with :command:`add_library(MODULE)`, but they
+ do not have to be created by CMake. They are typically used by calling
+ ``dlopen()`` at runtime rather than linked at link time with ``ld -l``.
+ Specifying ``STATIC`` libraries, ``SHARED`` libraries, or executables
+ here will result in undefined behavior.
+
+ ``DIRECTORIES <directories>...``
+ List of additional directories to search for dependencies. On Linux
+ platforms, these directories are searched if the dependency is not found
+ in any of the other usual paths. If it is found in such a directory, a
+ warning is issued, because it means that the file is incomplete (it does
+ not list all of the directories that contain its dependencies).
+ On Windows platforms, these directories are searched if the dependency
+ is not found in any of the other search paths, but no warning is issued,
+ because searching other paths is a normal part of Windows dependency
+ resolution. On Apple platforms, this argument has no effect.
+
+ ``BUNDLE_EXECUTABLE <bundle_executable_file>``
+ Executable to treat as the "bundle executable" when resolving libraries.
+ On Apple platforms, this argument determines the value of
+ ``@executable_path`` when recursively resolving libraries for
+ ``LIBRARIES`` and ``MODULES`` files. It has no effect on ``EXECUTABLES``
+ files. On other platforms, it has no effect. This is typically (but not
+ always) one of the executables in the ``EXECUTABLES`` argument which
+ designates the "main" executable of the package.
+
+ The following arguments specify filters for including or excluding libraries
+ to be resolved. See below for a full description of how they work.
+
+ ``PRE_INCLUDE_REGEXES <regexes>...``
+ List of pre-include regexes through which to filter the names of
+ not-yet-resolved dependencies.
+
+ ``PRE_EXCLUDE_REGEXES <regexes>...``
+ List of pre-exclude regexes through which to filter the names of
+ not-yet-resolved dependencies.
+
+ ``POST_INCLUDE_REGEXES <regexes>...``
+ List of post-include regexes through which to filter the names of
+ resolved dependencies.
+
+ ``POST_EXCLUDE_REGEXES <regexes>...``
+ List of post-exclude regexes through which to filter the names of
+ resolved dependencies.
+
+ ``POST_INCLUDE_FILES <files>...``
+ .. versionadded:: 3.21
+
+ List of post-include filenames through which to filter the names of
+ resolved dependencies. Symlinks are resolved when attempting to match
+ these filenames.
+
+ ``POST_EXCLUDE_FILES <files>...``
+ .. versionadded:: 3.21
+
+ List of post-exclude filenames through which to filter the names of
+ resolved dependencies. Symlinks are resolved when attempting to match
+ these filenames.
+
+ These arguments can be used to exclude unwanted system libraries when
+ resolving the dependencies, or to include libraries from a specific
+ directory. The filtering works as follows:
+
+ 1. If the not-yet-resolved dependency matches any of the
+ ``PRE_INCLUDE_REGEXES``, steps 2 and 3 are skipped, and the dependency
+ resolution proceeds to step 4.
+
+ 2. If the not-yet-resolved dependency matches any of the
+ ``PRE_EXCLUDE_REGEXES``, dependency resolution stops for that dependency.
+
+ 3. Otherwise, dependency resolution proceeds.
+
+ 4. ``file(GET_RUNTIME_DEPENDENCIES)`` searches for the dependency according
+ to the linking rules of the platform (see below).
+
+ 5. If the dependency is found, and its full path matches one of the
+ ``POST_INCLUDE_REGEXES`` or ``POST_INCLUDE_FILES``, the full path is added
+ to the resolved dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)``
+ recursively resolves that library's own dependencies. Otherwise, resolution
+ proceeds to step 6.
+
+ 6. If the dependency is found, but its full path matches one of the
+ ``POST_EXCLUDE_REGEXES`` or ``POST_EXCLUDE_FILES``, it is not added to the
+ resolved dependencies, and dependency resolution stops for that dependency.
+
+ 7. If the dependency is found, and its full path does not match either
+ ``POST_INCLUDE_REGEXES``, ``POST_INCLUDE_FILES``, ``POST_EXCLUDE_REGEXES``,
+ or ``POST_EXCLUDE_FILES``, the full path is added to the resolved
+ dependencies, and ``file(GET_RUNTIME_DEPENDENCIES)`` recursively resolves
+ that library's own dependencies.
+
+ Different platforms have different rules for how dependencies are resolved.
+ These specifics are described here.
+
+ On Linux platforms, library resolution works as follows:
+
+ 1. If the depending file does not have any ``RUNPATH`` entries, and the
+ library exists in one of the depending file's ``RPATH`` entries, or its
+ parents', in that order, the dependency is resolved to that file.
+ 2. Otherwise, if the depending file has any ``RUNPATH`` entries, and the
+ library exists in one of those entries, the dependency is resolved to that
+ file.
+ 3. Otherwise, if the library exists in one of the directories listed by
+ ``ldconfig``, the dependency is resolved to that file.
+ 4. Otherwise, if the library exists in one of the ``DIRECTORIES`` entries,
+ the dependency is resolved to that file. In this case, a warning is
+ issued, because finding a file in one of the ``DIRECTORIES`` means that
+ the depending file is not complete (it does not list all the directories
+ from which it pulls dependencies).
+
+ 5. Otherwise, the dependency is unresolved.
+
+ On Windows platforms, library resolution works as follows:
+
+ 1. DLL dependency names are converted to lowercase for matching filters.
+ Windows DLL names are case-insensitive, and some linkers mangle the
+ case of the DLL dependency names. However, this makes it more difficult
+ for ``PRE_INCLUDE_REGEXES``, ``PRE_EXCLUDE_REGEXES``,
+ ``POST_INCLUDE_REGEXES``, and ``POST_EXCLUDE_REGEXES`` to properly
+ filter DLL names - every regex would have to check for both uppercase
+ and lowercase letters. For example:
+
+ .. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ PRE_INCLUDE_REGEXES "^[Mm][Yy][Ll][Ii][Bb][Rr][Aa][Rr][Yy]\\.[Dd][Ll][Ll]$"
+ )
+
+ Converting the DLL name to lowercase allows the regexes to only match
+ lowercase names, thus simplifying the regex. For example:
+
+ .. code-block:: cmake
+
+ file(GET_RUNTIME_DEPENDENCIES
+ # ...
+ PRE_INCLUDE_REGEXES "^mylibrary\\.dll$"
+ )
+
+ This regex will match ``mylibrary.dll`` regardless of how it is cased,
+ either on disk or in the depending file. (For example, it will match
+ ``mylibrary.dll``, ``MyLibrary.dll``, and ``MYLIBRARY.DLL``.)
+
+ .. versionchanged:: 3.27
+
+ The conversion to lowercase only applies while matching filters.
+ Results reported after filtering case-preserve each DLL name as it is
+ found on disk, if resolved, and otherwise as it is referenced by the
+ dependent binary.
+
+ Prior to CMake 3.27, the results were reported with lowercase DLL
+ file names, but the directory portion retained its casing.
+
+ 2. (**Not yet implemented**) If the depending file is a Windows Store app,
+ and the dependency is listed as a dependency in the application's package
+ manifest, the dependency is resolved to that file.
+
+ 3. Otherwise, if the library exists in the same directory as the depending
+ file, the dependency is resolved to that file.
+
+ 4. Otherwise, if the library exists in either the operating system's
+ ``system32`` directory or the ``Windows`` directory, in that order, the
+ dependency is resolved to that file.
+
+ 5. Otherwise, if the library exists in one of the directories specified by
+ ``DIRECTORIES``, in the order they are listed, the dependency is resolved
+ to that file. In this case, a warning is not issued, because searching
+ other directories is a normal part of Windows library resolution.
+
+ 6. Otherwise, the dependency is unresolved.
+
+ On Apple platforms, library resolution works as follows:
+
+ 1. If the dependency starts with ``@executable_path/``, and an
+ ``EXECUTABLES`` argument is in the process of being resolved, and
+ replacing ``@executable_path/`` with the directory of the executable
+ yields an existing file, the dependency is resolved to that file.
+
+ 2. Otherwise, if the dependency starts with ``@executable_path/``, and there
+ is a ``BUNDLE_EXECUTABLE`` argument, and replacing ``@executable_path/``
+ with the directory of the bundle executable yields an existing file, the
+ dependency is resolved to that file.
+
+ 3. Otherwise, if the dependency starts with ``@loader_path/``, and replacing
+ ``@loader_path/`` with the directory of the depending file yields an
+ existing file, the dependency is resolved to that file.
+
+ 4. Otherwise, if the dependency starts with ``@rpath/``, and replacing
+ ``@rpath/`` with one of the ``RPATH`` entries of the depending file
+ yields an existing file, the dependency is resolved to that file.
+ Note that ``RPATH`` entries that start with ``@executable_path/`` or
+ ``@loader_path/`` also have these items replaced with the appropriate
+ path.
+
+ 5. Otherwise, if the dependency is an absolute file that exists,
+ the dependency is resolved to that file.
+
+ 6. Otherwise, the dependency is unresolved.
+
+ This function accepts several variables that determine which tool is used for
+ dependency resolution:
+
+ .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM
+
+ Determines which operating system and executable format the files are built
+ for. This could be one of several values:
+
+ * ``linux+elf``
+ * ``windows+pe``
+ * ``macos+macho``
+
+ If this variable is not specified, it is determined automatically by system
+ introspection.
+
+ .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL
+
+ Determines the tool to use for dependency resolution. It could be one of
+ several values, depending on the value of
+ :variable:`CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`:
+
+ ================================================= =============================================
+ ``CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM`` ``CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL``
+ ================================================= =============================================
+ ``linux+elf`` ``objdump``
+ ``windows+pe`` ``objdump`` or ``dumpbin``
+ ``macos+macho`` ``otool``
+ ================================================= =============================================
+
+ If this variable is not specified, it is determined automatically by system
+ introspection.
+
+ .. variable:: CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND
+
+ Determines the path to the tool to use for dependency resolution. This is
+ the actual path to ``objdump``, ``dumpbin``, or ``otool``.
+
+ If this variable is not specified, it is determined by the value of
+ ``CMAKE_OBJDUMP`` if set, else by system introspection.
+
+ .. versionadded:: 3.18
+ Use ``CMAKE_OBJDUMP`` if set.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 2f01653..6bd56a1 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -136,15 +136,16 @@ The following characters have special meaning in regular expressions:
or ``\\`` for a literal backslash ``\``. Escaping a non-special
character is unnecessary but allowed, e.g. ``\a`` matches ``a``.
``[ ]``
- Matches any character(s) inside the brackets
+ Matches any character(s) inside the brackets.
+ To match a literal ``]``, make it the first character, e.g., ``[]ab]``.
``[^ ]``
- Matches any character(s) not inside the brackets
+ Matches any character(s) not inside the brackets.
+ To not match a literal ``]``, make it the first character, e.g., ``[^]ab]``.
``-``
- Inside brackets, specifies an inclusive range between
- characters on either side e.g. ``[a-f]`` is ``[abcdef]``
- To match a literal ``-`` using brackets, make it the first
- or the last character e.g. ``[+*/-]`` matches basic
- mathematical operators.
+ Inside brackets, specifies an inclusive range between characters on
+ either side, e.g., ``[a-f]`` is ``[abcdef]``.
+ To match a literal ``-`` using brackets, make it the first or the last
+ character, e.g., ``[+*/-]`` matches basic mathematical operators.
``*``
Matches preceding pattern zero or more times
``+``
diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst
index 2290efb..5796b00 100644
--- a/Help/command/target_compile_definitions.rst
+++ b/Help/command/target_compile_definitions.rst
@@ -15,7 +15,7 @@ named ``<target>`` must have been created by a command such as
:ref:`ALIAS target <Alias Targets>`.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the following arguments.
+specify the :ref:`scope <Target Command Scope>` of the following arguments.
``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_DEFINITIONS`
property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` property of ``<target>``.
diff --git a/Help/command/target_compile_options.rst b/Help/command/target_compile_options.rst
index 7cfb24b..64f45aa 100644
--- a/Help/command/target_compile_options.rst
+++ b/Help/command/target_compile_options.rst
@@ -28,7 +28,7 @@ instead of being appended. See policy :policy:`CMP0101` which affects
whether ``BEFORE`` will be ignored in certain cases.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the following arguments.
+specify the :ref:`scope <Target Command Scope>` of the following arguments.
``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`COMPILE_OPTIONS`
property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_COMPILE_OPTIONS` property of ``<target>``.
diff --git a/Help/command/target_include_directories.rst b/Help/command/target_include_directories.rst
index 2a410ec..bb5f9c3 100644
--- a/Help/command/target_include_directories.rst
+++ b/Help/command/target_include_directories.rst
@@ -18,7 +18,7 @@ By using ``AFTER`` or ``BEFORE`` explicitly, you can select between appending
and prepending, independent of the default.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to specify
-the :ref:`scope <Target Usage Requirements>` of the following arguments.
+the :ref:`scope <Target Command Scope>` of the following arguments.
``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`INCLUDE_DIRECTORIES`
property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` property of ``<target>``.
diff --git a/Help/command/target_link_directories.rst b/Help/command/target_link_directories.rst
index 2854c96..67d3352 100644
--- a/Help/command/target_link_directories.rst
+++ b/Help/command/target_link_directories.rst
@@ -21,7 +21,7 @@ The named ``<target>`` must have been created by a command such as
:ref:`ALIAS target <Alias Targets>`.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the items that follow
+specify the :ref:`scope <Target Command Scope>` of the items that follow
them. ``PRIVATE`` and ``PUBLIC`` items will populate the
:prop_tgt:`LINK_DIRECTORIES` property of ``<target>``. ``PUBLIC`` and
``INTERFACE`` items will populate the :prop_tgt:`INTERFACE_LINK_DIRECTORIES`
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index 68d3598..a82adda 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -153,7 +153,7 @@ Libraries for a Target and/or its Dependents
[<PRIVATE|PUBLIC|INTERFACE> <item>...]...)
The ``PUBLIC``, ``PRIVATE`` and ``INTERFACE``
-:ref:`scope <Target Usage Requirements>` keywords can be used to
+:ref:`scope <Target Command Scope>` keywords can be used to
specify both the link dependencies and the link interface in one command.
Libraries and targets following ``PUBLIC`` are linked to, and are made
diff --git a/Help/command/target_link_options.rst b/Help/command/target_link_options.rst
index dca9598..7561c99 100644
--- a/Help/command/target_link_options.rst
+++ b/Help/command/target_link_options.rst
@@ -32,7 +32,7 @@ If ``BEFORE`` is specified, the content will be prepended to the property
instead of being appended.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the following arguments.
+specify the :ref:`scope <Target Command Scope>` of the following arguments.
``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`LINK_OPTIONS`
property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_LINK_OPTIONS` property of ``<target>``.
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 50eaf22..61ea0aa 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -25,7 +25,7 @@ The named ``<target>`` must have been created by a command such as
:ref:`ALIAS target <Alias Targets>`.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the following arguments.
+specify the :ref:`scope <Target Command Scope>` of the following arguments.
``PRIVATE`` and ``PUBLIC`` items will populate the :prop_tgt:`PRECOMPILE_HEADERS`
property of ``<target>``. ``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` property of ``<target>``
diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst
index 40755c5..0d31f8c 100644
--- a/Help/command/target_sources.rst
+++ b/Help/command/target_sources.rst
@@ -22,7 +22,7 @@ The named ``<target>`` must have been created by a command such as
``<target>`` can be a custom target.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
-specify the :ref:`scope <Target Usage Requirements>` of the source file paths
+specify the :ref:`scope <Target Command Scope>` of the source file paths
(``<items>``) that follow them. ``PRIVATE`` and ``PUBLIC`` items will
populate the :prop_tgt:`SOURCES` property of ``<target>``, which are used when
building the target itself. ``PUBLIC`` and ``INTERFACE`` items will populate the
diff --git a/Help/cpack_gen/innosetup.rst b/Help/cpack_gen/innosetup.rst
index f48e7f5..ffdf508 100644
--- a/Help/cpack_gen/innosetup.rst
+++ b/Help/cpack_gen/innosetup.rst
@@ -12,7 +12,11 @@ The generator provides a lot of options like components. Unfortunately, not
all features (e.g. component dependencies) are currently supported by
Inno Setup and they're ignored by the generator for now.
-CPack requires Inno Setup 6 or greater and only works on Windows.
+CPack requires Inno Setup 6 or greater.
+
+.. versionadded:: 3.30
+ The generator is now available on non-Windows hosts,
+ but requires Wine to run the Inno Setup tools.
Variables specific to CPack Inno Setup generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/Help/cpack_gen/wix.rst b/Help/cpack_gen/wix.rst
index cb56c9d..dfa3434 100644
--- a/Help/cpack_gen/wix.rst
+++ b/Help/cpack_gen/wix.rst
@@ -1,10 +1,103 @@
CPack WIX Generator
-------------------
-CPack WIX generator specific options
+Use the `WiX Toolset`_ to produce a Windows Installer ``.msi`` database.
+
+.. _`WiX Toolset`: https://wixtoolset.org/
.. versionadded:: 3.7
- Support :variable:`CPACK_COMPONENT_<compName>_DISABLED` variable.
+ The :variable:`CPACK_COMPONENT_<compName>_DISABLED` variable is now
+ supported.
+
+WiX Toolsets
+^^^^^^^^^^^^
+
+CPack selects one of the following variants of the WiX Toolset
+based on the :variable:`CPACK_WIX_VERSION` variable:
+
+* `WiX .NET Tools`_
+* `WiX Toolset v3`_
+
+WiX .NET Tools
+""""""""""""""
+
+Packaging is performed using the following tools:
+
+``wix build``
+ Build WiX source files directly into a Windows Installer ``.msi`` database.
+
+ Invocations may be customized using tool-specific variables:
+
+ * :variable:`CPACK_WIX_BUILD_EXTENSIONS <CPACK_WIX_<TOOL>_EXTENSIONS>`
+ * :variable:`CPACK_WIX_BUILD_EXTRA_FLAGS <CPACK_WIX_<TOOL>_EXTRA_FLAGS>`
+
+WiX extensions must be named with the form ``WixToolset.<Name>.wixext``.
+
+CPack expects the ``wix`` .NET tool to be available for command-line use
+with any required WiX extensions already installed. Be sure the ``wix``
+version is compatible with :variable:`CPACK_WIX_VERSION`, and that WiX
+extension versions match the ``wix`` tool version. For example:
+
+1. Install the ``wix`` command-line tool using ``dotnet``.
+
+ To install ``wix`` globally for the current user:
+
+ .. code-block:: bat
+
+ dotnet tool install --global wix --version 4.0.4
+
+ This places ``wix.exe`` in ``%USERPROFILE%\.dotnet\tools`` and adds
+ the directory to the current user's ``PATH`` environment variable.
+
+ Or, to install ``wix`` in a specific path, e.g., in ``c:\WiX``:
+
+ .. code-block:: bat
+
+ dotnet tool install --tool-path c:\WiX wix --version 4.0.4
+
+ This places ``wix.exe`` in ``c:\WiX``, but does *not* add it to the
+ current user's ``PATH`` environment variable. The ``WIX`` environment
+ variable may be set to tell CPack where to find the tool,
+ e.g., ``set WIX=c:\WiX``.
+
+2. Add the WiX ``UI`` extension, needed by CPack's default WiX template:
+
+ .. code-block:: bat
+
+ wix extension add --global WixToolset.UI.wixext/4.0.4
+
+ Extensions added globally are stored in ``%USERPROFILE%\.wix``, or if the
+ ``WIX_EXTENSIONS`` environment variable is set, in ``%WIX_EXTENSIONS%\.wix``.
+
+WiX Toolset v3
+""""""""""""""
+
+Packaging is performed using the following tools:
+
+``candle``
+ Compiles WiX source files into ``.wixobj`` files.
+
+ Invocations may be customized using tool-specific variables:
+
+ * :variable:`CPACK_WIX_CANDLE_EXTENSIONS <CPACK_WIX_<TOOL>_EXTENSIONS>`
+ * :variable:`CPACK_WIX_CANDLE_EXTRA_FLAGS <CPACK_WIX_<TOOL>_EXTRA_FLAGS>`
+
+``light``
+ Links ``.wixobj`` files into a Windows Installer ``.msi`` database.
+
+ Invocations may be customized using tool-specific variables:
+
+ * :variable:`CPACK_WIX_LIGHT_EXTENSIONS <CPACK_WIX_<TOOL>_EXTENSIONS>`
+ * :variable:`CPACK_WIX_LIGHT_EXTRA_FLAGS <CPACK_WIX_<TOOL>_EXTRA_FLAGS>`
+
+CPack invokes both tools as needed. Intermediate ``.wixobj`` files
+are considered implementation details.
+
+WiX extensions must be named with the form ``Wix<Name>Extension``.
+
+CPack expects the above tools to be available for command-line
+use via the ``PATH``. Or, if the ``WIX`` environment variable is set,
+CPack looks for the tools in ``%WIX%`` and ``%WIX%\bin``.
Variables specific to CPack WIX generator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -12,6 +105,19 @@ Variables specific to CPack WIX generator
The following variables are specific to the installers built on
Windows using WiX.
+.. variable:: CPACK_WIX_VERSION
+
+ .. versionadded:: 3.30
+
+ Specify the version of WiX Toolset for which the configuration
+ is written. The value must be one of
+
+ ``4``
+ Package using `WiX .NET Tools`_.
+
+ ``3``
+ Package using `WiX Toolset v3`_. This is the default.
+
.. variable:: CPACK_WIX_UPGRADE_GUID
Upgrade GUID (``Product/@UpgradeCode``)
@@ -68,8 +174,13 @@ Windows using WiX.
.. variable:: CPACK_WIX_UI_REF
- This variable allows you to override the Id of the ``<UIRef>`` element
- in the WiX template.
+ Specify the WiX ``UI`` extension's dialog set:
+
+ * With `WiX .NET Tools`_, this is the Id of the
+ ``<ui:WixUI>`` element in the default WiX template.
+
+ * With `WiX Toolset v3`_, this is the Id of the
+ ``<UIRef>`` element in the default WiX template.
The default is ``WixUI_InstallDir`` in case no CPack components have
been defined and ``WixUI_FeatureTree`` otherwise.
@@ -107,7 +218,7 @@ Windows using WiX.
Language(s) of the installer
- Languages are compiled into the WixUI extension library. To use them,
+ Languages are compiled into the Wix ``UI`` extension library. To use them,
simply provide the name of the culture. If you specify more than one
culture identifier in a comma or semicolon delimited list, the first one
that is found will be used. You can find a list of supported languages at:
@@ -196,39 +307,35 @@ Windows using WiX.
Extra WiX source files
- This variable provides an optional list of extra WiX source files (.wxs)
- that should be compiled and linked. The full path to source files is
- required.
+ This variable provides an optional list of extra WiX source files (``.wxs``)
+ that should be compiled and linked. The paths must be absolute.
.. variable:: CPACK_WIX_EXTRA_OBJECTS
- Extra WiX object files or libraries
+ Extra WiX object files or libraries to use with `WiX Toolset v3`_.
- This variable provides an optional list of extra WiX object (.wixobj)
- and/or WiX library (.wixlib) files. The full path to objects and libraries
- is required.
+ This variable provides an optional list of extra WiX object (``.wixobj``)
+ and/or WiX library (``.wixlib``) files. The paths must be absolute.
.. variable:: CPACK_WIX_EXTENSIONS
- This variable provides a list of additional extensions for the WiX
- tools light and candle.
+ Specify a list of additional extensions for WiX tools.
+ See `WiX Toolsets`_ for extension naming patterns.
.. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
- This is the tool specific version of CPACK_WIX_EXTENSIONS.
- ``<TOOL>`` can be either LIGHT or CANDLE.
+ Specify a list of additional extensions for a specific WiX tool.
+ See `WiX Toolsets`_ for possible ``<TOOL>`` names.
.. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
- This list variable allows you to pass additional
- flags to the WiX tool ``<TOOL>``.
+ Specify a list of additional command-line flags for a specific WiX tool.
+ See `WiX Toolsets`_ for possible ``<TOOL>`` names.
Use it at your own risk.
Future versions of CPack may generate flags which may be in conflict
with your own flags.
- ``<TOOL>`` can be either LIGHT or CANDLE.
-
.. variable:: CPACK_WIX_CMAKE_PACKAGE_REGISTRY
If this variable is set the generated installer will create
@@ -326,9 +433,9 @@ Windows using WiX.
.. versionadded:: 3.23
- If this variable is set then the inclusion of WixUIExtensions is skipped,
- i.e. the ``-ext "WixUIExtension"`` command line is not included during
- the execution of the WiX light tool.
+ If this variable is set to true, the default inclusion of the WiX ``UI``
+ extension is skipped, i.e., the ``-ext WixUIExtension`` or
+ ``-ext WixToolset.UI.wixext`` flag is not passed to WiX tools.
.. variable:: CPACK_WIX_ARCHITECTURE
@@ -357,6 +464,9 @@ Windows using WiX.
``NONE``
Create an installer without any ``InstallScope`` attribute.
+ This is not supported if :variable:`CPACK_WIX_VERSION` is set
+ to any value other than ``3``.
+
.. deprecated:: 3.29
This value is only for compatibility with the inconsistent behavior used
diff --git a/Help/dev/experimental.rst b/Help/dev/experimental.rst
index fc4ac8b..93298c5 100644
--- a/Help/dev/experimental.rst
+++ b/Help/dev/experimental.rst
@@ -38,3 +38,24 @@ When activated, this experimental feature provides the following:
* The package name associated with specific targets may be specified
using the ``CMAKE_EXPORT_FIND_PACKAGE_NAME`` variable and/or
``EXPORT_FIND_PACKAGE_NAME`` target property.
+
+C++ ``import std`` support
+==========================
+
+In order to activate support for ``import std`` in C++23 and newer targets,
+set
+
+* variable ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` to
+* value ``0e5b6991-d74f-4b3d-a41c-cf096e0b2508``.
+
+This UUID may change in future versions of CMake. Be sure to use the value
+documented here by the source tree of the version of CMake with which you are
+experimenting.
+
+When activated, this experimental feature provides the following:
+
+* The :prop_tgt:`CXX_MODULE_STD` target property and its initializing variable
+ :variable:`CMAKE_CXX_MODULE_STD`.
+
+* Targets with the property set to a true value and at least ``cxx_std_23``
+ may use ``import std;`` in any scanned C++ source file.
diff --git a/Help/envvar/CMAKE_TLS_VERIFY.rst b/Help/envvar/CMAKE_TLS_VERIFY.rst
new file mode 100644
index 0000000..9571cb8
--- /dev/null
+++ b/Help/envvar/CMAKE_TLS_VERIFY.rst
@@ -0,0 +1,15 @@
+CMAKE_TLS_VERIFY
+----------------
+
+.. versionadded:: 3.30
+
+.. include:: ENV_VAR.txt
+
+Specify the default value for the :command:`file(DOWNLOAD)` and
+:command:`file(UPLOAD)` commands' ``TLS_VERIFY`` option.
+This environment variable is used if the option is not given
+and the :variable:`CMAKE_TLS_VERIFY` cmake variable is not set.
+
+This variable is also used by the :module:`ExternalProject` and
+:module:`FetchContent` modules for internal calls to
+:command:`file(DOWNLOAD)` and ``git clone``.
diff --git a/Help/envvar/CMAKE_TLS_VERSION.rst b/Help/envvar/CMAKE_TLS_VERSION.rst
new file mode 100644
index 0000000..c411861
--- /dev/null
+++ b/Help/envvar/CMAKE_TLS_VERSION.rst
@@ -0,0 +1,16 @@
+CMAKE_TLS_VERSION
+-----------------
+
+.. versionadded:: 3.30
+
+.. include:: ENV_VAR.txt
+
+Specify the default value for the :command:`file(DOWNLOAD)` and
+:command:`file(UPLOAD)` commands' ``TLS_VERSION`` option.
+This environment variable is used if the option is not given
+and the :variable:`CMAKE_TLS_VERSION` cmake variable is not set.
+See that variable for allowed values.
+
+This variable is also used by the :module:`ExternalProject` and
+:module:`FetchContent` modules for internal calls to
+:command:`file(DOWNLOAD)` and ``git clone``.
diff --git a/Help/envvar/OBJCFLAGS.rst b/Help/envvar/OBJCFLAGS.rst
new file mode 100644
index 0000000..2f30807
--- /dev/null
+++ b/Help/envvar/OBJCFLAGS.rst
@@ -0,0 +1,14 @@
+OBJCFLAGS
+---------
+
+.. versionadded:: 3.16
+
+.. include:: ENV_VAR.txt
+
+Add default compilation flags to be used when compiling ``Objective C`` files.
+
+.. |CMAKE_LANG_FLAGS| replace:: :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>`
+.. |LANG| replace:: ``OBJC``
+.. include:: LANG_FLAGS.txt
+
+See also :variable:`CMAKE_OBJC_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/envvar/OBJCXXFLAGS.rst b/Help/envvar/OBJCXXFLAGS.rst
new file mode 100644
index 0000000..089222a
--- /dev/null
+++ b/Help/envvar/OBJCXXFLAGS.rst
@@ -0,0 +1,14 @@
+OBJCXXFLAGS
+-----------
+
+.. versionadded:: 3.16
+
+.. include:: ENV_VAR.txt
+
+Add default compilation flags to be used when compiling ``Objective C++`` (.mm) files.
+
+.. |CMAKE_LANG_FLAGS| replace:: :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>`
+.. |LANG| replace:: ``OBJCXX``
+.. include:: LANG_FLAGS.txt
+
+See also :variable:`CMAKE_OBJCXX_FLAGS_INIT <CMAKE_<LANG>_FLAGS_INIT>`.
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index fb1e7d4..b8ea1ce 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -108,7 +108,9 @@
.. versionadded:: 3.21
Specify the cross compiling toolchain file, equivalent to setting
- :variable:`CMAKE_TOOLCHAIN_FILE` variable.
+ :variable:`CMAKE_TOOLCHAIN_FILE` variable. Relative paths are interpreted as
+ relative to the build directory, and if not found, relative to the source
+ directory.
.. option:: --install-prefix <directory>
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index b88b864..9eca05d 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -162,102 +162,278 @@ or :command:`file(GENERATE)` by using ``$<TARGET_OBJECTS:objlib>``.
Build Specification and Usage Requirements
==========================================
-The :command:`target_include_directories`, :command:`target_compile_definitions`
-and :command:`target_compile_options` commands specify the build specifications
-and the usage requirements of binary targets. The commands populate the
-:prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS` and
-:prop_tgt:`COMPILE_OPTIONS` target properties respectively, and/or the
-:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`, :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`
-and :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties.
-
-Each of the commands has a ``PRIVATE``, ``PUBLIC`` and ``INTERFACE`` mode. The
-``PRIVATE`` mode populates only the non-``INTERFACE_`` variant of the target
-property and the ``INTERFACE`` mode populates only the ``INTERFACE_`` variants.
-The ``PUBLIC`` mode populates both variants of the respective target property.
-Each command may be invoked with multiple uses of each keyword:
+Targets build according to their own
+`build specification <Target Build Specification_>`_ in combination with
+`usage requirements <Target Usage Requirements_>`_ propagated from their
+link dependencies. Both may be specified using target-specific
+`commands <Target Commands_>`_.
-.. code-block:: cmake
-
- target_compile_definitions(archive
- PRIVATE BUILDING_WITH_LZMA
- INTERFACE USING_ARCHIVE_LIB
- )
-
-Note that usage requirements are not designed as a way to make downstreams
-use particular :prop_tgt:`COMPILE_OPTIONS` or
-:prop_tgt:`COMPILE_DEFINITIONS` etc for convenience only. The contents of
-the properties must be **requirements**, not merely recommendations or
-convenience.
-
-See the :ref:`Creating Relocatable Packages` section of the
-:manual:`cmake-packages(7)` manual for discussion of additional care
-that must be taken when specifying usage requirements while creating
-packages for redistribution.
-
-Target Properties
------------------
-
-The contents of the :prop_tgt:`INCLUDE_DIRECTORIES`,
-:prop_tgt:`COMPILE_DEFINITIONS` and :prop_tgt:`COMPILE_OPTIONS` target
-properties are used appropriately when compiling the source files of a
-binary target.
-
-Entries in the :prop_tgt:`INCLUDE_DIRECTORIES` are added to the compile line
-with ``-I`` or ``-isystem`` prefixes and in the order of appearance in the
-property value.
-
-Entries in the :prop_tgt:`COMPILE_DEFINITIONS` are prefixed with ``-D`` or
-``/D`` and added to the compile line in an unspecified order. The
-:prop_tgt:`DEFINE_SYMBOL` target property is also added as a compile
-definition as a special convenience case for ``SHARED`` and ``MODULE``
-library targets.
-
-Entries in the :prop_tgt:`COMPILE_OPTIONS` are escaped for the shell and added
-in the order of appearance in the property value. Several compile options have
-special separate handling, such as :prop_tgt:`POSITION_INDEPENDENT_CODE`.
-
-The contents of the :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
-:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` and
-:prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties are
-*Usage Requirements* -- they specify content which consumers
-must use to correctly compile and link with the target they appear on.
-For any binary target, the contents of each ``INTERFACE_`` property on
-each target specified in a :command:`target_link_libraries` command is
-consumed:
+For example:
.. code-block:: cmake
- set(srcs archive.cpp zip.cpp)
- if (LZMA_FOUND)
- list(APPEND srcs lzma.cpp)
- endif()
- add_library(archive SHARED ${srcs})
+ add_library(archive SHARED archive.cpp zip.cpp)
+
if (LZMA_FOUND)
- # The archive library sources are compiled with -DBUILDING_WITH_LZMA
+ # Add a source implementing support for lzma.
+ target_sources(archive PRIVATE lzma.cpp)
+
+ # Compile the 'archive' library sources with '-DBUILDING_WITH_LZMA'.
target_compile_definitions(archive PRIVATE BUILDING_WITH_LZMA)
endif()
+
target_compile_definitions(archive INTERFACE USING_ARCHIVE_LIB)
- add_executable(consumer)
- # Link consumer to archive and consume its usage requirements. The consumer
- # executable sources are compiled with -DUSING_ARCHIVE_LIB.
+ add_executable(consumer consumer.cpp)
+
+ # Link 'consumer' to 'archive'. This also consumes its usage requirements,
+ # so 'consumer.cpp' is compiled with '-DUSING_ARCHIVE_LIB'.
target_link_libraries(consumer archive)
-Because it is common to require that the source directory and corresponding
-build directory are added to the :prop_tgt:`INCLUDE_DIRECTORIES`, the
-:variable:`CMAKE_INCLUDE_CURRENT_DIR` variable can be enabled to conveniently
-add the corresponding directories to the :prop_tgt:`INCLUDE_DIRECTORIES` of
-all targets. The variable :variable:`CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE`
-can be enabled to add the corresponding directories to the
-:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of all targets. This makes use of
-targets in multiple different directories convenient through use of the
-:command:`target_link_libraries` command.
+Target Commands
+---------------
+
+Target-specific commands populate the
+`build specification <Target Build Specification_>`_ of `Binary Targets`_ and
+`usage requirements <Target Usage Requirements_>`_ of `Binary Targets`_,
+`Interface Libraries`_, and `Imported Targets`_.
+
+.. _`Target Command Scope`:
+
+Invocations must specify scope keywords, each affecting the visibility
+of arguments following it. The scopes are:
+
+``PUBLIC``
+ Populates both properties for `building <Target Build Specification_>`_
+ and properties for `using <Target Usage Requirements_>`_ a target.
+
+``PRIVATE``
+ Populates only properties for `building <Target Build Specification_>`_
+ a target.
+
+``INTERFACE``
+ Populates only properties for `using <Target Usage Requirements_>`_
+ a target.
+
+The commands are:
+
+:command:`target_compile_definitions`
+ Populates the :prop_tgt:`COMPILE_DEFINITIONS` build specification and
+ :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS` usage requirement properties.
+
+ For example, the call
+
+ .. code-block:: cmake
+
+ target_compile_definitions(archive
+ PRIVATE BUILDING_WITH_LZMA
+ INTERFACE USING_ARCHIVE_LIB
+ )
+
+ appends ``BUILDING_WITH_LZMA`` to the target's ``COMPILE_DEFINITIONS``
+ property and appends ``USING_ARCHIVE_LIB`` to the target's
+ ``INTERFACE_COMPILE_DEFINITIONS`` property.
+
+:command:`target_compile_options`
+ Populates the :prop_tgt:`COMPILE_OPTIONS` build specification and
+ :prop_tgt:`INTERFACE_COMPILE_OPTIONS` usage requirement properties.
+
+:command:`target_compile_features`
+ .. versionadded:: 3.1
+
+ Populates the :prop_tgt:`COMPILE_FEATURES` build specification and
+ :prop_tgt:`INTERFACE_COMPILE_FEATURES` usage requirement properties.
+
+:command:`target_include_directories`
+ Populates the :prop_tgt:`INCLUDE_DIRECTORIES` build specification
+ and :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` usage requirement
+ properties. With the ``SYSTEM`` option, it also populates the
+ :prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES` usage requirement.
+
+ For convenience, the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable
+ may be enabled to add the source directory and corresponding build
+ directory as ``INCLUDE_DIRECTORIES`` on all targets. Similarly,
+ the :variable:`CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE` variable may
+ be enabled to add them as ``INTERFACE_INCLUDE_DIRECTORIES`` on all
+ targets.
+
+:command:`target_sources`
+ .. versionadded:: 3.1
+
+ Populates the :prop_tgt:`SOURCES` build specification and
+ :prop_tgt:`INTERFACE_SOURCES` usage requirement properties.
+
+ It also supports specifying :ref:`File Sets`, which can add C++ module
+ sources and headers not listed in the ``SOURCES`` and ``INTERFACE_SOURCES``
+ properties. File sets may also populate the :prop_tgt:`INCLUDE_DIRECTORIES`
+ build specification and :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` usage
+ requirement properties with the include directories containing the headers.
+
+:command:`target_precompile_headers`
+ .. versionadded:: 3.16
+
+ Populates the :prop_tgt:`PRECOMPILE_HEADERS` build specification and
+ :prop_tgt:`INTERFACE_PRECOMPILE_HEADERS` usage requirement properties.
+
+:command:`target_link_libraries`
+ Populates the :prop_tgt:`LINK_LIBRARIES` build specification
+ and :prop_tgt:`INTERFACE_LINK_LIBRARIES` usage requirement properties.
+
+ This is the primary mechanism by which link dependencies and their
+ `usage requirements <Target Usage Requirements_>`_ are transitively
+ propagated to affect compilation and linking of a target.
+
+:command:`target_link_directories`
+ .. versionadded:: 3.13
+
+ Populates the :prop_tgt:`LINK_DIRECTORIES` build specification and
+ :prop_tgt:`INTERFACE_LINK_DIRECTORIES` usage requirement properties.
+
+:command:`target_link_options`
+ .. versionadded:: 3.13
+
+ Populates the :prop_tgt:`LINK_OPTIONS` build specification and
+ :prop_tgt:`INTERFACE_LINK_OPTIONS` usage requirement properties.
+
+.. _`Target Build Specification`:
+
+Target Build Specification
+--------------------------
+
+The build specification of `Binary Targets`_ is represented by target
+properties. For each of the following `build <Target Build Properties_>`_
+and `link <Target Link Properties_>`_ properties, compilation and linking
+of the target is affected both by its own value and by the corresponding
+`usage requirement <Target Usage Requirements_>`_ property, named with
+an ``INTERFACE_`` prefix, collected from the transitive closure of link
+dependencies.
+
+.. _`Target Build Properties`:
+
+Target Build Properties
+^^^^^^^^^^^^^^^^^^^^^^^
+
+:prop_tgt:`COMPILE_DEFINITIONS`
+ List of compile definitions for compiling sources in the target.
+ These are passed to the compiler with ``-D`` flags, or equivalent,
+ in an unspecified order.
+
+ The :prop_tgt:`DEFINE_SYMBOL` target property is also used
+ as a compile definition as a special convenience case for
+ ``SHARED`` and ``MODULE`` library targets.
+
+:prop_tgt:`COMPILE_OPTIONS`
+ List of compile options for compiling sources in the target.
+ These are passed to the compiler as flags, in the order of appearance.
+
+ Compile options are automatically escaped for the shell.
+
+ Some compile options are best specified via dedicated settings,
+ such as the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property.
+
+:prop_tgt:`COMPILE_FEATURES`
+ .. versionadded:: 3.1
+
+ List of :manual:`compile features <cmake-compile-features(7)>` needed
+ for compiling sources in the target. Typically these ensure the
+ target's sources are compiled using a sufficient language standard level.
+
+:prop_tgt:`INCLUDE_DIRECTORIES`
+ List of include directories for compiling sources in the target.
+ These are passed to the compiler with ``-I`` or ``-isystem`` flags,
+ or equivalent, in the order of appearance.
+
+ For convenience, the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable
+ may be enabled to add the source directory and corresponding build
+ directory as ``INCLUDE_DIRECTORIES`` on all targets.
+
+:prop_tgt:`SOURCES`
+ List of source files associated with the target. This includes sources
+ specified when the target was created by the :command:`add_executable`,
+ :command:`add_library`, or :command:`add_custom_target` command.
+ It also includes sources added by the :command:`target_sources` command,
+ but does not include :ref:`File Sets`.
+
+:prop_tgt:`PRECOMPILE_HEADERS`
+ .. versionadded:: 3.16
+
+ List of header files to precompile and include when compiling
+ sources in the target.
+
+:prop_tgt:`AUTOMOC_MACRO_NAMES`
+ .. versionadded:: 3.10
+
+ List of macro names used by :prop_tgt:`AUTOMOC` to determine if a
+ C++ source in the target needs to be processed by ``moc``.
+
+:prop_tgt:`AUTOUIC_OPTIONS`
+ .. versionadded:: 3.0
+
+ List of options used by :prop_tgt:`AUTOUIC` when invoking ``uic``
+ for the target.
+
+.. _`Target Link Properties`:
+
+Target Link Properties
+^^^^^^^^^^^^^^^^^^^^^^
+
+:prop_tgt:`LINK_LIBRARIES`
+ List of link libraries for linking the target, if it is an executable,
+ shared library, or module library. Entries for `Normal Libraries`_ are
+ passed to the linker either via paths to their link artifacts, or
+ with ``-l`` flags or equivalent. Entries for `Object Libraries`_ are
+ passed to the linker via paths to their object files.
+
+ Additionally, for compiling and linking the target itself,
+ `usage requirements <Target Usage Requirements_>`_ are propagated from
+ ``LINK_LIBRARIES`` entries naming `Normal Libraries`_,
+ `Interface Libraries`_, `Object Libraries`_, and `Imported Targets`_,
+ collected over the transitive closure of their
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES` properties.
+
+:prop_tgt:`LINK_DIRECTORIES`
+ .. versionadded:: 3.13
+
+ List of link directories for linking the target, if it is an executable,
+ shared library, or module library. The directories are passed to the
+ linker with ``-L`` flags, or equivalent.
+
+:prop_tgt:`LINK_OPTIONS`
+ .. versionadded:: 3.13
+
+ List of link options for linking the target, if it is an executable,
+ shared library, or module library. The options are passed to the
+ linker as flags, in the order of appearance.
+
+ Link options are automatically escaped for the shell.
+
+:prop_tgt:`LINK_DEPENDS`
+ List of files on which linking the target depends, if it is an executable,
+ shared library, or module library. For example, linker scripts specified
+ via :prop_tgt:`LINK_OPTIONS` may be listed here such that changing them
+ causes binaries to be linked again.
.. _`Target Usage Requirements`:
-Transitive Usage Requirements
------------------------------
+Target Usage Requirements
+-------------------------
+
+The *usage requirements* of a target are settings that propagate to consumers,
+which link to the target via :command:`target_link_libraries`, in order to
+correctly compile and link with it. They are represented by transitive
+`build <Transitive Build Properties_>`_ and
+`link <Transitive Link Properties_>`_ properties.
+
+Note that usage requirements are not designed as a way to make downstreams
+use particular :prop_tgt:`COMPILE_OPTIONS`, :prop_tgt:`COMPILE_DEFINITIONS`,
+etc. for convenience only. The contents of the properties must be
+**requirements**, not merely recommendations.
+
+See the :ref:`Creating Relocatable Packages` section of the
+:manual:`cmake-packages(7)` manual for discussion of additional care
+that must be taken when specifying usage requirements while creating
+packages for redistribution.
The usage requirements of a target can transitively propagate to the dependents.
The :command:`target_link_libraries` command has ``PRIVATE``,
@@ -329,6 +505,91 @@ Note that care must be taken when specifying usage requirements for targets
which will be exported for installation using the :command:`install(EXPORT)`
command. See :ref:`Creating Packages` for more.
+.. _`Transitive Build Properties`:
+
+Transitive Build Properties
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+:prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`
+ List of compile definitions for compiling sources in the target's consumers.
+ Typically these are used by the target's header files.
+
+:prop_tgt:`INTERFACE_COMPILE_OPTIONS`
+ List of compile options for compiling sources in the target's consumers.
+
+:prop_tgt:`INTERFACE_COMPILE_FEATURES`
+ .. versionadded:: 3.1
+
+ List of :manual:`compile features <cmake-compile-features(7)>` needed
+ for compiling sources in the target's consumers. Typically these
+ ensure the target's header files are processed when compiling consumers
+ using a sufficient language standard level.
+
+:prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`
+ List of include directories for compiling sources in the target's consumers.
+ Typically these are the locations of the target's header files.
+
+:prop_tgt:`INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`
+ List of directories that, when specified as include directories, e.g., by
+ :prop_tgt:`INCLUDE_DIRECTORIES` or :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES`,
+ should be treated as "system" include directories when compiling sources
+ in the target's consumers.
+
+:prop_tgt:`INTERFACE_SOURCES`
+ List of source files to associate with the target's consumers.
+
+:prop_tgt:`INTERFACE_PRECOMPILE_HEADERS`
+ .. versionadded:: 3.16
+
+ List of header files to precompile and include when compiling
+ sources in the target's consumers.
+
+:prop_tgt:`INTERFACE_AUTOMOC_MACRO_NAMES`
+ .. versionadded:: 3.27
+
+ List of macro names used by :prop_tgt:`AUTOMOC` to determine if a
+ C++ source in the target's consumers needs to be processed by ``moc``.
+
+:prop_tgt:`INTERFACE_AUTOUIC_OPTIONS`
+ .. versionadded:: 3.0
+
+ List of options used by :prop_tgt:`AUTOUIC` when invoking ``uic``
+ for the target's consumers.
+
+.. _`Transitive Link Properties`:
+
+Transitive Link Properties
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+:prop_tgt:`INTERFACE_LINK_LIBRARIES`
+ List of link libraries for linking the target's consumers, for
+ those that are executables, shared libraries, or module libraries.
+ These are the transitive dependencies of the target.
+
+ Additionally, for compiling and linking the target's consumers,
+ `usage requirements <Target Usage Requirements_>`_ are collected from
+ the transitive closure of ``INTERFACE_LINK_LIBRARIES`` entries naming
+ `Normal Libraries`_, `Interface Libraries`_, `Object Libraries`_,
+ and `Imported Targets`_,
+
+:prop_tgt:`INTERFACE_LINK_DIRECTORIES`
+ .. versionadded:: 3.13
+
+ List of link directories for linking the target's consumers, for
+ those that are executables, shared libraries, or module libraries.
+
+:prop_tgt:`INTERFACE_LINK_OPTIONS`
+ .. versionadded:: 3.13
+
+ List of link options for linking the target's consumers, for
+ those that are executables, shared libraries, or module libraries.
+
+:prop_tgt:`INTERFACE_LINK_DEPENDS`
+ .. versionadded:: 3.13
+
+ List of files on which linking the target's consumers depends, for
+ those that are executables, shared libraries, or module libraries.
+
.. _`Compatible Interface Properties`:
Compatible Interface Properties
diff --git a/Help/manual/cmake-cxxmodules.7.rst b/Help/manual/cmake-cxxmodules.7.rst
index 3ee6645..840d65f 100644
--- a/Help/manual/cmake-cxxmodules.7.rst
+++ b/Help/manual/cmake-cxxmodules.7.rst
@@ -12,6 +12,49 @@ to scan source files for module dependencies during the build, collates
scanning results to infer ordering constraints, and tells the build tool
how to dynamically update the build graph.
+Compilation Strategy
+====================
+
+With C++ modules, compiling a set of C++ sources is no longer embarrassingly
+parallel. That is, any given source may first require the compilation of
+another source file first in order to provide a "CMI" (compiled module
+interface) or "BMI" (binary module interface) that C++ compilers use to
+satisfy ``import`` statements in other sources. With headers, sources could
+share their declarations so that any consumers could compile independently.
+With modules, declarations are now generated into these BMI files by the
+compiler during compilation based on the contents of the source file and its
+``export`` statements.
+
+The order necessary for compilation requires build-time resolution of the
+ordering because the order is controlled by the contents of the sources. This
+means that the ordering needs extracted from the source during the build to
+avoid regenerating the build graph via a configure and generate phase for
+every source change to get a correct build.
+
+The general strategy is to use a "scanner" to extract the ordering dependency
+information and update the build graph with new edges between existing edges
+by taking the per-source scan results (represented by `P1689R5`_ files) and
+"collating" the dependencies within a target and to modules produced by
+targets visible to the target. The primary task is to generate "module map"
+files to pass to each compile rule with the paths to the BMIs needed to
+satisfy ``import`` statements. The collator also has tasks to use the
+build-time information to fill out information including ``install`` rules for
+the module interface units, their BMIs, and properties for any exported
+targets with C++ modules.
+
+.. _`P1689R5`: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p1689r5.html
+
+.. note:
+
+ CMake is focusing on correct builds before looking at performance
+ improvements. There are known tactics within the chosen strategy which may
+ offer build performance improvements. However, they are being deferred
+ until we have a working model against which to compare them. It is also
+ important to note that a tactic useful in one situation (e.g., clean
+ builds) may not be performant in a different situation (e.g., incremental
+ builds). Finding a balance and offering controls to select the tactics is
+ future work.
+
Scanning Control
================
@@ -43,6 +86,25 @@ Compilers which CMake natively supports module dependency scanning include:
* LLVM/Clang 16.0 and newer
* GCC 14 (for the in-development branch, after 2023-09-20) and newer
+``import std`` Support
+======================
+
+Support for ``import std`` is limited to the following toolchain and standard
+library combinations:
+
+* Clang 18.1.2 and newer with ``-stdlib=libc++``
+* MSVC toolset 14.36 and newer (provided with Visual Studio 17.6 Preview 2 and
+ newer)
+
+The :variable:`CMAKE_CXX_COMPILER_IMPORT_STD` variable may be used to detect
+support for a standard level with the active C++ toolchain.
+
+.. note ::
+
+ This support is provided only when experimental support for
+ ``import std;`` has been enabled by the
+ ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` gate.
+
Generator Support
=================
@@ -73,6 +135,7 @@ For the :ref:`Visual Studio Generators`:
- Only Visual Studio 2022 and MSVC toolsets 14.34 (Visual Studio
17.4) and newer.
- No support for exporting or installing BMI or module information.
-- No support for compiling BMIs from ``IMPORTED`` targets with C++ modules.
+- No support for compiling BMIs from ``IMPORTED`` targets with C++ modules
+ (including ``import std``).
- No diagnosis of using modules provided by ``PRIVATE`` sources from
``PUBLIC`` module sources.
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index a09bd14..cebe8f9 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -119,7 +119,8 @@ do.
The more modern approach is to behave as much like
:ref:`config file packages <Config File Packages>` files as possible, by
providing :ref:`imported target <Imported targets>`. This has the advantage
-of propagating :ref:`Target Usage Requirements` to consumers.
+of propagating :ref:`usage requirements <Target Usage Requirements>`
+to consumers.
In either case (or even when providing both variables and imported
targets), find modules should provide backwards compatibility with old
diff --git a/Help/manual/cmake-env-variables.7.rst b/Help/manual/cmake-env-variables.7.rst
index 3ab5935..a69ace6 100644
--- a/Help/manual/cmake-env-variables.7.rst
+++ b/Help/manual/cmake-env-variables.7.rst
@@ -27,6 +27,8 @@ Environment Variables that Change Behavior
/envvar/CMAKE_MAXIMUM_RECURSION_DEPTH
/envvar/CMAKE_PREFIX_PATH
/envvar/CMAKE_PROGRAM_PATH
+ /envvar/CMAKE_TLS_VERIFY
+ /envvar/CMAKE_TLS_VERSION
/envvar/SSL_CERT_DIR
/envvar/SSL_CERT_FILE
@@ -90,7 +92,9 @@ Environment Variables for Languages
/envvar/ISPC
/envvar/ISPCFLAGS
/envvar/OBJC
+ /envvar/OBJCFLAGS
/envvar/OBJCXX
+ /envvar/OBJCXXFLAGS
/envvar/RC
/envvar/RCFLAGS
/envvar/SWIFTC
diff --git a/Help/manual/cmake-file-api.7.rst b/Help/manual/cmake-file-api.7.rst
index c249ee2..260030e 100644
--- a/Help/manual/cmake-file-api.7.rst
+++ b/Help/manual/cmake-file-api.7.rst
@@ -1489,7 +1489,7 @@ There is only one ``cmakeFiles`` object major version, version 1.
{
"kind": "cmakeFiles",
- "version": { "major": 1, "minor": 0 },
+ "version": { "major": 1, "minor": 1 },
"paths": {
"build": "/path/to/top-level-build-dir",
"source": "/path/to/top-level-source-dir"
@@ -1511,6 +1511,16 @@ There is only one ``cmakeFiles`` object major version, version 1.
"isExternal": true,
"path": "/path/to/cmake/Modules/CMakeGenericSystem.cmake"
}
+ ],
+ "globsDependent": [
+ {
+ "expression": "src/*.cxx",
+ "recurse": true,
+ "files": [
+ "src/foo.cxx",
+ "src/bar.cxx"
+ ]
+ }
]
}
@@ -1553,6 +1563,44 @@ The members specific to ``cmakeFiles`` objects are:
Optional member that is present with boolean value ``true``
if the path specifies a file in the CMake installation.
+``globsDependent``
+ Optional member that is present when the project calls :command:`file(GLOB)`
+ or :command:`file(GLOB_RECURSE)` with the ``CONFIGURE_DEPENDS`` option.
+ The value is a JSON array of JSON objects, each specifying a globbing
+ expression and the list of paths it matched. If the globbing expression
+ no longer matches the same list of paths, CMake considers the build system
+ to be out of date.
+
+ This field was added in ``cmakeFiles`` version 1.1.
+
+ The members of each entry are:
+
+ ``expression``
+ A string specifying the globbing expression.
+
+ ``recurse``
+ Optional member that is present with boolean value ``true``
+ if the entry corresponds to a :command:`file(GLOB_RECURSE)` call.
+ Otherwise the entry corresponds to a :command:`file(GLOB)` call.
+
+ ``listDirectories``
+ Optional member that is present with boolean value ``true`` if
+ :command:`file(GLOB)` was called without ``LIST_DIRECTORIES false`` or
+ :command:`file(GLOB_RECURSE)` was called with ``LIST_DIRECTORIES true``.
+
+ ``followSymlinks``
+ Optional member that is present with boolean value ``true`` if
+ :command:`file(GLOB)` was called with the ``FOLLOW_SYMLINKS`` option.
+
+ ``relative``
+ Optional member that is present if :command:`file(GLOB)` was called
+ with the ``RELATIVE <path>`` option. The value is a string containing
+ the ``<path>`` given.
+
+ ``paths``
+ A JSON array of strings specifying the paths matched by the call
+ to :command:`file(GLOB)` or :command:`file(GLOB_RECURSE)`.
+
Object Kind "toolchains"
------------------------
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index a0b5b66..31f0573 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -1281,7 +1281,8 @@ Compile Context
.. versionadded:: 3.27
- Content of ``...``, when collecting :ref:`Target Usage Requirements`,
+ Content of ``...``, when collecting
+ :ref:`transitive build properties <Transitive Build Properties>`,
otherwise it is the empty string. This is intended for use in an
:prop_tgt:`INTERFACE_LINK_LIBRARIES` and :prop_tgt:`LINK_LIBRARIES` target
properties, typically populated via the :command:`target_link_libraries` command.
@@ -1669,7 +1670,8 @@ Link Context
.. versionadded:: 3.1
- Content of ``...``, except while collecting :ref:`Target Usage Requirements`,
+ Content of ``...``, except while collecting usage requirements from
+ :ref:`transitive build properties <Transitive Build Properties>`,
in which case it is the empty string. This is intended for use in an
:prop_tgt:`INTERFACE_LINK_LIBRARIES` target property, typically populated
via the :command:`target_link_libraries` command, to specify private link
@@ -1700,22 +1702,15 @@ Link Context
only be used to specify link options.
-.. _`Target-Dependent Queries`:
+.. _`Target-Dependent Expressions`:
Target-Dependent Expressions
----------------------------
-These queries refer to a target ``tgt``. Unless otherwise stated, this can
-be any runtime artifact, namely:
-
-* An executable target created by :command:`add_executable`.
-* A shared library target (``.so``, ``.dll`` but not their ``.lib`` import
- library) created by :command:`add_library`.
-* A static library target created by :command:`add_library`.
+Target Meta-Data
+^^^^^^^^^^^^^^^^
-In the following, the phrase "the ``tgt`` filename" means the name of the
-``tgt`` binary file. This has to be distinguished from the phrase
-"the target name", which is just the string ``tgt``.
+These expressions look up information about a target.
.. genex:: $<TARGET_EXISTS:tgt>
@@ -1732,11 +1727,27 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on.
-.. genex:: $<TARGET_NAME:...>
+.. genex:: $<TARGET_NAME:tgt>
+
+ The target name ``tgt`` as written. This marks ``tgt`` as being the name
+ of a target inside a larger expression, which is required if exporting
+ targets to multiple dependent export sets. The ``tgt`` text must be a
+ literal name of a target; it may not contain generator expressions.
+ The target does not have to exist.
+
+.. genex:: $<TARGET_POLICY:policy>
+
+ ``1`` if the ``policy`` was ``NEW`` when the 'head' target was created,
+ else ``0``. If the ``policy`` was not set, the warning message for the policy
+ will be emitted. This generator expression only works for a subset of
+ policies.
+
- Marks ``...`` as being the name of a target. This is required if exporting
- targets to multiple dependent export sets. The ``...`` must be a literal
- name of a target, it may not contain generator expressions.
+Target Properties
+^^^^^^^^^^^^^^^^^
+
+These expressions look up the values of
+:ref:`target properties <Target Properties>`.
.. genex:: $<TARGET_PROPERTY:tgt,prop>
@@ -1756,23 +1767,64 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
:target: TARGET_PROPERTY:prop
Value of the property ``prop`` on the target for which the expression
- is being evaluated. Note that for generator expressions in
+ is being evaluated. Note that for generator expressions in
:ref:`Target Usage Requirements` this is the consuming target rather
than the target specifying the requirement.
-.. genex:: $<TARGET_OBJECTS:tgt>
+The expressions have special evaluation rules for some properties:
- .. versionadded:: 3.1
+* :ref:`Target Build Specification` properties evaluate as a
+ :ref:`semicolon-separated list <CMake Language Lists>` representing the union
+ of the value on the target itself with the values of the corresponding
+ :ref:`Target Usage Requirements` on targets named by the target's
+ :prop_tgt:`LINK_LIBRARIES`. Evaluation of the usage requirements is
+ transitive over the closure of the linked targets'
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
- List of objects resulting from building ``tgt``. This would typically be
- used on :ref:`object library <Object Libraries>` targets.
+ Evaluation of :prop_tgt:`LINK_LIBRARIES` itself is not transitive.
-.. genex:: $<TARGET_POLICY:policy>
+* :ref:`Target Usage Requirements` evaluate as a
+ :ref:`semicolon-separated list <CMake Language Lists>` representing the union
+ of the value on the target itself with the values of the same properties on
+ targets named by the target's :prop_tgt:`INTERFACE_LINK_LIBRARIES`.
+ Evaluation is transitive over the closure of the target's
+ :prop_tgt:`INTERFACE_LINK_LIBRARIES`:
- ``1`` if the ``policy`` was ``NEW`` when the 'head' target was created,
- else ``0``. If the ``policy`` was not set, the warning message for the policy
- will be emitted. This generator expression only works for a subset of
- policies.
+ * For :ref:`Transitive Build Properties`, the transitive closure
+ *excludes* entries of :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
+ by the :genex:`LINK_ONLY` generator expression.
+
+ * For :ref:`Transitive Link Properties`, the transitive closure is
+ *includes* entries of :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
+ by the :genex:`LINK_ONLY` generator expression.
+ See policy :policy:`CMP0166`.
+
+ Evaluation of :prop_tgt:`INTERFACE_LINK_LIBRARIES` itself is not transitive.
+
+* :ref:`Compatible Interface Properties` evaluate as a single value
+ combined from the target itself, from targets named by the target's
+ :prop_tgt:`LINK_LIBRARIES`, and from the transitive closure of the
+ linked targets' :prop_tgt:`INTERFACE_LINK_LIBRARIES`. Values of a
+ compatible interface property from multiple targets combine based on
+ the type of compatibility required by the ``COMPATIBLE_INTERFACE_*``
+ property defining it.
+
+
+Target Artifacts
+^^^^^^^^^^^^^^^^
+
+These expressions look up information about artifacts associated with
+a given target ``tgt``. Unless otherwise stated, this can be any
+runtime artifact, namely:
+
+* An executable target created by :command:`add_executable`.
+* A shared library target (``.so``, ``.dll`` but not their ``.lib`` import
+ library) created by :command:`add_library`.
+* A static library target created by :command:`add_library`.
+
+In the following, the phrase "the ``tgt`` filename" means the name of the
+``tgt`` binary file. This has to be distinguished from the phrase
+"the target name", which is just the string ``tgt``.
.. genex:: $<TARGET_FILE:tgt>
@@ -2254,6 +2306,13 @@ In the following, the phrase "the ``tgt`` filename" means the name of the
Note that ``tgt`` is not added as a dependency of the target this
expression is evaluated on (see policy :policy:`CMP0112`).
+.. genex:: $<TARGET_OBJECTS:tgt>
+
+ .. versionadded:: 3.1
+
+ List of objects resulting from building ``tgt``. This would typically be
+ used on :ref:`object library <Object Libraries>` targets.
+
.. genex:: $<TARGET_RUNTIME_DLLS:tgt>
.. versionadded:: 3.21
@@ -2410,6 +2469,13 @@ special meaning.
A literal ``;``. Used to prevent list expansion on an argument with ``;``.
+.. genex:: $<QUOTE>
+
+ .. versionadded:: 3.30
+
+ A literal ``"``. Used to allow string literal quotes inside a generator expression.
+
+
Deprecated Expressions
----------------------
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index bb6cfd4..826790d 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -51,6 +51,18 @@ The :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable may also be used
to determine whether to report an error on use of deprecated macros or
functions.
+Policies Introduced by CMake 3.30
+=================================
+
+.. toctree::
+ :maxdepth: 1
+
+ CMP0166: TARGET_PROPERTY evaluates link properties transitively over private dependencies of static libraries. </policy/CMP0166>
+ CMP0165: enable_language() must not be called before project(). </policy/CMP0165>
+ CMP0164: add_library() rejects SHARED libraries when not supported by the platform. </policy/CMP0164>
+ CMP0163: The GENERATED source file property is now visible in all directories. </policy/CMP0163>
+ CMP0162: Visual Studio generators add UseDebugLibraries indicators by default. </policy/CMP0162>
+
Policies Introduced by CMake 3.29
=================================
@@ -118,7 +130,7 @@ Policies Introduced by CMake 3.24
CMP0138: CheckIPOSupported uses flags from calling project. </policy/CMP0138>
CMP0137: try_compile() passes platform variables in project mode. </policy/CMP0137>
CMP0136: Watcom runtime library flags are selected by an abstraction. </policy/CMP0136>
- CMP0135: ExternalProject ignores timestamps in archives by default for the URL download method. </policy/CMP0135>
+ CMP0135: ExternalProject and FetchContent ignore timestamps in archives by default for the URL download method. </policy/CMP0135>
CMP0134: Fallback to "HOST" Windows registry view when "TARGET" view is not usable. </policy/CMP0134>
CMP0133: The CPack module disables SLA by default in the CPack DragNDrop Generator. </policy/CMP0133>
CMP0132: Do not set compiler environment variables on first run. </policy/CMP0132>
@@ -163,7 +175,7 @@ Policies Introduced by CMake 3.20
CMP0120: The WriteCompilerDetectionHeader module is removed. </policy/CMP0120>
CMP0119: LANGUAGE source file property explicitly compiles as language. </policy/CMP0119>
- CMP0118: The GENERATED source file property is now visible in all directories. </policy/CMP0118>
+ CMP0118: GENERATED sources may be used across directories without manual marking. </policy/CMP0118>
CMP0117: MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default. </policy/CMP0117>
CMP0116: Ninja generators transform DEPFILEs from add_custom_command(). </policy/CMP0116>
CMP0115: Source file extensions must be explicit. </policy/CMP0115>
@@ -203,7 +215,7 @@ Policies Introduced by CMake 3.17
CMP0102: mark_as_advanced() does nothing if a cache entry does not exist. </policy/CMP0102>
CMP0101: target_compile_options honors BEFORE keyword in all scopes. </policy/CMP0101>
CMP0100: Let AUTOMOC and AUTOUIC process .hh header files. </policy/CMP0100>
- CMP0099: Link properties are transitive over private dependency on static libraries. </policy/CMP0099>
+ CMP0099: Link properties are transitive over private dependencies of static libraries. </policy/CMP0099>
CMP0098: FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing. </policy/CMP0098>
Policies Introduced by CMake 3.16
diff --git a/Help/manual/cmake-presets.7.rst b/Help/manual/cmake-presets.7.rst
index fc0e1f9..5e91ae5 100644
--- a/Help/manual/cmake-presets.7.rst
+++ b/Help/manual/cmake-presets.7.rst
@@ -78,6 +78,9 @@ The root object recognizes the following fields:
``8``
.. versionadded:: 3.28
+ ``9``
+ .. versionadded:: 3.30
+
``cmakeMinimumRequired``
An optional object representing the minimum version of CMake needed to
build this project. This object consists of the following fields:
@@ -146,7 +149,9 @@ guaranteed to be provided by the project. ``CMakeUserPresets.json`` may
include files from anywhere.
Starting from version ``7``, the ``include`` field supports
-`macro expansion`_, but only ``$penv{}`` macro expansion.
+`macro expansion`_, but only ``$penv{}`` macro expansion. Starting from version
+``9``, other macro expansions are also available, except for preset specific
+ones (e.g. ``presetName``), and ``$env{}``.
Configure Preset
^^^^^^^^^^^^^^^^
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 0d1046a..7e640df 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -194,6 +194,7 @@ Properties on Targets
/prop_tgt/CXX_MODULE_SET
/prop_tgt/CXX_MODULE_SET_NAME
/prop_tgt/CXX_MODULE_SETS
+ /prop_tgt/CXX_MODULE_STD
/prop_tgt/CXX_SCAN_FOR_MODULES
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_STANDARD_REQUIRED
@@ -445,7 +446,9 @@ Properties on Targets
/prop_tgt/VS_SDK_REFERENCES
/prop_tgt/VS_SOLUTION_DEPLOY
/prop_tgt/VS_SOURCE_SETTINGS_tool
+ /prop_tgt/VS_USE_DEBUG_LIBRARIES
/prop_tgt/VS_USER_PROPS
+ /prop_tgt/VS_FILTER_PROPS
/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
/prop_tgt/VS_WINRT_COMPONENT
/prop_tgt/VS_WINRT_REFERENCES
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 8a5ab30..8f98f8b 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -137,6 +137,7 @@ Variables that Provide Information
/variable/CMAKE_VS_TARGET_FRAMEWORK_IDENTIFIER
/variable/CMAKE_VS_TARGET_FRAMEWORK_TARGETS_VERSION
/variable/CMAKE_VS_TARGET_FRAMEWORK_VERSION
+ /variable/CMAKE_VS_USE_DEBUG_LIBRARIES
/variable/CMAKE_VS_VERSION_BUILD_NUMBER
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
/variable/CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION
@@ -271,6 +272,7 @@ Variables that Change Behavior
/variable/CMAKE_SYSTEM_PROGRAM_PATH
/variable/CMAKE_TLS_CAINFO
/variable/CMAKE_TLS_VERIFY
+ /variable/CMAKE_TLS_VERSION
/variable/CMAKE_USER_MAKE_RULES_OVERRIDE
/variable/CMAKE_WARN_DEPRECATED
/variable/CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION
@@ -422,6 +424,7 @@ Variables that Control the Build
/variable/CMAKE_CUDA_RESOLVE_DEVICE_SYMBOLS
/variable/CMAKE_CUDA_RUNTIME_LIBRARY
/variable/CMAKE_CUDA_SEPARABLE_COMPILATION
+ /variable/CMAKE_CXX_MODULE_STD
/variable/CMAKE_CXX_SCAN_FOR_MODULES
/variable/CMAKE_DEBUG_POSTFIX
/variable/CMAKE_DEFAULT_BUILD_TYPE
@@ -577,6 +580,7 @@ Variables for Languages
/variable/CMAKE_CUDA_STANDARD_REQUIRED
/variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
/variable/CMAKE_CXX_COMPILE_FEATURES
+ /variable/CMAKE_CXX_COMPILER_IMPORT_STD
/variable/CMAKE_CXX_EXTENSIONS
/variable/CMAKE_CXX_STANDARD
/variable/CMAKE_CXX_STANDARD_REQUIRED
@@ -641,6 +645,7 @@ Variables for Languages
/variable/CMAKE_LANG_STANDARD
/variable/CMAKE_LANG_STANDARD_DEFAULT
/variable/CMAKE_LANG_STANDARD_INCLUDE_DIRECTORIES
+ /variable/CMAKE_LANG_STANDARD_LATEST
/variable/CMAKE_LANG_STANDARD_LIBRARIES
/variable/CMAKE_LANG_STANDARD_REQUIRED
/variable/CMAKE_OBJC_EXTENSIONS
@@ -726,6 +731,8 @@ Variables for CTest
/variable/CTEST_SVN_UPDATE_OPTIONS
/variable/CTEST_TEST_LOAD
/variable/CTEST_TEST_TIMEOUT
+ /variable/CTEST_TLS_VERIFY
+ /variable/CTEST_TLS_VERSION
/variable/CTEST_UPDATE_COMMAND
/variable/CTEST_UPDATE_OPTIONS
/variable/CTEST_UPDATE_VERSION_ONLY
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index 0e90ab6..c9ab31e 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -1452,14 +1452,25 @@ Configuration settings include:
* :module:`CTest` module variable: ``CTEST_SUBMIT_RETRY_DELAY``
``CurlOptions``
+ .. deprecated:: 3.30
+
+ Use ``TLSVerify`` instead.
+
Specify a semicolon-separated list of options to control the
Curl library that CTest uses internally to connect to the
- server. Possible options are ``CURLOPT_SSL_VERIFYPEER_OFF``
- and ``CURLOPT_SSL_VERIFYHOST_OFF``.
+ server.
* `CTest Script`_ variable: :variable:`CTEST_CURL_OPTIONS`
* :module:`CTest` module variable: ``CTEST_CURL_OPTIONS``
+ Possible options are:
+
+ ``CURLOPT_SSL_VERIFYPEER_OFF``
+ Disable the ``CURLOPT_SSL_VERIFYPEER`` curl option.
+
+ ``CURLOPT_SSL_VERIFYHOST_OFF``
+ Disable the ``CURLOPT_SSL_VERIFYHOST`` curl option.
+
``DropLocation``
Legacy option. When ``SubmitURL`` is not set, it is constructed from
``DropMethod``, ``DropSiteUser``, ``DropSitePassword``, ``DropSite``, and
@@ -1540,6 +1551,24 @@ Configuration settings include:
* `CTest Script`_ variable: :variable:`CTEST_SUBMIT_INACTIVITY_TIMEOUT`
* :module:`CTest` module variable: ``CTEST_SUBMIT_INACTIVITY_TIMEOUT``
+``TLSVersion``
+ .. versionadded:: 3.30
+
+ Specify a minimum TLS version allowed when submitting to a dashboard
+ via ``https://`` URLs.
+
+ * `CTest Script`_ variable: :variable:`CTEST_TLS_VERSION`
+ * :module:`CTest` module variable: ``CTEST_TLS_VERSION``
+
+``TLSVerify``
+ .. versionadded:: 3.30
+
+ Specify a boolean value indicating whether to verify the server
+ certificate when submitting to a dashboard via ``https://`` URLs.
+
+ * `CTest Script`_ variable: :variable:`CTEST_TLS_VERIFY`
+ * :module:`CTest` module variable: ``CTEST_TLS_VERIFY``
+
``TriggerSite``
Legacy option. Not used.
diff --git a/Help/manual/presets/schema.json b/Help/manual/presets/schema.json
index d27faa1..f80685c 100644
--- a/Help/manual/presets/schema.json
+++ b/Help/manual/presets/schema.json
@@ -124,6 +124,24 @@
"include": { "$ref": "#/definitions/include" }
},
"additionalProperties": false
+ },
+ {
+ "properties": {
+ "$schema": { "$ref": "#/definitions/$schema" },
+ "version": {
+ "const": 9,
+ "description": "A required integer representing the version of the JSON schema."
+ },
+ "cmakeMinimumRequired": { "$ref": "#/definitions/cmakeMinimumRequired" },
+ "vendor": { "$ref": "#/definitions/vendor" },
+ "configurePresets": { "$ref": "#/definitions/configurePresetsV7" },
+ "buildPresets": { "$ref": "#/definitions/buildPresetsV4" },
+ "testPresets": { "$ref": "#/definitions/testPresetsV6" },
+ "packagePresets": { "$ref": "#/definitions/packagePresetsV6" },
+ "workflowPresets": { "$ref": "#/definitions/workflowPresetsV6" },
+ "include": { "$ref": "#/definitions/include" }
+ },
+ "additionalProperties": false
}
],
"required": [
diff --git a/Help/policy/CMP0066.rst b/Help/policy/CMP0066.rst
index fa4bc5c..947a186 100644
--- a/Help/policy/CMP0066.rst
+++ b/Help/policy/CMP0066.rst
@@ -18,7 +18,7 @@ variables like :variable:`CMAKE_<LANG>_FLAGS_DEBUG` and only use CMake's
built-in defaults for the current compiler and platform.
The ``NEW`` behavior of this policy is to honor config-specific flag
-variabldes like :variable:`CMAKE_<LANG>_FLAGS_DEBUG`.
+variables like :variable:`CMAKE_<LANG>_FLAGS_DEBUG`.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.7
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn by default
diff --git a/Help/policy/CMP0099.rst b/Help/policy/CMP0099.rst
index c0db99d..0a2b786 100644
--- a/Help/policy/CMP0099.rst
+++ b/Help/policy/CMP0099.rst
@@ -3,13 +3,16 @@ CMP0099
.. versionadded:: 3.17
-Target link properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
-:prop_tgt:`INTERFACE_LINK_DIRECTORIES` and :prop_tgt:`INTERFACE_LINK_DEPENDS`
-are now transitive over private dependencies of static libraries.
+Link properties are transitive over private dependencies of static libraries.
-In CMake 3.16 and below the interface link properties attached to libraries
-are not propagated for private dependencies of static libraries.
+In CMake 3.16 and below, evaluation of target properties
+:prop_tgt:`INTERFACE_LINK_OPTIONS`, :prop_tgt:`INTERFACE_LINK_DIRECTORIES`,
+and :prop_tgt:`INTERFACE_LINK_DEPENDS` during buildsystem generation does not
+follow private dependencies of static libraries, which appear in their
+:prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded by :genex:`LINK_ONLY` generator
+expressions.
Only the libraries themselves are propagated to link the dependent binary.
+
CMake 3.17 and later prefer to propagate all interface link properties.
This policy provides compatibility for projects that have not been updated
to expect the new behavior.
@@ -18,6 +21,12 @@ The ``OLD`` behavior for this policy is to not propagate interface link
properties. The ``NEW`` behavior of this policy is to propagate interface link
properties.
+.. versionadded:: 3.30
+
+ Policy :policy:`CMP0166` makes :genex:`TARGET_PROPERTY` evaluation of
+ these three transitive link properties follow private dependencies of
+ static libraries too.
+
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.17
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
.. include:: STANDARD_ADVICE.txt
diff --git a/Help/policy/CMP0118.rst b/Help/policy/CMP0118.rst
index 00afadf..5c04927 100644
--- a/Help/policy/CMP0118.rst
+++ b/Help/policy/CMP0118.rst
@@ -3,25 +3,36 @@ CMP0118
.. versionadded:: 3.20
-The :prop_sf:`GENERATED` source file property is now visible in all directories.
+:prop_sf:`GENERATED` sources may be used across directories without manual marking.
-Whether or not a source file is generated is an all-or-nothing global
-property of the source. Consequently, the associated ``GENERATED``
-property is now visible from any directory scope, not only from the scope
-for which it was set.
+In CMake 3.19 and below, the :prop_sf:`GENERATED` source file property,
+like other source file properties, was scoped in every directory separately.
+If a source file was generated in one directory, projects had to manually
+set the ``GENERATED`` property in another directory in order to use the file.
+Whether or not a source file is generated is an all-or-nothing global
+property of the source: a source is either generated or it is not.
+CMake 3.20 and above prefer to allow source files generated in one directory
+to be used in other directories without manually marking them as ``GENERATED``.
Additionally, the ``GENERATED`` property may now be set only to boolean
-values, and may not be turned off once turned on.
+values, and may not be turned off once turned on. This policy provides
+compatibility for projects that have not been updated for this behavior.
+
+The ``OLD`` behavior of this policy is to allow generated files to be used
+only in directories in which their ``GENERATED`` property has been turned on.
+The ``NEW`` behavior of this policy is to allow generated files to be used
+in other directories without explicitly turning on the ``GENERATED`` property
+for those directories.
+
+.. versionadded:: 3.30
-The ``OLD`` behavior of this policy is to only allow ``GENERATED`` to be
-visible from the directory scope for which it was set. The ``NEW``
-behavior on the other hand allows it to be visible from any scope.
+ Policy :policy:`CMP0163` additionally makes the :prop_sf:`GENERATED` source
+ file property visible to :command:`get_property` and
+ :command:`get_source_file_property` calls in other directories.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.20
.. |WARNS_OR_DOES_NOT_WARN| replace::
- does *not* warn with regard to visibility of the ``GENERATED``
- property, but does warn about setting the ``GENERATED`` property
- to a non-boolean value,
+ warns about setting the ``GENERATED`` property to a non-boolean value
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0135.rst b/Help/policy/CMP0135.rst
index c8d9205..09c688d 100644
--- a/Help/policy/CMP0135.rst
+++ b/Help/policy/CMP0135.rst
@@ -4,20 +4,20 @@ CMP0135
.. versionadded:: 3.24
When using the ``URL`` download method with the :command:`ExternalProject_Add`
-command, CMake 3.23 and below sets the timestamps of the extracted contents
-to the same as the timestamps in the archive. When the ``URL`` changes, the
-new archive is downloaded and extracted, but the timestamps of the extracted
-contents might not be newer than the previous contents. Anything that depends
-on the extracted contents might not be rebuilt, even though the contents may
-change.
+or :command:`FetchContent_Declare` commands, CMake 3.23 and below sets the
+timestamps of the extracted contents to the same as the timestamps in the
+archive. When the ``URL`` changes, the new archive is downloaded and extracted,
+but the timestamps of the extracted contents might not be newer than the
+previous contents. Anything that depends on the extracted contents might not
+be rebuilt, even though the contents may change.
CMake 3.24 and above prefers to set the timestamps of all extracted contents
to the time of the extraction. This ensures that anything that depends on the
extracted contents will be rebuilt whenever the ``URL`` changes.
-The ``DOWNLOAD_EXTRACT_TIMESTAMP`` option to the
-:command:`ExternalProject_Add` command can be used to explicitly specify how
-timestamps should be handled. When ``DOWNLOAD_EXTRACT_TIMESTAMP`` is not
+The ``DOWNLOAD_EXTRACT_TIMESTAMP`` option to the :command:`ExternalProject_Add`
+and :command:`FetchContent_Declare` commands can be used to explicitly specify
+how timestamps should be handled. When ``DOWNLOAD_EXTRACT_TIMESTAMP`` is not
given, this policy controls the default behavior. The ``OLD`` behavior for
this policy is to restore the timestamps from the archive. The ``NEW``
behavior sets the timestamps of extracted contents to the time of extraction.
diff --git a/Help/policy/CMP0162.rst b/Help/policy/CMP0162.rst
new file mode 100644
index 0000000..df46d96
--- /dev/null
+++ b/Help/policy/CMP0162.rst
@@ -0,0 +1,47 @@
+CMP0162
+-------
+
+.. versionadded:: 3.30
+
+:ref:`Visual Studio Generators` add ``UseDebugLibraries`` indicators by default.
+
+The "Use Debug Libraries" setting in Visual Studio projects indicates what
+configurations are considered debug configurations. In standalone projects,
+this may affect MSBuild's default selection of MSVC runtime library,
+optimization flags, runtime checks, and similar settings. CMake typically
+generates all those settings explicitly based on the project's specification,
+so CMake 3.29 and below do not write any ``UseDebugLibraries`` indicators to
+``.vcxproj`` files.
+
+CMake 3.30 and above prefer to write ``UseDebugLibraries`` indicators because
+they are useful for reference by both humans and tools, and may also affect
+the behavior of platform-specific SDKs. The indicator for each configuration
+of a target is determined as follows:
+
+* If the target compiles sources for a known MSVC runtime library
+ (such as that specified by :prop_tgt:`MSVC_RUNTIME_LIBRARY`),
+ then ``UseDebugLibraries`` is ``true`` for configurations that
+ compile for a "Debug" runtime library, and ``false`` for others.
+
+* Otherwise, such as in targets created by :command:`add_custom_target`,
+ ``UseDebugLibraries`` is ``true`` for the ``Debug`` configuration,
+ and ``false`` for others.
+
+This policy provides compatibility for projects that have not been updated to
+expect the indicators. The policy setting is recorded by each target as it is
+created and used to determine the default behavior for that target's
+``.vcxproj`` file.
+
+The ``OLD`` behavior for this policy is to not generate ``UseDebugLibraries``
+indicators by default. The ``NEW`` behavior for this policy is to generate
+``UseDebugLibraries`` indicators by default.
+
+If the :variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable and/or
+:prop_tgt:`VS_USE_DEBUG_LIBRARIES` target property is set, it explicitly
+controls ``UseDebugLibraries`` generation regardless of this policy.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0163.rst b/Help/policy/CMP0163.rst
new file mode 100644
index 0000000..40b3535
--- /dev/null
+++ b/Help/policy/CMP0163.rst
@@ -0,0 +1,37 @@
+CMP0163
+-------
+
+.. versionadded:: 3.30
+
+The :prop_sf:`GENERATED` source file property is now visible in all directories.
+
+In CMake 3.29 and below, the :prop_sf:`GENERATED` source file property,
+like other source file properties, was scoped in every directory separately.
+Although policy :policy:`CMP0118` allowed sources marked ``GENERATED`` in one
+directory to be used in other directories without manually marking them as
+``GENERATED`` again, the ``GENERATED`` property was still not visible to
+:command:`get_property` and :command:`get_source_file_property` calls.
+
+Whether or not a source file is generated is an all-or-nothing global
+property of the source: a source is either generated or it is not.
+CMake 3.30 and above prefer to treat the :prop_sf:`GENERATED` source file
+property as globally scoped. Once it is set in one directory, it is
+immediately visible to :command:`get_property` and
+:command:`get_source_file_property` calls in other directories.
+This policy provides compatibility for projects that have not been
+updated for this behavior.
+
+The ``OLD`` behavior of this policy is for the ``GENERATED`` source file
+property to be visible only in the directories in which it is set. The
+``NEW`` behavior of this policy is to allow the ``GENERATED`` source file
+property to be visible in all directories once set in any directory.
+Furthermore, the ``NEW`` behavior of this policy implies the ``NEW``
+behavior of policy :policy:`CMP0118`: the ``GENERATED`` property may
+be set only to boolean values, and may not be turned off once turned on.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
+.. |WARNS_OR_DOES_NOT_WARN| replace::
+ does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0164.rst b/Help/policy/CMP0164.rst
new file mode 100644
index 0000000..5ab2ee9
--- /dev/null
+++ b/Help/policy/CMP0164.rst
@@ -0,0 +1,31 @@
+CMP0164
+-------
+
+.. versionadded:: 3.30
+
+:command:`add_library` rejects ``SHARED`` libraries when not supported by
+the platform.
+
+In CMake 3.29 and below, on platforms that do not support shared libraries
+(:prop_gbl:`TARGET_SUPPORTS_SHARED_LIBS` is ``false``), the
+:command:`add_library` command automatically converted ``SHARED`` libraries to
+``STATIC`` libraries to help users build projects on such platforms. However,
+the semantics of shared and static libraries are different enough that such
+automatic conversion cannot work in general. Projects using shared libraries
+need to be ported to such platforms on a case-by-case basis.
+
+In CMake 3.30 and above, :command:`add_library` prefers to reject creation
+of shared libraries on platforms that do not support them, and fail with a
+fatal error message. This policy provides compatibility for projects that
+happened to work with the automatic conversion to static libraries and have
+not been updated with an explicit port.
+
+The ``OLD`` behavior for this policy is to implicitly create a static
+library with a developer warning. The ``NEW`` behavior for this policy is
+to fail.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn about the behavior change
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0165.rst b/Help/policy/CMP0165.rst
new file mode 100644
index 0000000..7a79c44
--- /dev/null
+++ b/Help/policy/CMP0165.rst
@@ -0,0 +1,26 @@
+CMP0165
+-------
+
+.. versionadded:: 3.30
+
+:command:`enable_language` must not be called before :command:`project`.
+
+In CMake 3.29 and below, if a project called :command:`enable_language`
+before the first call to :command:`project`, the language would be enabled
+but possibly using unset details that were expected to be set.
+In CMake 3.30 and above, :command:`enable_language` prefers to reject this
+case and stop with a fatal error instead if it detects that :command:`project`
+has not yet been called. This policy provides compatibility for projects that
+happened to work when :command:`enable_language` was called before
+:command:`project` and have not been updated to call these commands in the
+required order.
+
+The ``OLD`` behavior for this policy is to allow :command:`enable_language`
+to be called before :command:`project`. The ``NEW`` behavior for this policy
+is to fail with a fatal error in such cases.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
+.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/policy/CMP0166.rst b/Help/policy/CMP0166.rst
new file mode 100644
index 0000000..5c67880
--- /dev/null
+++ b/Help/policy/CMP0166.rst
@@ -0,0 +1,40 @@
+CMP0166
+-------
+
+.. versionadded:: 3.30
+
+:genex:`TARGET_PROPERTY` evaluates link properties transitively over private
+dependencies of static libraries.
+
+In CMake 3.29 and below, the :genex:`TARGET_PROPERTY` generator expression
+evaluates properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
+:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
+as if they were :ref:`Transitive Build Properties` rather than
+:ref:`Transitive Link Properties`, even when policy :policy:`CMP0099` is
+set to ``NEW``. Private dependencies of static libraries, which appear in
+their :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded by :genex:`LINK_ONLY`
+generator expressions, are not followed. This is inconsistent with
+evaluation of the same target properties during buildsystem generation.
+
+CMake 3.30 and above prefer that :genex:`TARGET_PROPERTY` evaluates
+properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
+:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
+as :ref:`Transitive Link Properties` such that private dependencies of static
+libraries, which appear in their :prop_tgt:`INTERFACE_LINK_LIBRARIES` guarded
+by :genex:`LINK_ONLY` generator expressions, are followed.
+This policy provides compatibility for projects that have not been updated
+to expect the new behavior.
+
+The ``OLD`` behavior for this policy is for :genex:`TARGET_PROPERTY` to
+evaluate properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
+:prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and :prop_tgt:`INTERFACE_LINK_DEPENDS`
+as if they were :ref:`Transitive Build Properties` by not following private
+dependencies of static libraries. The ``NEW`` behavior for this policy is
+to evaluate them as :ref:`Transitive Link Properties` by following private
+dependencies of static libraries.
+
+.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.30
+.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
+.. include:: STANDARD_ADVICE.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst
index a31ee3a..fd2f941 100644
--- a/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst
+++ b/Help/prop_gbl/CMAKE_CUDA_KNOWN_FEATURES.rst
@@ -37,7 +37,7 @@ The features known to this version of CMake are:
Compiler mode is at least CUDA/C++ 23.
``cuda_std_26``
- .. versionadded:: 3.25
+ .. versionadded:: 3.30
Compiler mode is at least CUDA/C++ 26.
diff --git a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
index e54b927..177659a 100644
--- a/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
+++ b/Help/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.rst
@@ -47,7 +47,7 @@ but it does not necessarily imply complete conformance to that standard.
Compiler mode is at least C++ 23.
``cxx_std_26``
- .. versionadded:: 3.25
+ .. versionadded:: 3.30
Compiler mode is at least C++ 26.
diff --git a/Help/prop_sf/GENERATED.rst b/Help/prop_sf/GENERATED.rst
index 5ecc86c..566b58a 100644
--- a/Help/prop_sf/GENERATED.rst
+++ b/Help/prop_sf/GENERATED.rst
@@ -4,7 +4,16 @@ GENERATED
Is this source file generated as part of the build or CMake process.
.. versionchanged:: 3.20
- The GENERATED source file property is now visible in all directories.
+ Turning on the ``GENERATED`` source file property in one directory allows
+ the associated source file to be used across directories without the need
+ to manually setting that property for other directory scopes, too.
+ Additionally, it may now be set only to boolean values, and may not be
+ turned off once turned on. See policy :policy:`CMP0118`.
+
+.. versionchanged:: 3.30
+ Whether or not a source file is generated is an all-or-nothing global
+ property of the source. Consequently, the ``GENERATED`` source file
+ property is now visible in all directories. See policy :policy:`CMP0163`.
Tells the internal CMake engine that a source file is generated by an outside
process such as another build step, or the execution of CMake itself.
@@ -38,11 +47,3 @@ be shown. For the special case of sources generated by CMake's :prop_tgt:`AUTOMO
:prop_gbl:`AUTORCC_SOURCE_GROUP` and :prop_gbl:`AUTOUIC_SOURCE_GROUP` target
properties may influence where the generated sources are grouped in the project's
file lists.
-
-.. note::
-
- Starting with CMake 3.20 the ``GENERATED`` source file property can be set
- and retrieved from any directory scope. It is an all-or-nothing property.
- It also can no longer be removed or unset if it was set to ``TRUE``. Policy
- :policy:`CMP0118` was introduced to allow supporting the ``OLD`` behavior
- for some time.
diff --git a/Help/prop_tgt/AUTOUIC_OPTIONS.rst b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
index 425ea1c..d601740 100644
--- a/Help/prop_tgt/AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/AUTOUIC_OPTIONS.rst
@@ -1,6 +1,8 @@
AUTOUIC_OPTIONS
---------------
+.. versionadded:: 3.0
+
Additional options for ``uic`` when using :prop_tgt:`AUTOUIC`
This property holds additional command line options which will be used when
diff --git a/Help/prop_tgt/CXX_MODULE_STD.rst b/Help/prop_tgt/CXX_MODULE_STD.rst
new file mode 100644
index 0000000..d42699d
--- /dev/null
+++ b/Help/prop_tgt/CXX_MODULE_STD.rst
@@ -0,0 +1,41 @@
+CXX_MODULE_STD
+--------------
+
+.. versionadded:: 3.30
+
+``CXX_MODULE_STD`` is a boolean specifying whether the target may use
+``import std;`` its C++ sources or not.
+
+.. note ::
+
+ This setting is meaningful only when experimental support for ``import
+ std;`` has been enabled by the ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` gate.
+
+When this property is explicitly set to ``ON``, CMake will add a dependency to
+a target which provides the C++ standard library's modules for the C++
+standard applied to the target. This target is only applicable within the
+current build and will not appear in the exported interfaces of the targets.
+When consumed, these targets will be reapplied as necessary.
+
+.. note:
+
+ Similar to the introduction of :prop:`CXX_SCAN_FOR_MODULES`, this property
+ defaults to _not_ adding ``import std`` support to targets using
+ ``cxx_std_23`` without an explicit request in order to preserve existing
+ behavior for projects using C++23 without ``import std``. A future policy
+ to change the default behavior is expected once the feature sees wider
+ usage.
+
+This property's value is not relevant for targets which disable scanning (see
+:prop_tgt:`CXX_SCAN_FOR_MODULES`). Additionally, this property only applies to
+targets utilizing C++23 (``cxx_std_23``) or newer.
+
+The property supports
+:manual:`generator expressions <cmake-generator-expressions(7)>`, however
+expressions that depend upon the configuration, the consuming target, or the
+linker language are not allowed. Whether a target uses ``import std`` should
+not depend upon such things as it is a static property of the target's source
+code.
+
+Targets which are exported with C++ module sources will have this property's
+resolved value exported.
diff --git a/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst b/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
index e97d293..2fe011a 100644
--- a/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
+++ b/Help/prop_tgt/INTERFACE_AUTOUIC_OPTIONS.rst
@@ -1,6 +1,8 @@
INTERFACE_AUTOUIC_OPTIONS
-------------------------
+.. versionadded:: 3.0
+
List of interface options to pass to uic.
Targets may populate this property to publish the options
diff --git a/Help/prop_tgt/LANG_STANDARD.rst b/Help/prop_tgt/LANG_STANDARD.rst
index c83da01..4b59af7 100644
--- a/Help/prop_tgt/LANG_STANDARD.rst
+++ b/Help/prop_tgt/LANG_STANDARD.rst
@@ -18,7 +18,7 @@ controlled with the :prop_tgt:`<LANG>_STANDARD_REQUIRED` target property.
Note that the actual language standard used may be higher than that specified
by ``<LANG>_STANDARD``, regardless of the value of
:prop_tgt:`<LANG>_STANDARD_REQUIRED`. In particular,
-:ref:`transitive usage requirements <Target Usage Requirements>` or the use of
+:ref:`usage requirements <Target Usage Requirements>` or the use of
:manual:`compile features <cmake-compile-features(7)>` can raise the required
language standard above what ``<LANG>_STANDARD`` specifies.
diff --git a/Help/prop_tgt/LANG_STANDARD_REQUIRED.rst b/Help/prop_tgt/LANG_STANDARD_REQUIRED.rst
index e61125b..532057b 100644
--- a/Help/prop_tgt/LANG_STANDARD_REQUIRED.rst
+++ b/Help/prop_tgt/LANG_STANDARD_REQUIRED.rst
@@ -20,7 +20,7 @@ error will be issued if that requirement cannot be met.
Note that the actual language standard used may be higher than that specified
by :prop_tgt:`<LANG>_STANDARD`, regardless of the value of
``<LANG>_STANDARD_REQUIRED``. In particular,
-:ref:`transitive usage requirements <Target Usage Requirements>` or the use of
+:ref:`usage requirements <Target Usage Requirements>` or the use of
:manual:`compile features <cmake-compile-features(7)>` can raise the required
language standard above what :prop_tgt:`<LANG>_STANDARD` specifies.
diff --git a/Help/prop_tgt/SOURCES.rst b/Help/prop_tgt/SOURCES.rst
index 1ebfa14..1688ef7 100644
--- a/Help/prop_tgt/SOURCES.rst
+++ b/Help/prop_tgt/SOURCES.rst
@@ -18,7 +18,7 @@ evaluate to an absolute path. Not doing so is considered undefined behavior.
Paths that are for files generated by the build will be treated
as relative to the build directory of the target, if the path is not
already specified as an absolute path. Note that whether a file is seen as
-generated may be affected by policy :policy:`CMP0118`.
+generated may be affected by policies :policy:`CMP0118` and :policy:`CMP0163`.
If a path does not start with a generator expression, is not an
absolute path and is not a generated file, it will be treated as relative to
diff --git a/Help/prop_tgt/VS_FILTER_PROPS.rst b/Help/prop_tgt/VS_FILTER_PROPS.rst
new file mode 100644
index 0000000..3de0a16
--- /dev/null
+++ b/Help/prop_tgt/VS_FILTER_PROPS.rst
@@ -0,0 +1,10 @@
+VS_FILTER_PROPS
+---------------
+
+.. versionadded:: 3.30
+
+Sets the filter props file to be included in the visual studio
+C++ project filter file.
+
+The ``*.filter.props`` files can be used for Visual Studio wide
+configuration which is independent from cmake.
diff --git a/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES-PURPOSE.txt b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES-PURPOSE.txt
new file mode 100644
index 0000000..8d3714e
--- /dev/null
+++ b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES-PURPOSE.txt
@@ -0,0 +1,18 @@
+Indicate to :ref:`Visual Studio Generators` what configurations are considered
+debug configurations. This controls the ``UseDebugLibraries`` setting in
+each configuration of a ``.vcxproj`` file.
+
+The "Use Debug Libraries" setting in Visual Studio projects, despite its
+specific-sounding name, is a general-purpose indicator of what configurations
+are considered debug configurations. In standalone projects, this may affect
+MSBuild's default selection of MSVC runtime library, optimization flags,
+runtime checks, and similar settings. In CMake projects those settings are
+typically generated explicitly based on the project's specification, e.g.,
+the MSVC runtime library is controlled by |MSVC_RUNTIME_LIBRARY|. However,
+the ``UseDebugLibraries`` indicator is useful for reference by both humans
+and tools, and may also affect the behavior of platform-specific SDKs.
+
+Set |VS_USE_DEBUG_LIBRARIES| to a true or false value to indicate whether
+each configuration is considered a debug configuration. The value may also
+be the empty string (``""``) in which case no ``UseDebugLibraries`` will be
+added explicitly by CMake, and MSBuild will use its default value, ``false``.
diff --git a/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst
new file mode 100644
index 0000000..3d5ada4
--- /dev/null
+++ b/Help/prop_tgt/VS_USE_DEBUG_LIBRARIES.rst
@@ -0,0 +1,28 @@
+VS_USE_DEBUG_LIBRARIES
+----------------------
+
+.. versionadded:: 3.30
+
+.. |VS_USE_DEBUG_LIBRARIES| replace:: ``VS_USE_DEBUG_LIBRARIES``
+.. |MSVC_RUNTIME_LIBRARY| replace:: :prop_tgt:`MSVC_RUNTIME_LIBRARY`
+
+.. include:: VS_USE_DEBUG_LIBRARIES-PURPOSE.txt
+
+Use :manual:`generator expressions <cmake-generator-expressions(7)>`
+for per-configuration specification. For example, the code:
+
+.. code-block:: cmake
+
+ add_executable(foo foo.c)
+ set_property(TARGET foo PROPERTY
+ VS_USE_DEBUG_LIBRARIES "$<CONFIG:Debug,Custom>")
+
+indicates that target ``foo`` considers its "Debug" and "Custom"
+configurations to be debug configurations, and its other configurations
+to be non-debug configurations.
+
+The property is initialized from the value of the
+:variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable, if it is set.
+If the property is not set then CMake generates ``UseDebugLibraries`` using
+heuristics to determine which configurations are debug configurations.
+See policy :policy:`CMP0162`.
diff --git a/Help/release/3.20.rst b/Help/release/3.20.rst
index ebd0f91..51e4594 100644
--- a/Help/release/3.20.rst
+++ b/Help/release/3.20.rst
@@ -147,8 +147,9 @@ Properties
for the associated :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable
to allow for configuration of exporting compile commands per target.
-* The :prop_sf:`GENERATED` source-file property is now visible
- from any directory scope, regardless of the scope in which it is set.
+* Generated sources may be used across directories without manual marking.
+ Additionally, the :prop_sf:`GENERATED` source file property can no longer be
+ turned off once turned on, nor can it be set to other than boolean values.
See policy :policy:`CMP0118`.
* The :prop_tgt:`UNITY_BUILD_UNIQUE_ID` target property
diff --git a/Help/release/3.25.rst b/Help/release/3.25.rst
index cb6984c..646c5ba 100644
--- a/Help/release/3.25.rst
+++ b/Help/release/3.25.rst
@@ -27,9 +27,7 @@ Presets
Languages
---------
-* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
- is now aware of C++26, and defines a ``cxx_std_26`` meta-feature.
- C++26 compiler modes may also be specified via the :prop_tgt:`CXX_STANDARD`,
+* C++26 compiler modes may now be specified via the :prop_tgt:`CXX_STANDARD`,
:prop_tgt:`CUDA_STANDARD`, :prop_tgt:`HIP_STANDARD`,
or :prop_tgt:`OBJCXX_STANDARD` target properties.
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
new file mode 100644
index 0000000..e4cc01e
--- /dev/null
+++ b/Help/release/dev/0-sample-topic.rst
@@ -0,0 +1,7 @@
+0-sample-topic
+--------------
+
+* This is a sample release note for the change in a topic.
+ Developers should add similar notes for each topic branch
+ making a noteworthy change. Each document should be named
+ and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/dev/CXX_MODULE_STD-property.rst b/Help/release/dev/CXX_MODULE_STD-property.rst
new file mode 100644
index 0000000..50febf4
--- /dev/null
+++ b/Help/release/dev/CXX_MODULE_STD-property.rst
@@ -0,0 +1,5 @@
+CXX_MODULE_STD-property
+-----------------------
+
+* The :prop_tgt:`CXX_MODULE_STD` property may be used to control
+ ``import std;`` support for targets.
diff --git a/Help/release/dev/FindBacktrace-imported-library.rst b/Help/release/dev/FindBacktrace-imported-library.rst
new file mode 100644
index 0000000..ffb8d66
--- /dev/null
+++ b/Help/release/dev/FindBacktrace-imported-library.rst
@@ -0,0 +1,4 @@
+FindBacktrace-imported-library
+------------------------------
+
+* The :module:`FindBacktrace` module now provides an imported target.
diff --git a/Help/release/dev/FindCUDAToolkit-nvfatbin.rst b/Help/release/dev/FindCUDAToolkit-nvfatbin.rst
new file mode 100644
index 0000000..f8bb624
--- /dev/null
+++ b/Help/release/dev/FindCUDAToolkit-nvfatbin.rst
@@ -0,0 +1,5 @@
+FindCUDAToolkit-nvfatbin
+------------------------
+
+* The :module:`FindCUDAToolkit` module now provides a target for
+ ``libnvfatbin`` and ``libnvfatbin_static``, if found.
diff --git a/Help/release/dev/FindOpenMP-runtime-msvc.rst b/Help/release/dev/FindOpenMP-runtime-msvc.rst
new file mode 100644
index 0000000..76df237
--- /dev/null
+++ b/Help/release/dev/FindOpenMP-runtime-msvc.rst
@@ -0,0 +1,5 @@
+FindOpenMP-runtime-msvc
+-----------------------
+
+* The :module:`FindOpenMP` module gained a ``OpenMP_RUNTIME_MSVC``
+ option to control the OpenMP runtime used with MSVC.
diff --git a/Help/release/dev/add_library-no-static-fallback.rst b/Help/release/dev/add_library-no-static-fallback.rst
new file mode 100644
index 0000000..72de12b
--- /dev/null
+++ b/Help/release/dev/add_library-no-static-fallback.rst
@@ -0,0 +1,6 @@
+add_library-no-static-fallback
+------------------------------
+
+* On platforms that do not support shared libraries, the :command:`add_library`
+ command now rejects creation of shared libraries instead of automatically
+ converting them to static libraries. See policy :policy:`CMP0164`.
diff --git a/Help/release/dev/cpack-innosetup-linux.rst b/Help/release/dev/cpack-innosetup-linux.rst
new file mode 100644
index 0000000..8909ca9
--- /dev/null
+++ b/Help/release/dev/cpack-innosetup-linux.rst
@@ -0,0 +1,5 @@
+cpack-innosetup-linux
+---------------------
+
+* The :cpack_gen:`CPack Inno Setup Generator` is now available
+ on non-Windows hosts.
diff --git a/Help/release/dev/cpack-wix.rst b/Help/release/dev/cpack-wix.rst
new file mode 100644
index 0000000..020dfeb
--- /dev/null
+++ b/Help/release/dev/cpack-wix.rst
@@ -0,0 +1,5 @@
+cpack-wix
+---------
+
+* The :cpack_gen:`CPack WIX Generator` gained support for WiX Toolset v4.
+ See the :variable:`CPACK_WIX_VERSION` variable.
diff --git a/Help/release/dev/curl-tls-version.rst b/Help/release/dev/curl-tls-version.rst
new file mode 100644
index 0000000..26d03ad
--- /dev/null
+++ b/Help/release/dev/curl-tls-version.rst
@@ -0,0 +1,26 @@
+curl-tls-version
+----------------
+
+* The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands
+ gained a ``TLS_VERSION <min>`` option to specify the minimum TLS
+ version for connections to ``https://`` URLs.
+
+* The :variable:`CMAKE_TLS_VERSION` variable and :envvar:`CMAKE_TLS_VERSION`
+ environment variable were added to specify a default minimum TLS version
+ for connections to ``https://`` URLs by the :command:`file(DOWNLOAD)`
+ and :command:`file(UPLOAD)` commands.
+
+* The :envvar:`CMAKE_TLS_VERIFY` environment variable was added as a fallback
+ to the existing :variable:`CMAKE_TLS_VERIFY` variable. It specifies
+ whether to verify the server certificate for ``https://`` URLs by default.
+
+* The :module:`ExternalProject` module's :command:`ExternalProject_Add`
+ command gained a ``TLS_VERSION <min>`` option, and support for the
+ :variable:`CMAKE_TLS_VERSION` variable and :envvar:`CMAKE_TLS_VERSION`
+ environment variable, to specify the minimum TLS version for connections
+ to ``https://`` URLs.
+
+* The :command:`ctest_submit` command and :option:`ctest -T Submit <ctest -T>`
+ step gained ``TLSVersion`` and ``TLSVerify`` options to control negotiation
+ with ``https://`` URLs. See the :variable:`CTEST_TLS_VERSION` and
+ :variable:`CTEST_TLS_VERIFY` variables.
diff --git a/Help/release/dev/cxx-26.rst b/Help/release/dev/cxx-26.rst
new file mode 100644
index 0000000..08e3fdd
--- /dev/null
+++ b/Help/release/dev/cxx-26.rst
@@ -0,0 +1,8 @@
+cxx-26
+------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+ now implements support for the ``cxx_std_26`` and ``cuda_std_26``
+ meta-features to indicate that the compiler mode must be at least C++26.
+ These meta-features were first documented by CMake 3.25, but were not fully
+ implemented.
diff --git a/Help/release/dev/enable_language-before-project.rst b/Help/release/dev/enable_language-before-project.rst
new file mode 100644
index 0000000..2b1fd1d
--- /dev/null
+++ b/Help/release/dev/enable_language-before-project.rst
@@ -0,0 +1,6 @@
+enable_language-before-project
+------------------------------
+
+* The :command:`enable_language` command now fails with an error
+ if it is called before the first :command:`project` call.
+ See policy :policy:`CMP0165`.
diff --git a/Help/release/dev/fileapi-provide-glob-dependent.rst b/Help/release/dev/fileapi-provide-glob-dependent.rst
new file mode 100644
index 0000000..fa02272
--- /dev/null
+++ b/Help/release/dev/fileapi-provide-glob-dependent.rst
@@ -0,0 +1,9 @@
+fileapi-provide-glob-dependent
+------------------------------
+
+* The :manual:`cmake-file-api(7)` "cmakeFiles" version 1 object's ``version``
+ field has been updated to 1.1.
+
+* The :manual:`cmake-file-api(7)` "cmakeFiles" version 1 object gained a
+ ``globsDependent`` field to report :command:`file(GLOB)` calls using
+ ``CONFIGURE_DEPENDS``.
diff --git a/Help/release/dev/genex-link-properties.rst b/Help/release/dev/genex-link-properties.rst
new file mode 100644
index 0000000..e1e84e0
--- /dev/null
+++ b/Help/release/dev/genex-link-properties.rst
@@ -0,0 +1,8 @@
+genex-link-properties
+---------------------
+
+* The :genex:`TARGET_PROPERTY` generator expression now evaluates target
+ properties :prop_tgt:`INTERFACE_LINK_OPTIONS`,
+ :prop_tgt:`INTERFACE_LINK_DIRECTORIES`, and
+ :prop_tgt:`INTERFACE_LINK_DEPENDS` correctly by following private
+ dependencies of static libraries. See policy :policy:`CMP0166`.
diff --git a/Help/release/dev/genex-quote.rst b/Help/release/dev/genex-quote.rst
new file mode 100644
index 0000000..61bcfc0
--- /dev/null
+++ b/Help/release/dev/genex-quote.rst
@@ -0,0 +1,4 @@
+genex-quote
+-----------
+
+* The :genex:`$<QUOTE>` generator expression was added to evaluate to ``"``.
diff --git a/Help/release/dev/lang-standard-latest.rst b/Help/release/dev/lang-standard-latest.rst
new file mode 100644
index 0000000..b4713b6
--- /dev/null
+++ b/Help/release/dev/lang-standard-latest.rst
@@ -0,0 +1,5 @@
+lang-standard-latest
+--------------------
+
+* The :variable:`CMAKE_<LANG>_STANDARD_LATEST` variable was added to
+ describe the latest supported standard of language ``<LANG>``.
diff --git a/Help/release/dev/preset-includes-macro-expansion.rst b/Help/release/dev/preset-includes-macro-expansion.rst
new file mode 100644
index 0000000..83aace4
--- /dev/null
+++ b/Help/release/dev/preset-includes-macro-expansion.rst
@@ -0,0 +1,7 @@
+preset-includes-macro-expansion
+-------------------------------
+
+* :manual:`cmake-presets(7)` files now support schema version ``9``:
+
+ * ``include`` fields now expand all macros except ``$env{}`` and
+ preset-specific macros.
diff --git a/Help/release/dev/prop-GENERATED-visibility.rst b/Help/release/dev/prop-GENERATED-visibility.rst
new file mode 100644
index 0000000..33f28d9
--- /dev/null
+++ b/Help/release/dev/prop-GENERATED-visibility.rst
@@ -0,0 +1,6 @@
+prop-GENERATED-visibility
+-------------------------
+
+* The :prop_sf:`GENERATED` source file property is now visible in all
+ directories. See policy :policy:`CMP0163`. Policy :policy:`CMP0118`'s
+ documentation has been revised to describe its actual effects.
diff --git a/Help/release/dev/rel-win-PATH.rst b/Help/release/dev/rel-win-PATH.rst
new file mode 100644
index 0000000..f4a7360
--- /dev/null
+++ b/Help/release/dev/rel-win-PATH.rst
@@ -0,0 +1,8 @@
+rel-win-PATH
+------------
+
+* The precompiled Windows ``.msi`` installers provided on
+ `cmake.org <https://cmake.org/download/>`_, when performing a fresh
+ installation, now modify the system-wide ``PATH`` by default.
+ When replacing an existing installation, the ``PATH`` modification
+ preference is preserved by default.
diff --git a/Help/release/dev/rel-zip-newlines.rst b/Help/release/dev/rel-zip-newlines.rst
new file mode 100644
index 0000000..43de464
--- /dev/null
+++ b/Help/release/dev/rel-zip-newlines.rst
@@ -0,0 +1,6 @@
+rel-zip-newlines
+----------------
+
+* The official ``.zip`` source archive provided on
+ `cmake.org <https://cmake.org/download/>`_ now uses LF newlines,
+ instead of CRLF newlines, for consistency with modern conventions.
diff --git a/Help/release/dev/vs-UseDebugLibraries.rst b/Help/release/dev/vs-UseDebugLibraries.rst
new file mode 100644
index 0000000..b3774a9
--- /dev/null
+++ b/Help/release/dev/vs-UseDebugLibraries.rst
@@ -0,0 +1,10 @@
+vs-UseDebugLibraries
+--------------------
+
+* :ref:`Visual Studio Generators` now add ``UseDebugLibraries`` indicators to
+ ``.vcxproj`` files to denote which configurations are debug configurations.
+ See policy :policy:`CMP0162`.
+
+* The :variable:`CMAKE_VS_USE_DEBUG_LIBRARIES` variable and corresponding
+ :prop_tgt:`VS_USE_DEBUG_LIBRARIES` target property were added to explicitly
+ control ``UseDebugLibraries`` indicators in ``.vcxproj`` files.
diff --git a/Help/release/dev/vs-filter-props.rst b/Help/release/dev/vs-filter-props.rst
new file mode 100644
index 0000000..5a09511
--- /dev/null
+++ b/Help/release/dev/vs-filter-props.rst
@@ -0,0 +1,6 @@
+vs-filter-props
+---------------
+
+* A :prop_tgt:`VS_FILTER_PROPS` target property was added to tell
+ :ref:`Visual Studio Generators` for VS 2010 and above to use a
+ custom MSBuild filter ``.props`` file.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 76adcac..a809467 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,6 +7,8 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
+.. include:: dev.txt
+
Releases
========
diff --git a/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst b/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst
new file mode 100644
index 0000000..384b5eb
--- /dev/null
+++ b/Help/variable/CMAKE_CXX_COMPILER_IMPORT_STD.rst
@@ -0,0 +1,14 @@
+CMAKE_CXX_COMPILER_IMPORT_STD
+-----------------------------
+
+.. versionadded:: 3.30
+
+A list of C++ standard levels for which ``import std`` support exists for the
+current C++ toolchain. Support for C++\<NN\> may be detected using a
+``<NN> IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD`` predicate with the
+:command:`if` command.
+
+.. note ::
+
+ This variable is meaningful only when experimental support for ``import
+ std;`` has been enabled by the ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` gate.
diff --git a/Help/variable/CMAKE_CXX_MODULE_STD.rst b/Help/variable/CMAKE_CXX_MODULE_STD.rst
new file mode 100644
index 0000000..e2b27a0
--- /dev/null
+++ b/Help/variable/CMAKE_CXX_MODULE_STD.rst
@@ -0,0 +1,15 @@
+CMAKE_CXX_MODULE_STD
+--------------------
+
+.. versionadded:: 3.30
+
+Whether to add utility targets as dependencies to targets with at least
+``cxx_std_23`` or not.
+
+.. note ::
+
+ This setting is meaningful only when experimental support for ``import
+ std;`` has been enabled by the ``CMAKE_EXPERIMENTAL_CXX_IMPORT_STD`` gate.
+
+This variable is used to initialize the :prop_tgt:`CXX_MODULE_STD` property on
+all targets. See that target property for additional information.
diff --git a/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
index 316fea2..9d34170 100644
--- a/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
+++ b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
@@ -13,5 +13,5 @@ by project code to change the default without overriding a user-provided value:
.. code-block:: cmake
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX "/my/default" CACHE PATH "..." FORCE)
+ set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "/my/default")
endif()
diff --git a/Help/variable/CMAKE_LANG_FLAGS.rst b/Help/variable/CMAKE_LANG_FLAGS.rst
index 909a001..4f8f469 100644
--- a/Help/variable/CMAKE_LANG_FLAGS.rst
+++ b/Help/variable/CMAKE_LANG_FLAGS.rst
@@ -24,6 +24,10 @@ combination with CMake's builtin defaults for the toolchain:
Initialized by the :envvar:`HIPFLAGS` environment variable.
* ``CMAKE_ISPC_FLAGS``:
Initialized by the :envvar:`ISPCFLAGS` environment variable.
+* ``CMAKE_OBJC_FLAGS``:
+ Initialized by the :envvar:`OBJCFLAGS` environment variable.
+* ``CMAKE_OBJCXX_FLAGS``:
+ Initialized by the :envvar:`OBJCXXFLAGS` environment variable.
This value is a command-line string fragment. Therefore, multiple options
should be separated by spaces, and options with spaces should be quoted.
diff --git a/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst b/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst
new file mode 100644
index 0000000..3a759cf
--- /dev/null
+++ b/Help/variable/CMAKE_LANG_STANDARD_LATEST.rst
@@ -0,0 +1,64 @@
+CMAKE_<LANG>_STANDARD_LATEST
+-----------------------------
+
+.. versionadded:: 3.30
+
+This variable represents the minimum between the latest version of the
+standard for language ``<LANG>`` which is supported by the current compiler
+and the latest version which is supported by CMake. Its value will be set to
+one of the supported values of the corresponding :prop_tgt:`<LANG>_STANDARD`
+target property; see the documentation of that property for a list of
+supported languages.
+
+See the :manual:`cmake-compile-features(7)` manual for information on compile
+features and a list of supported compilers.
+
+.. note::
+
+ ``CMAKE_<LANG>_STANDARD_LATEST`` will never be set to a language standard
+ which CMake recognizes but provides no support for. Unless explicitly
+ stated otherwise, every value which is supported by the corresponding
+ :prop_tgt:`<LANG>_STANDARD` target property represents a standard of
+ language ``<LANG>`` which is both recognized and supported by CMake.
+
+Checking for Language Standard Support
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+It is possible to use the value of the ``CMAKE_<LANG>_STANDARD_LATEST``
+variable to check for language standard support. This can be used to, e.g.,
+conditionally enable optional features for a distributed library.
+
+When doing so, one should be careful to **not** rely on integer value
+comparisons between standard levels. This is because some older standards of
+a given language which are supported by CMake (e.g., C++98, represented as
+``98``) will have a higher numerical value than newer standards of that same
+language.
+
+The following code sample demonstrates how one might correctly check for
+C++17 support:
+
+.. code-block:: cmake
+
+ # Careful! We cannot do direct integer comparisons with
+ # CMAKE_CXX_STANDARD_LATEST because some earlier C++ standards (e.g.,
+ # C++98) will have a higher numerical value than our requirement (C++17).
+ #
+ # Instead, we keep a list of unsupported C++ standards and check if
+ # CMAKE_CXX_STANDARD_LATEST appears in that list.
+ set(UNSUPPORTED_CXX_STANDARDS
+ 98
+ 11
+ 14
+ )
+
+ list(FIND UNSUPPORTED_CXX_STANDARDS ${CMAKE_CXX_STANDARD_LATEST} UNSUPPORTED_CXX_STANDARDS_INDEX)
+
+ if(UNSUPPORTED_CXX_STANDARDS_INDEX EQUAL -1)
+ # We know that the current compiler supports at least C++17. Enabling
+ # some optional feature...
+ else()
+ message(STATUS
+ "Feature X is disabled because it requires C++17, but the current "
+ "compiler only supports C++${CMAKE_CXX_STANDARD_LATEST}."
+ )
+ endif()
diff --git a/Help/variable/CMAKE_TLS_VERIFY.rst b/Help/variable/CMAKE_TLS_VERIFY.rst
index b22f1ce..5871ac7 100644
--- a/Help/variable/CMAKE_TLS_VERIFY.rst
+++ b/Help/variable/CMAKE_TLS_VERIFY.rst
@@ -3,7 +3,9 @@ CMAKE_TLS_VERIFY
Specify the default value for the :command:`file(DOWNLOAD)` and
:command:`file(UPLOAD)` commands' ``TLS_VERIFY`` options.
-If not set, the default is *off*.
+If this variable is not set, the commands check the
+:envvar:`CMAKE_TLS_VERIFY` environment variable.
+If neither is set, the default is *off*.
This variable is also used by the :module:`ExternalProject` and
:module:`FetchContent` modules for internal calls to :command:`file(DOWNLOAD)`.
diff --git a/Help/variable/CMAKE_TLS_VERSION-VALUES.txt b/Help/variable/CMAKE_TLS_VERSION-VALUES.txt
new file mode 100644
index 0000000..47fd2bc
--- /dev/null
+++ b/Help/variable/CMAKE_TLS_VERSION-VALUES.txt
@@ -0,0 +1,7 @@
+* ``1.0``
+
+* ``1.1``
+
+* ``1.2``
+
+* ``1.3``
diff --git a/Help/variable/CMAKE_TLS_VERSION.rst b/Help/variable/CMAKE_TLS_VERSION.rst
new file mode 100644
index 0000000..3e7f2ce
--- /dev/null
+++ b/Help/variable/CMAKE_TLS_VERSION.rst
@@ -0,0 +1,17 @@
+CMAKE_TLS_VERSION
+-----------------
+
+.. versionadded:: 3.30
+
+Specify the default value for the :command:`file(DOWNLOAD)` and
+:command:`file(UPLOAD)` commands' ``TLS_VERSION`` option.
+If this variable is not set, the commands check the
+:envvar:`CMAKE_TLS_VERSION` environment variable.
+
+The value may be one of:
+
+.. include:: CMAKE_TLS_VERSION-VALUES.txt
+
+This variable is also used by the :module:`ExternalProject` and
+:module:`FetchContent` modules for internal calls to
+:command:`file(DOWNLOAD)` and ``git clone``.
diff --git a/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst b/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst
new file mode 100644
index 0000000..35d94bc
--- /dev/null
+++ b/Help/variable/CMAKE_VS_USE_DEBUG_LIBRARIES.rst
@@ -0,0 +1,29 @@
+CMAKE_VS_USE_DEBUG_LIBRARIES
+----------------------------
+
+.. versionadded:: 3.30
+
+.. |VS_USE_DEBUG_LIBRARIES| replace:: ``CMAKE_VS_USE_DEBUG_LIBRARIES``
+.. |MSVC_RUNTIME_LIBRARY| replace:: :variable:`CMAKE_MSVC_RUNTIME_LIBRARY`
+
+.. include:: ../prop_tgt/VS_USE_DEBUG_LIBRARIES-PURPOSE.txt
+
+Use :manual:`generator expressions <cmake-generator-expressions(7)>`
+for per-configuration specification. For example, the code:
+
+.. code-block:: cmake
+
+ set(CMAKE_VS_USE_DEBUG_LIBRARIES "$<CONFIG:Debug,Custom>")
+
+indicates that all following targets consider their "Debug" and "Custom"
+configurations to be debug configurations, and their other configurations
+to be non-debug configurations.
+
+This variable is used to initialize the :prop_tgt:`VS_USE_DEBUG_LIBRARIES`
+property on all targets as they are created. It is also propagated by
+calls to the :command:`try_compile` command into its test project.
+
+If this variable is not set then the :prop_tgt:`VS_USE_DEBUG_LIBRARIES`
+property will not be set automatically. If that property is not set then
+CMake generates ``UseDebugLibraries`` using heuristics to determine which
+configurations are debug configurations. See policy :policy:`CMP0162`.
diff --git a/Help/variable/CTEST_CURL_OPTIONS.rst b/Help/variable/CTEST_CURL_OPTIONS.rst
index 14af4e4..45e84ed 100644
--- a/Help/variable/CTEST_CURL_OPTIONS.rst
+++ b/Help/variable/CTEST_CURL_OPTIONS.rst
@@ -1,6 +1,10 @@
CTEST_CURL_OPTIONS
------------------
+.. deprecated:: 3.30
+
+ Use the :variable:`CTEST_TLS_VERIFY` variable instead.
+
.. versionadded:: 3.1
Specify the CTest ``CurlOptions`` setting
diff --git a/Help/variable/CTEST_TLS_VERIFY.rst b/Help/variable/CTEST_TLS_VERIFY.rst
new file mode 100644
index 0000000..9b3d96c
--- /dev/null
+++ b/Help/variable/CTEST_TLS_VERIFY.rst
@@ -0,0 +1,13 @@
+CTEST_TLS_VERIFY
+----------------
+
+.. versionadded:: 3.30
+
+Specify the CTest ``TLSVerify`` setting in a :manual:`ctest(1)`
+:ref:`Dashboard Client` script or in project ``CMakeLists.txt`` code
+before including the :module:`CTest` module. The value is a boolean
+indicating whether to verify the server certificate when submitting
+to a dashboard via ``https://`` URLs.
+
+If ``CTEST_TLS_VERIFY`` is not set, the :variable:`CMAKE_TLS_VERIFY` variable
+or :envvar:`CMAKE_TLS_VERIFY` environment variable is used instead.
diff --git a/Help/variable/CTEST_TLS_VERSION.rst b/Help/variable/CTEST_TLS_VERSION.rst
new file mode 100644
index 0000000..f8123df
--- /dev/null
+++ b/Help/variable/CTEST_TLS_VERSION.rst
@@ -0,0 +1,16 @@
+CTEST_TLS_VERSION
+-----------------
+
+.. versionadded:: 3.30
+
+Specify the CTest ``TLSVersion`` setting in a :manual:`ctest(1)`
+:ref:`Dashboard Client` script or in project ``CMakeLists.txt`` code
+before including the :module:`CTest` module. The value is a minimum
+TLS version allowed when submitting to a dashboard via ``https://`` URLs.
+
+The value may be one of:
+
+.. include:: CMAKE_TLS_VERSION-VALUES.txt
+
+If ``CTEST_TLS_VERSION`` is not set, the :variable:`CMAKE_TLS_VERSION` variable
+or :envvar:`CMAKE_TLS_VERSION` environment variable is used instead.
diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake
index a72575b..898b823 100644
--- a/Modules/CMakeASM_NASMInformation.cmake
+++ b/Modules/CMakeASM_NASMInformation.cmake
@@ -12,6 +12,8 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
endif()
@@ -20,6 +22,8 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho)
endif()
@@ -28,6 +32,8 @@ if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
elseif(DEFINED CMAKE_CXX_SIZEOF_DATA_PTR AND CMAKE_CXX_SIZEOF_DATA_PTR EQUAL 8)
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
else()
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf)
endif()
@@ -38,6 +44,11 @@ if(NOT CMAKE_ASM_NASM_COMPILE_OBJECT)
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
endif()
+if(NOT CMAKE_ASM_NASM_LINK_EXECUTABLE)
+ set(CMAKE_ASM_NASM_LINK_EXECUTABLE
+ "<CMAKE_LINKER> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+endif()
+
if(CMAKE_ASM_NASM_COMPILER_ID STREQUAL "NASM")
set(CMAKE_DEPFILE_FLAGS_ASM_NASM "-MD <DEP_FILE> -MT <DEP_TARGET>")
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index df2a060..1726fe9 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -6,6 +6,7 @@ set(CMAKE_C_COMPILER_VERSION_INTERNAL "@CMAKE_C_COMPILER_VERSION_INTERNAL@")
set(CMAKE_C_COMPILER_WRAPPER "@CMAKE_C_COMPILER_WRAPPER@")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "@CMAKE_C_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_C_STANDARD_LATEST "@CMAKE_C_STANDARD_LATEST@")
set(CMAKE_C_COMPILE_FEATURES "@CMAKE_C_COMPILE_FEATURES@")
set(CMAKE_C90_COMPILE_FEATURES "@CMAKE_C90_COMPILE_FEATURES@")
set(CMAKE_C99_COMPILE_FEATURES "@CMAKE_C99_COMPILE_FEATURES@")
diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in
index 82d56cf..759cdf4 100644
--- a/Modules/CMakeCCompilerId.c.in
+++ b/Modules/CMakeCCompilerId.c.in
@@ -39,19 +39,28 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_C_COMPILER_ID_ERROR_FOR_TEST@
+#define C_STD_99 199901L
+#define C_STD_11 201112L
+#define C_STD_17 201710L
+#define C_STD_23 202311L
+
+#ifdef __STDC_VERSION__
+# define C_STD __STDC_VERSION__
+#endif
+
#if !defined(__STDC__) && !defined(__clang__)
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_VERSION "90"
# else
# define C_VERSION
# endif
-#elif __STDC_VERSION__ > 201710L
+#elif C_STD > C_STD_17
# define C_VERSION "23"
-#elif __STDC_VERSION__ >= 201710L
+#elif C_STD > C_STD_11
# define C_VERSION "17"
-#elif __STDC_VERSION__ >= 201000L
+#elif C_STD > C_STD_99
# define C_VERSION "11"
-#elif __STDC_VERSION__ >= 199901L
+#elif C_STD >= C_STD_99
# define C_VERSION "99"
#else
# define C_VERSION "90"
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 3af02a4..c054e5c 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -7,6 +7,7 @@ set(CMAKE_CUDA_DEVICE_LINKER "@CMAKE_CUDA_DEVICE_LINKER@")
set(CMAKE_CUDA_FATBINARY "@CMAKE_CUDA_FATBINARY@")
set(CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT "@CMAKE_CUDA_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CUDA_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_CUDA_STANDARD_LATEST "@CMAKE_CUDA_STANDARD_LATEST@")
set(CMAKE_CUDA_COMPILE_FEATURES "@CMAKE_CUDA_COMPILE_FEATURES@")
set(CMAKE_CUDA03_COMPILE_FEATURES "@CMAKE_CUDA03_COMPILE_FEATURES@")
set(CMAKE_CUDA11_COMPILE_FEATURES "@CMAKE_CUDA11_COMPILE_FEATURES@")
@@ -14,6 +15,7 @@ set(CMAKE_CUDA14_COMPILE_FEATURES "@CMAKE_CUDA14_COMPILE_FEATURES@")
set(CMAKE_CUDA17_COMPILE_FEATURES "@CMAKE_CUDA17_COMPILE_FEATURES@")
set(CMAKE_CUDA20_COMPILE_FEATURES "@CMAKE_CUDA20_COMPILE_FEATURES@")
set(CMAKE_CUDA23_COMPILE_FEATURES "@CMAKE_CUDA23_COMPILE_FEATURES@")
+set(CMAKE_CUDA26_COMPILE_FEATURES "@CMAKE_CUDA26_COMPILE_FEATURES@")
set(CMAKE_CUDA_PLATFORM_ID "@CMAKE_CUDA_PLATFORM_ID@")
set(CMAKE_CUDA_SIMULATE_ID "@CMAKE_CUDA_SIMULATE_ID@")
diff --git a/Modules/CMakeCUDACompilerId.cu.in b/Modules/CMakeCUDACompilerId.cu.in
index d5a3b03..cecb948 100644
--- a/Modules/CMakeCUDACompilerId.cu.in
+++ b/Modules/CMakeCUDACompilerId.cu.in
@@ -16,16 +16,34 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
@CMAKE_CUDA_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_CUDA_COMPILER_ID_ERROR_FOR_TEST@
+#define CXX_STD_11 201103L
+#define CXX_STD_14 201402L
+#define CXX_STD_17 201703L
+#define CXX_STD_20 202002L
+#define CXX_STD_23 202302L
+
+#if defined(_MSC_VER) && defined(_MSVC_LANG)
+# if _MSVC_LANG > __cplusplus
+# define CXX_STD _MSVC_LANG
+# else
+# define CXX_STD __cplusplus
+# endif
+#else
+# define CXX_STD __cplusplus
+#endif
+
const char* info_language_standard_default = "INFO" ":" "standard_default["
-#if __cplusplus > 202002L
+#if CXX_STD > CXX_STD_23
+ "26"
+#elif CXX_STD > CXX_STD_20
"23"
-#elif __cplusplus > 201703L
+#elif CXX_STD > CXX_STD_17
"20"
-#elif __cplusplus >= 201703L
+#elif CXX_STD > CXX_STD_14
"17"
-#elif __cplusplus >= 201402L
+#elif CXX_STD > CXX_STD_11
"14"
-#elif __cplusplus >= 201103L
+#elif CXX_STD >= CXX_STD_11
"11"
#else
"03"
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 55f1113..2f7c3e4 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -6,6 +6,7 @@ set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "@CMAKE_CXX_COMPILER_VERSION_INTERNAL@")
set(CMAKE_CXX_COMPILER_WRAPPER "@CMAKE_CXX_COMPILER_WRAPPER@")
set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_CXX_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_CXX_STANDARD_LATEST "@CMAKE_CXX_STANDARD_LATEST@")
set(CMAKE_CXX_COMPILE_FEATURES "@CMAKE_CXX_COMPILE_FEATURES@")
set(CMAKE_CXX98_COMPILE_FEATURES "@CMAKE_CXX98_COMPILE_FEATURES@")
set(CMAKE_CXX11_COMPILE_FEATURES "@CMAKE_CXX11_COMPILE_FEATURES@")
@@ -13,6 +14,7 @@ set(CMAKE_CXX14_COMPILE_FEATURES "@CMAKE_CXX14_COMPILE_FEATURES@")
set(CMAKE_CXX17_COMPILE_FEATURES "@CMAKE_CXX17_COMPILE_FEATURES@")
set(CMAKE_CXX20_COMPILE_FEATURES "@CMAKE_CXX20_COMPILE_FEATURES@")
set(CMAKE_CXX23_COMPILE_FEATURES "@CMAKE_CXX23_COMPILE_FEATURES@")
+set(CMAKE_CXX26_COMPILE_FEATURES "@CMAKE_CXX26_COMPILE_FEATURES@")
set(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
set(CMAKE_CXX_SIMULATE_ID "@CMAKE_CXX_SIMULATE_ID@")
@@ -90,3 +92,6 @@ set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
set(CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR "@CMAKE_CXX_COMPILER_CLANG_RESOURCE_DIR@")
+
+set(CMAKE_CXX_COMPILER_IMPORT_STD "")
+@CMAKE_CXX_IMPORT_STD@
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 2643326..1cd8006 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -33,32 +33,73 @@ char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
@CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
-#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
-# if defined(__INTEL_CXX11_MODE__)
-# if defined(__cpp_aggregate_nsdmi)
-# define CXX_STD 201402L
-# else
-# define CXX_STD 201103L
-# endif
+#define CXX_STD_98 199711L
+#define CXX_STD_11 201103L
+#define CXX_STD_14 201402L
+#define CXX_STD_17 201703L
+#define CXX_STD_20 202002L
+#define CXX_STD_23 202302L
+
+#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG)
+# if _MSVC_LANG > CXX_STD_17
+# define CXX_STD _MSVC_LANG
+# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
+# define CXX_STD CXX_STD_20
+# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17
+# define CXX_STD CXX_STD_20
+# elif _MSVC_LANG > CXX_STD_14
+# define CXX_STD CXX_STD_17
+# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# elif defined(__INTEL_CXX11_MODE__)
+# define CXX_STD CXX_STD_11
# else
-# define CXX_STD 199711L
+# define CXX_STD CXX_STD_98
# endif
#elif defined(_MSC_VER) && defined(_MSVC_LANG)
-# define CXX_STD _MSVC_LANG
+# if _MSVC_LANG > __cplusplus
+# define CXX_STD _MSVC_LANG
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif defined(__NVCOMPILER)
+# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
+# define CXX_STD CXX_STD_20
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif defined(__INTEL_COMPILER) || defined(__PGI)
+# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes)
+# define CXX_STD CXX_STD_17
+# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__)
+# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define CXX_STD CXX_STD_11
#else
# define CXX_STD __cplusplus
#endif
const char* info_language_standard_default = "INFO" ":" "standard_default["
-#if CXX_STD > 202002L
+#if CXX_STD > CXX_STD_23
+ "26"
+#elif CXX_STD > CXX_STD_20
"23"
-#elif CXX_STD > 201703L
+#elif CXX_STD > CXX_STD_17
"20"
-#elif CXX_STD >= 201703L
+#elif CXX_STD > CXX_STD_14
"17"
-#elif CXX_STD >= 201402L
+#elif CXX_STD > CXX_STD_11
"14"
-#elif CXX_STD >= 201103L
+#elif CXX_STD >= CXX_STD_11
"11"
#else
"98"
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 012a87c..6d82304 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -50,7 +50,14 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
__TestCompiler_setTryCompileTargetType()
# Avoid failing ABI detection on warnings.
- string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS}")
+ if(CMAKE_TRY_COMPILE_CONFIGURATION)
+ string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config)
+ else()
+ set(_tc_config "DEBUG")
+ endif()
+ foreach(v CMAKE_${lang}_FLAGS CMAKE_${lang}_FLAGS_${_tc_config})
+ string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}")
+ endforeach()
# Save the current LC_ALL, LC_MESSAGES, and LANG environment variables
# and set them to "C" that way GCC's "search starts here" text is in
@@ -89,7 +96,10 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
# Load the resulting information strings.
if(CMAKE_${lang}_ABI_COMPILED)
message(CHECK_PASS "done")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 32 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ cmake_policy(POP)
set(ABI_SIZEOF_DPTR "NOTFOUND")
set(ABI_BYTE_ORDER "NOTFOUND")
set(ABI_NAME "NOTFOUND")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 7d063ed..7fcfbdc 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -312,6 +312,29 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
endif ()
endif ()
+ set(CMAKE_${lang}_STANDARD_LIBRARY "")
+ if ("x${lang}" STREQUAL "xCXX" AND
+ EXISTS "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${lang}-DetectStdlib.h" AND
+ "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xClang" AND
+ "x${CMAKE_${lang}_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
+ # See #20851 for a proper abstraction for this.
+ execute_process(
+ COMMAND "${CMAKE_${lang}_COMPILER}"
+ ${CMAKE_${lang}_COMPILER_ID_ARG1}
+ ${CMAKE_CXX_COMPILER_ID_FLAGS_LIST}
+ -E
+ -x c++-header
+ "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/${lang}-DetectStdlib.h"
+ -o - # Write to stdout.
+ OUTPUT_VARIABLE _lang_stdlib_out
+ ERROR_VARIABLE _lang_stdlib_err
+ RESULT_VARIABLE _lang_stdlib_res
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ if (_lang_stdlib_res EQUAL 0)
+ string(REGEX REPLACE ".*CMAKE-STDLIB-DETECT: (.+)\n.*" "\\1" "CMAKE_${lang}_STANDARD_LIBRARY" "${_lang_stdlib_out}")
+ endif ()
+ endif ()
+
# Display the final identification result.
if(CMAKE_${lang}_COMPILER_ID)
if(CMAKE_${lang}_COMPILER_VERSION)
@@ -355,6 +378,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src)
set(CMAKE_${lang}_COMPILER_PRODUCED_OUTPUT "${COMPILER_${lang}_PRODUCED_OUTPUT}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE)
set(CMAKE_${lang}_COMPILER_CLANG_RESOURCE_DIR "${CMAKE_${lang}_COMPILER_CLANG_RESOURCE_DIR}" PARENT_SCOPE)
+ set(CMAKE_${lang}_STANDARD_LIBRARY "${CMAKE_${lang}_STANDARD_LIBRARY}" PARENT_SCOPE)
endfunction()
include(CMakeCompilerIdDetection)
@@ -919,9 +943,12 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file)
set(SIMULATE_VERSION)
set(CMAKE_${lang}_COMPILER_ID_STRING_REGEX ".?I.?N.?F.?O.?:.?[A-Za-z0-9_]+\\[[^]]*\\]")
foreach(encoding "" "ENCODING;UTF-16LE" "ENCODING;UTF-16BE")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${file}" CMAKE_${lang}_COMPILER_ID_STRINGS
LIMIT_COUNT 38 ${encoding}
REGEX "${CMAKE_${lang}_COMPILER_ID_STRING_REGEX}")
+ cmake_policy(POP)
if(NOT CMAKE_${lang}_COMPILER_ID_STRINGS STREQUAL "")
break()
endif()
diff --git a/Modules/CMakeDetermineCompileFeatures.cmake b/Modules/CMakeDetermineCompilerSupport.cmake
index 09de7b1..d561e7b 100644
--- a/Modules/CMakeDetermineCompileFeatures.cmake
+++ b/Modules/CMakeDetermineCompilerSupport.cmake
@@ -2,7 +2,7 @@
# file Copyright.txt or https://cmake.org/licensing for details.
-function(cmake_determine_compile_features lang)
+function(cmake_determine_compiler_support lang)
if("x${lang}" STREQUAL "xC" AND COMMAND cmake_record_c_compile_features)
message(CHECK_START "Detecting ${lang} compile features")
@@ -105,6 +105,19 @@ function(cmake_determine_compile_features lang)
)
endif()
+ # Create targets for use with `import std;` here.
+ set(CMAKE_CXX_IMPORT_STD "")
+ foreach (_cmake_import_std_version IN ITEMS 23 26)
+ if (CMAKE_CXX${_cmake_import_std_version}_COMPILE_FEATURES)
+ set(_cmake_cxx_import_std "")
+ cmake_create_cxx_import_std("${_cmake_import_std_version}" _cmake_cxx_import_std)
+ if (_cmake_cxx_import_std)
+ string(APPEND CMAKE_CXX_IMPORT_STD "### Imported target for C++${_cmake_import_std_version} standard library\n")
+ string(APPEND CMAKE_CXX_IMPORT_STD "${_cmake_cxx_import_std}\n\n")
+ endif ()
+ endif ()
+ endforeach ()
+
set(CMAKE_CXX_COMPILE_FEATURES ${CMAKE_CXX_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX98_COMPILE_FEATURES ${CMAKE_CXX98_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX11_COMPILE_FEATURES ${CMAKE_CXX11_COMPILE_FEATURES} PARENT_SCOPE)
@@ -113,6 +126,7 @@ function(cmake_determine_compile_features lang)
set(CMAKE_CXX20_COMPILE_FEATURES ${CMAKE_CXX20_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX23_COMPILE_FEATURES ${CMAKE_CXX23_COMPILE_FEATURES} PARENT_SCOPE)
set(CMAKE_CXX26_COMPILE_FEATURES ${CMAKE_CXX26_COMPILE_FEATURES} PARENT_SCOPE)
+ set(CMAKE_CXX_IMPORT_STD ${CMAKE_CXX_IMPORT_STD} PARENT_SCOPE)
message(CHECK_PASS "done")
diff --git a/Modules/CMakeHIPCompiler.cmake.in b/Modules/CMakeHIPCompiler.cmake.in
index 9d70e03..601ffaf 100644
--- a/Modules/CMakeHIPCompiler.cmake.in
+++ b/Modules/CMakeHIPCompiler.cmake.in
@@ -5,6 +5,7 @@ set(CMAKE_HIP_COMPILER_ID "@CMAKE_HIP_COMPILER_ID@")
set(CMAKE_HIP_COMPILER_VERSION "@CMAKE_HIP_COMPILER_VERSION@")
set(CMAKE_HIP_STANDARD_COMPUTED_DEFAULT "@CMAKE_HIP_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_HIP_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_HIP_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_HIP_STANDARD_LATEST "@CMAKE_HIP_STANDARD_LATEST@")
set(CMAKE_HIP_COMPILE_FEATURES "@CMAKE_HIP_COMPILE_FEATURES@")
set(CMAKE_HIP98_COMPILE_FEATURES "@CMAKE_HIP03_COMPILE_FEATURES@")
set(CMAKE_HIP11_COMPILE_FEATURES "@CMAKE_HIP11_COMPILE_FEATURES@")
@@ -12,6 +13,7 @@ set(CMAKE_HIP14_COMPILE_FEATURES "@CMAKE_HIP14_COMPILE_FEATURES@")
set(CMAKE_HIP17_COMPILE_FEATURES "@CMAKE_HIP17_COMPILE_FEATURES@")
set(CMAKE_HIP20_COMPILE_FEATURES "@CMAKE_HIP20_COMPILE_FEATURES@")
set(CMAKE_HIP23_COMPILE_FEATURES "@CMAKE_HIP23_COMPILE_FEATURES@")
+set(CMAKE_HIP26_COMPILE_FEATURES "@CMAKE_HIP26_COMPILE_FEATURES@")
set(CMAKE_HIP_PLATFORM_ID "@CMAKE_HIP_PLATFORM_ID@")
set(CMAKE_HIP_SIMULATE_ID "@CMAKE_HIP_SIMULATE_ID@")
diff --git a/Modules/CMakeHIPCompilerId.hip.in b/Modules/CMakeHIPCompilerId.hip.in
index 4ac0f30..fa97667 100644
--- a/Modules/CMakeHIPCompilerId.hip.in
+++ b/Modules/CMakeHIPCompilerId.hip.in
@@ -16,16 +16,27 @@ char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
@CMAKE_HIP_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_HIP_COMPILER_ID_ERROR_FOR_TEST@
+#define CXX_STD_98 199711L
+#define CXX_STD_11 201103L
+#define CXX_STD_14 201402L
+#define CXX_STD_17 201703L
+#define CXX_STD_20 202002L
+#define CXX_STD_23 202302L
+
+#define CXX_STD __cplusplus
+
const char* info_language_standard_default = "INFO" ":" "standard_default["
-#if __cplusplus > 202002L
+#if CXX_STD > CXX_STD_23
+ "26"
+#elif CXX_STD > CXX_STD_20
"23"
-#elif __cplusplus > 201703L
+#elif CXX_STD > CXX_STD_17
"20"
-#elif __cplusplus >= 201703L
+#elif CXX_STD > CXX_STD_14
"17"
-#elif __cplusplus >= 201402L
+#elif CXX_STD > CXX_STD_11
"14"
-#elif __cplusplus >= 201103L
+#elif CXX_STD >= CXX_STD_11
"11"
#else
"98"
diff --git a/Modules/CMakeOBJCCompiler.cmake.in b/Modules/CMakeOBJCCompiler.cmake.in
index a8bb0d2..fb699fc 100644
--- a/Modules/CMakeOBJCCompiler.cmake.in
+++ b/Modules/CMakeOBJCCompiler.cmake.in
@@ -6,6 +6,7 @@ set(CMAKE_OBJC_COMPILER_VERSION_INTERNAL "@CMAKE_OBJC_COMPILER_VERSION_INTERNAL@
set(CMAKE_OBJC_COMPILER_WRAPPER "@CMAKE_OBJC_COMPILER_WRAPPER@")
set(CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJC_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_OBJC_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_OBJC_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_OBJC_STANDARD_LATEST "@CMAKE_OBJC_STANDARD_LATEST@")
set(CMAKE_OBJC_COMPILE_FEATURES "@CMAKE_OBJC_COMPILE_FEATURES@")
set(CMAKE_OBJC90_COMPILE_FEATURES "@CMAKE_OBJC90_COMPILE_FEATURES@")
set(CMAKE_OBJC99_COMPILE_FEATURES "@CMAKE_OBJC99_COMPILE_FEATURES@")
diff --git a/Modules/CMakeOBJCCompilerId.m.in b/Modules/CMakeOBJCCompilerId.m.in
index 89bfe02..e88bb6f 100644
--- a/Modules/CMakeOBJCCompilerId.m.in
+++ b/Modules/CMakeOBJCCompilerId.m.in
@@ -20,20 +20,28 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
@CMAKE_OBJC_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_OBJC_COMPILER_ID_ERROR_FOR_TEST@
+#define C_STD_99 199901L
+#define C_STD_11 201112L
+#define C_STD_17 201710L
+#define C_STD_23 202311L
+
+#ifdef __STDC_VERSION__
+# define C_STD __STDC_VERSION__
+#endif
+
#if !defined(__STDC__)
-# if (defined(_MSC_VER) && !defined(__clang__)) \
- || (defined(__ibmxl__) || defined(__IBMC__))
+# if defined(__ibmxl__) || defined(__IBMC__)
# define C_VERSION "90"
# else
# define C_VERSION
# endif
-#elif __STDC_VERSION__ > 201710L
+#elif C_STD > C_STD_17
# define C_VERSION "23"
-#elif __STDC_VERSION__ >= 201710L
+#elif C_STD > C_STD_11
# define C_VERSION "17"
-#elif __STDC_VERSION__ >= 201000L
+#elif C_STD > C_STD_99
# define C_VERSION "11"
-#elif __STDC_VERSION__ >= 199901L
+#elif C_STD >= C_STD_99
# define C_VERSION "99"
#else
# define C_VERSION "90"
diff --git a/Modules/CMakeOBJCXXCompiler.cmake.in b/Modules/CMakeOBJCXXCompiler.cmake.in
index 6a80d50..3bf12b1 100644
--- a/Modules/CMakeOBJCXXCompiler.cmake.in
+++ b/Modules/CMakeOBJCXXCompiler.cmake.in
@@ -6,6 +6,7 @@ set(CMAKE_OBJCXX_COMPILER_VERSION_INTERNAL "@CMAKE_OBJCXX_COMPILER_VERSION_INTER
set(CMAKE_OBJCXX_COMPILER_WRAPPER "@CMAKE_OBJCXX_COMPILER_WRAPPER@")
set(CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT "@CMAKE_OBJCXX_STANDARD_COMPUTED_DEFAULT@")
set(CMAKE_OBJCXX_EXTENSIONS_COMPUTED_DEFAULT "@CMAKE_OBJCXX_EXTENSIONS_COMPUTED_DEFAULT@")
+set(CMAKE_OBJCXX_STANDARD_LATEST "@CMAKE_OBJCXX_STANDARD_LATEST@")
set(CMAKE_OBJCXX_COMPILE_FEATURES "@CMAKE_OBJCXX_COMPILE_FEATURES@")
set(CMAKE_OBJCXX98_COMPILE_FEATURES "@CMAKE_OBJCXX98_COMPILE_FEATURES@")
set(CMAKE_OBJCXX11_COMPILE_FEATURES "@CMAKE_OBJCXX11_COMPILE_FEATURES@")
diff --git a/Modules/CMakeOBJCXXCompilerId.mm.in b/Modules/CMakeOBJCXXCompilerId.mm.in
index 2145b40..cadbaff 100644
--- a/Modules/CMakeOBJCXXCompilerId.mm.in
+++ b/Modules/CMakeOBJCXXCompilerId.mm.in
@@ -23,22 +23,27 @@ char const* qnxnto = "INFO" ":" "qnxnto[]";
@CMAKE_OBJCXX_COMPILER_ID_PLATFORM_CONTENT@
@CMAKE_OBJCXX_COMPILER_ID_ERROR_FOR_TEST@
-#if defined(_MSC_VER) && defined(_MSVC_LANG)
-#define CXX_STD _MSVC_LANG
-#else
+#define CXX_STD_98 199711L
+#define CXX_STD_11 201103L
+#define CXX_STD_14 201402L
+#define CXX_STD_17 201703L
+#define CXX_STD_20 202002L
+#define CXX_STD_23 202302L
+
#define CXX_STD __cplusplus
-#endif
const char* info_language_standard_default = "INFO" ":" "standard_default["
-#if CXX_STD > 202002L
+#if CXX_STD > CXX_STD_23
+ "26"
+#elif CXX_STD > CXX_STD_20
"23"
-#elfif CXX_STD > 201703L
+#elif CXX_STD > CXX_STD_17
"20"
-#elif CXX_STD >= 201703L
+#elif CXX_STD > CXX_STD_14
"17"
-#elif CXX_STD >= 201402L
+#elif CXX_STD > CXX_STD_11
"14"
-#elif CXX_STD >= 201103L
+#elif CXX_STD >= CXX_STD_11
"11"
#else
"98"
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 9fa30b6..7d038d4 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -76,6 +76,23 @@ always relative to the installed location of the package. This works both for
relative and also for absolute locations. For absolute locations, it works
only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
+.. versionadded:: 3.30
+ The variable ``PACKAGE_PREFIX_DIR`` will always be defined after the
+ ``@PACKAGE_INIT@`` line. It will hold the value of the base install
+ location. In general, variables defined via the ``PATH_VARS`` mechanism
+ should be used instead, but ``PACKAGE_PREFIX_DIR`` can be used for those
+ cases not easily handled by ``PATH_VARS``, such as for files installed
+ directly to the base install location rather than a subdirectory of it.
+
+ .. note::
+ When consumers of the generated file use CMake 3.29 or older, the value
+ of ``PACKAGE_PREFIX_DIR`` can be changed by a call to
+ :command:`find_dependency` or :command:`find_package`.
+ If a project relies on ``PACKAGE_PREFIX_DIR``, it is the project's
+ responsibility to ensure that the value of ``PACKAGE_PREFIX_DIR`` is
+ preserved across any such calls, or any other calls which might include
+ another file generated by ``configure_package_config_file()``.
+
.. versionadded:: 3.1
If the ``INSTALL_PREFIX`` argument is passed, this is used as the base path to
calculate all the relative paths. The ``<path>`` argument must be an absolute
diff --git a/Modules/CMakeSwiftInformation.cmake b/Modules/CMakeSwiftInformation.cmake
index f8b6748..60df6a2 100644
--- a/Modules/CMakeSwiftInformation.cmake
+++ b/Modules/CMakeSwiftInformation.cmake
@@ -57,6 +57,8 @@ set(CMAKE_Swift_LINK_LIBRARY_FLAG "-l")
set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
set(CMAKE_Swift_RESPONSE_FILE_FLAG @)
+set(CMAKE_Swift_COMPILE_OPTIONS_COLOR_DIAGNOSTICS -color-diagnostics)
+set(CMAKE_Swift_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF -no-color-diagnostics)
set(CMAKE_Swift_LINKER_PREFERENCE 50)
set(CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES 1)
@@ -136,7 +138,7 @@ if(CMAKE_Swift_COMPILATION_MODE_DEFAULT)
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
- set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
+ set(CMAKE_Swift_CREATE_SHARED_MODULE "${CMAKE_Swift_CREATE_SHARED_LIBRARY} <CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS>")
endif()
if(NOT CMAKE_Swift_LINK_EXECUTABLE)
@@ -160,7 +162,7 @@ else()
endif()
if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
- set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
+ set(CMAKE_Swift_CREATE_SHARED_MODULE "${CMAKE_Swift_CREATE_SHARED_LIBRARY} <CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS>")
endif()
if(NOT CMAKE_Swift_LINK_EXECUTABLE)
diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake
index 58726db..8ebe570 100644
--- a/Modules/CMakeTestCCompiler.cmake
+++ b/Modules/CMakeTestCCompiler.cmake
@@ -73,8 +73,8 @@ if(NOT CMAKE_C_COMPILER_WORKS)
endif()
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(C)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(C)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CMakeTestCUDACompiler.cmake b/Modules/CMakeTestCUDACompiler.cmake
index 3057fe9..ef97f55 100644
--- a/Modules/CMakeTestCUDACompiler.cmake
+++ b/Modules/CMakeTestCUDACompiler.cmake
@@ -65,8 +65,8 @@ if(NOT CMAKE_CUDA_COMPILER_WORKS)
endif()
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(CUDA)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(CUDA)
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CUDA_IMPLICIT_LINK_LIBRARIES "${CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES}")
diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake
index e640ff9..c82a154 100644
--- a/Modules/CMakeTestCXXCompiler.cmake
+++ b/Modules/CMakeTestCXXCompiler.cmake
@@ -66,8 +66,8 @@ if(NOT CMAKE_CXX_COMPILER_WORKS)
endif()
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(CXX)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(CXX)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CMakeTestHIPCompiler.cmake b/Modules/CMakeTestHIPCompiler.cmake
index ec54d80..5b49c0d 100644
--- a/Modules/CMakeTestHIPCompiler.cmake
+++ b/Modules/CMakeTestHIPCompiler.cmake
@@ -83,8 +83,8 @@ unset(__CMAKE_HIP_FLAGS)
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(HIP)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(HIP)
if(CMAKE_HIP_COMPILER_ID STREQUAL "NVIDIA")
include(Internal/CMakeNVCCFilterImplicitInfo)
diff --git a/Modules/CMakeTestOBJCCompiler.cmake b/Modules/CMakeTestOBJCCompiler.cmake
index a36180b..bcb3e1e 100644
--- a/Modules/CMakeTestOBJCCompiler.cmake
+++ b/Modules/CMakeTestOBJCCompiler.cmake
@@ -70,8 +70,8 @@ if(NOT CMAKE_OBJC_COMPILER_WORKS)
endif()
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(OBJC)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(OBJC)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CMakeTestOBJCXXCompiler.cmake b/Modules/CMakeTestOBJCXXCompiler.cmake
index f7935c7..68b3871 100644
--- a/Modules/CMakeTestOBJCXXCompiler.cmake
+++ b/Modules/CMakeTestOBJCXXCompiler.cmake
@@ -69,8 +69,8 @@ if(NOT CMAKE_OBJCXX_COMPILER_WORKS)
endif()
# Try to identify the compiler features
-include(${CMAKE_ROOT}/Modules/CMakeDetermineCompileFeatures.cmake)
-CMAKE_DETERMINE_COMPILE_FEATURES(OBJCXX)
+include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerSupport.cmake)
+CMAKE_DETERMINE_COMPILER_SUPPORT(OBJCXX)
# Re-configure to save learned information.
configure_file(
diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake
index 705ef8a..19827f1 100644
--- a/Modules/CMakeVerifyManifest.cmake
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -31,7 +31,10 @@ found in the .manifest file.
# it will put the list of versions found into the variable
# specified by list_var
function(crt_version file list_var)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${file}" strings REGEX "Microsoft.VC...CRT" NEWLINE_CONSUME)
+ cmake_policy(POP)
foreach(s ${strings})
set(has_match 1)
string(REGEX
diff --git a/Modules/CTestTargets.cmake b/Modules/CTestTargets.cmake
index 99ef8e5..5e8a07d 100644
--- a/Modules/CTestTargets.cmake
+++ b/Modules/CTestTargets.cmake
@@ -20,15 +20,31 @@ mark_as_advanced(CMAKE_CTEST_COMMAND)
# Use CTest
# configure files
-if(CTEST_NEW_FORMAT)
- configure_file(
- ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
- ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
-else()
- configure_file(
- ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
- ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
-endif()
+block()
+ if(NOT DEFINED CTEST_TLS_VERSION)
+ if(DEFINED CMAKE_TLS_VERSION)
+ set(CTEST_TLS_VERSION "${CMAKE_TLS_VERSION}")
+ elseif(DEFINED ENV{CMAKE_TLS_VERSION})
+ set(CTEST_TLS_VERSION "$ENV{CMAKE_TLS_VERSION}")
+ endif()
+ endif()
+ if(NOT DEFINED CTEST_TLS_VERIFY)
+ if(DEFINED CMAKE_TLS_VERIFY)
+ set(CTEST_TLS_VERIFY "${CMAKE_TLS_VERIFY}")
+ elseif(DEFINED ENV{CMAKE_TLS_VERIFY})
+ set(CTEST_TLS_VERIFY "$ENV{CMAKE_TLS_VERIFY}")
+ endif()
+ endif()
+ if(CTEST_NEW_FORMAT)
+ configure_file(
+ ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
+ ${PROJECT_BINARY_DIR}/CTestConfiguration.ini )
+ else()
+ configure_file(
+ ${CMAKE_ROOT}/Modules/DartConfiguration.tcl.in
+ ${PROJECT_BINARY_DIR}/DartConfiguration.tcl )
+ endif()
+endblock()
#
# Section 3:
diff --git a/Modules/CXX-DetectStdlib.h b/Modules/CXX-DetectStdlib.h
new file mode 100644
index 0000000..0214dee
--- /dev/null
+++ b/Modules/CXX-DetectStdlib.h
@@ -0,0 +1,10 @@
+#include <version>
+// clang-format off
+#if defined(_LIBCPP_VERSION)
+CMAKE-STDLIB-DETECT: libc++
+#elif defined(__GLIBCXX__)
+CMAKE-STDLIB-DETECT: libstdc++
+#else
+CMAKE-STDLIB-DETECT: UNKNOWN
+#endif
+ // clang-format on
diff --git a/Modules/CheckForPthreads.c b/Modules/CheckForPthreads.c
index e70ceb1..ea1f7ac 100644
--- a/Modules/CheckForPthreads.c
+++ b/Modules/CheckForPthreads.c
@@ -1,6 +1,6 @@
#include <pthread.h>
-void* start_routine(void* args)
+static void* start_routine(void* args)
{
return args;
}
diff --git a/Modules/CheckLibraryExists.lists.in b/Modules/CheckLibraryExists.lists.in
deleted file mode 100644
index 741b87d..0000000
--- a/Modules/CheckLibraryExists.lists.in
+++ /dev/null
@@ -1,8 +0,0 @@
-PROJECT(CHECK_LIBRARY_EXISTS)
-
-
-ADD_DEFINITIONS(-DCHECK_FUNCTION_EXISTS=${CHECK_LIBRARY_EXISTS_FUNCTION})
-LINK_DIRECTORIES(${CHECK_LIBRARY_EXISTS_LOCATION})
-ADD_EXECUTABLE(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_SOURCE})
-TARGET_LINK_LIBRARIES(CheckLibraryExists ${CHECK_LIBRARY_EXISTS_LIBRARY})
-
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 72fd093..959f8e5 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -66,7 +66,7 @@ macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
set(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
${_INCLUDE_FILES}
-int main()
+int main(void)
{
(void)sizeof(((${_STRUCT} *)0)->${_MEMBER});
return 0;
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index 931ed4a..621df75 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -75,14 +75,28 @@ macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
endmacro()
macro(__CHECK_SYMBOL_EXISTS_FILTER_FLAGS LANG)
- set(__CMAKE_${LANG}_FLAGS_SAVED "${CMAKE_${LANG}_FLAGS}")
- string(REGEX REPLACE "(^| )-Werror([= ][^ ]*)?( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
- string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS}")
+ if(CMAKE_TRY_COMPILE_CONFIGURATION)
+ string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config)
+ else()
+ set(_tc_config "DEBUG")
+ endif()
+ foreach(v CMAKE_${LANG}_FLAGS CMAKE_${LANG}_FLAGS_${_tc_config})
+ set(__${v}_SAVED "${${v}}")
+ string(REGEX REPLACE "(^| )-Werror([= ][^-][^ ]*)?( |$)" " " ${v} "${${v}}")
+ string(REGEX REPLACE "(^| )-pedantic-errors( |$)" " " ${v} "${${v}}")
+ endforeach()
endmacro()
macro(__CHECK_SYMBOL_EXISTS_RESTORE_FLAGS LANG)
- set(CMAKE_${LANG}_FLAGS "${__CMAKE_${LANG}_FLAGS_SAVED}")
- unset(__CMAKE_${LANG}_FLAGS_SAVED)
+ if(CMAKE_TRY_COMPILE_CONFIGURATION)
+ string(TOUPPER "${CMAKE_TRY_COMPILE_CONFIGURATION}" _tc_config)
+ else()
+ set(_tc_config "DEBUG")
+ endif()
+ foreach(v CMAKE_${LANG}_FLAGS CMAKE_${LANG}_FLAGS_${_tc_config})
+ set(${v} "${__${v}_SAVED}")
+ unset(__${v}_SAVED)
+ endforeach()
endmacro()
macro(__CHECK_SYMBOL_EXISTS_IMPL SOURCEFILE SYMBOL FILES VARIABLE)
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 01ce1d2..849d691 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -92,6 +92,7 @@ include_guard(GLOBAL)
block(SCOPE_FOR POLICIES)
cmake_policy(SET CMP0054 NEW)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
#-----------------------------------------------------------------------------
# Helper function. DO NOT CALL DIRECTLY.
diff --git a/Modules/Compiler/ADSP-C.cmake b/Modules/Compiler/ADSP-C.cmake
index cef3fb1..1898401 100644
--- a/Modules/Compiler/ADSP-C.cmake
+++ b/Modules/Compiler/ADSP-C.cmake
@@ -8,4 +8,6 @@ set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C_STANDARD_LATEST 99)
+
__compiler_check_default_language_standard(C 8.0.0.0 99)
diff --git a/Modules/Compiler/ADSP-CXX.cmake b/Modules/Compiler/ADSP-CXX.cmake
index b01cab1..e82d9fb 100644
--- a/Modules/Compiler/ADSP-CXX.cmake
+++ b/Modules/Compiler/ADSP-CXX.cmake
@@ -6,11 +6,13 @@ __compiler_adsp(CXX)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -c++)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -g++)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX_STANDARD_LATEST 98)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.3.0.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -c++11 -g++)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
__compiler_check_default_language_standard(CXX 8.0.0.0 98)
diff --git a/Modules/Compiler/ARMClang-C.cmake b/Modules/Compiler/ARMClang-C.cmake
index 01c4cea..fce1a8e 100644
--- a/Modules/Compiler/ARMClang-C.cmake
+++ b/Modules/Compiler/ARMClang-C.cmake
@@ -21,3 +21,13 @@ set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+set(CMAKE_C_STANDARD_LATEST 11)
+
+# Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-C.cmake" script above may set several other compile option
+# variables which do not necessarily apply here. So, we unset those variables accordingly.
+unset(CMAKE_C17_STANDARD_COMPILE_OPTION)
+unset(CMAKE_C17_EXTENSION_COMPILE_OPTION)
+
+unset(CMAKE_C23_STANDARD_COMPILE_OPTION)
+unset(CMAKE_C23_EXTENSION_COMPILE_OPTION)
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index d711b6e..41e7988 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/Modules/Compiler/AppleClang-C.cmake
@@ -26,16 +26,20 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ set(CMAKE_C_STANDARD_LATEST 17)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.3)
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ set(CMAKE_C_STANDARD_LATEST 23)
endif()
__compiler_check_default_language_standard(C 4.0 99 9.1 11 12.0.5 17)
diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake
index 7c97969..8a6c855 100644
--- a/Modules/Compiler/AppleClang-CXX.cmake
+++ b/Modules/Compiler/AppleClang-CXX.cmake
@@ -22,25 +22,31 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
# AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_CXX_STANDARD_LATEST 17)
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
@@ -50,14 +56,17 @@ endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b")
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 23)
endif()
__compiler_check_default_language_standard(CXX 4.0 98)
diff --git a/Modules/Compiler/AppleClang-OBJC.cmake b/Modules/Compiler/AppleClang-OBJC.cmake
index f40c396..aa02d4b 100644
--- a/Modules/Compiler/AppleClang-OBJC.cmake
+++ b/Modules/Compiler/AppleClang-OBJC.cmake
@@ -21,6 +21,8 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 11)
endif()
# AppleClang 10.0 was the oldest compiler available to test C17 support
@@ -28,12 +30,16 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 10.0)
set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17")
set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 17)
endif()
-if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 11.0)
+if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 11.0.3)
set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x")
set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 23)
endif()
# AppleClang 10.0 was the oldest compiler available to test default C11 support
diff --git a/Modules/Compiler/AppleClang-OBJCXX.cmake b/Modules/Compiler/AppleClang-OBJCXX.cmake
index 172a343..d2573e5 100644
--- a/Modules/Compiler/AppleClang-OBJCXX.cmake
+++ b/Modules/Compiler/AppleClang-OBJCXX.cmake
@@ -19,25 +19,31 @@ if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 4.0)
set(CMAKE_OBJCXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_OBJCXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+
+ set(CMAKE_OBJCXX_STANDARD_LATEST 11)
endif()
if(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_OBJCXX_STANDARD_LATEST 14)
elseif(NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 5.1)
# AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L
set(CMAKE_OBJCXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_OBJCXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
set(CMAKE_OBJCXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_OBJCXX_STANDARD_LATEST 14)
endif()
if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0)
set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_OBJCXX_STANDARD_LATEST 17)
elseif (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 6.1)
set(CMAKE_OBJCXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
set(CMAKE_OBJCXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+ set(CMAKE_OBJCXX_STANDARD_LATEST 17)
endif()
if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 8.0)
@@ -47,6 +53,7 @@ endif()
if (NOT CMAKE_OBJCXX_COMPILER_VERSION VERSION_LESS 10.0)
set(CMAKE_OBJCXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
set(CMAKE_OBJCXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+ set(CMAKE_OBJCXX_STANDARD_LATEST 20)
endif()
__compiler_check_default_language_standard(OBJCXX 4.0 98)
diff --git a/Modules/Compiler/CMakeCommonCompilerMacros.cmake b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
index 2f220d4..9eead20 100644
--- a/Modules/Compiler/CMakeCommonCompilerMacros.cmake
+++ b/Modules/Compiler/CMakeCommonCompilerMacros.cmake
@@ -105,6 +105,9 @@ endmacro()
# Define to allow compile features to be automatically determined
macro(cmake_record_cxx_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CXX26_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cxx(26)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CXX23_STANDARD_COMPILE_OPTION)
_has_compiler_features_cxx(23)
endif()
@@ -142,6 +145,9 @@ endmacro()
macro(cmake_record_cuda_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_CUDA26_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_cuda(26)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_CUDA23_STANDARD_COMPILE_OPTION)
_has_compiler_features_cuda(23)
endif()
@@ -179,6 +185,9 @@ endmacro()
macro(cmake_record_hip_compile_features)
set(_result 0)
+ if(_result EQUAL 0 AND DEFINED CMAKE_HIP26_STANDARD_COMPILE_OPTION)
+ _has_compiler_features_hip(26)
+ endif()
if(_result EQUAL 0 AND DEFINED CMAKE_HIP23_STANDARD_COMPILE_OPTION)
_has_compiler_features_hip(23)
endif()
@@ -192,3 +201,52 @@ macro(cmake_record_hip_compile_features)
_has_compiler_features_hip(11)
_has_compiler_features_hip(98)
endmacro()
+
+function(cmake_create_cxx_import_std std variable)
+ set(_cmake_supported_import_std_features
+ # Compilers support `import std` in C++20 as an extension. Skip
+ # for now.
+ # 20
+ 23
+ 26)
+ list(FIND _cmake_supported_import_std_features "${std}" _cmake_supported_import_std_idx)
+ if (_cmake_supported_import_std_idx EQUAL "-1")
+ return ()
+ endif ()
+ # If the target exists, skip. A toolchain file may have provided it.
+ if (TARGET "__CMAKE::CXX${std}")
+ return ()
+ endif ()
+ # The generator must support imported C++ modules.
+ if (NOT CMAKE_GENERATOR MATCHES "Ninja")
+ return ()
+ endif ()
+ # Check if the compiler understands how to `import std;`.
+ include("${CMAKE_ROOT}/Modules/Compiler/${CMAKE_CXX_COMPILER_ID}-CXX-CXXImportStd.cmake" OPTIONAL RESULT_VARIABLE _cmake_import_std_res)
+ if (NOT _cmake_import_std_res)
+ return ()
+ endif ()
+ if (NOT COMMAND _cmake_cxx_import_std)
+ return ()
+ endif ()
+
+ # Check the experimental flag. Check it here to avoid triggering warnings in
+ # situations that don't support the feature anyways.
+ set(_cmake_supported_import_std_experimental "")
+ cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "CxxImportStd"
+ _cmake_supported_import_std_experimental)
+ if (NOT _cmake_supported_import_std_experimental)
+ return ()
+ endif ()
+
+ _cmake_cxx_import_std("${std}" target_definition)
+ string(CONCAT guarded_target_definition
+ "if (NOT TARGET \"__CMAKE::CXX${std}\")\n"
+ "${target_definition}"
+ "endif ()\n"
+ "if (TARGET \"__CMAKE::CXX${std}\")\n"
+ " list(APPEND CMAKE_CXX_COMPILER_IMPORT_STD \"${std}\")\n"
+ "endif ()\n")
+ set("${variable}" "${guarded_target_definition}" PARENT_SCOPE)
+endfunction()
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index 480a5de..c9b1669 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -33,27 +33,34 @@ if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+
+ set(CMAKE_C_STANDARD_LATEST 99)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ set(CMAKE_C_STANDARD_LATEST 11)
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ set(CMAKE_C_STANDARD_LATEST 17)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23")
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23")
+ set(CMAKE_C_STANDARD_LATEST 23)
elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)
set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ set(CMAKE_C_STANDARD_LATEST 23)
endif()
else()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
@@ -74,6 +81,8 @@ else()
set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
endif()
+
+ set(CMAKE_C_STANDARD_LATEST 17)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1)
diff --git a/Modules/Compiler/Clang-CXX-CXXImportStd.cmake b/Modules/Compiler/Clang-CXX-CXXImportStd.cmake
new file mode 100644
index 0000000..3934db9
--- /dev/null
+++ b/Modules/Compiler/Clang-CXX-CXXImportStd.cmake
@@ -0,0 +1,153 @@
+function (_cmake_cxx_import_std std variable)
+ if (NOT CMAKE_CXX_STANDARD_LIBRARY STREQUAL "libc++")
+ return ()
+ endif ()
+
+ execute_process(
+ COMMAND
+ "${CMAKE_CXX_COMPILER}"
+ ${CMAKE_CXX_COMPILER_ID_ARG1}
+ -print-file-name=libc++.modules.json
+ OUTPUT_VARIABLE _clang_libcxx_modules_json_file
+ ERROR_VARIABLE _clang_libcxx_modules_json_file_err
+ RESULT_VARIABLE _clang_libcxx_modules_json_file_res
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_STRIP_TRAILING_WHITESPACE)
+ if (_clang_libcxx_modules_json_file_res)
+ return ()
+ endif ()
+
+ # Without this file, we do not have modules installed.
+ if (NOT EXISTS "${_clang_libcxx_modules_json_file}")
+ return ()
+ endif ()
+
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "18.1.2")
+ # The original PR had a key spelling mismatch internally. Do not support it
+ # and instead require a release known to have the fix.
+ # https://github.com/llvm/llvm-project/pull/83036
+ return ()
+ endif ()
+
+ file(READ "${_clang_libcxx_modules_json_file}" _clang_libcxx_modules_json)
+ string(JSON _clang_modules_json_version GET "${_clang_libcxx_modules_json}" "version")
+ string(JSON _clang_modules_json_revision GET "${_clang_libcxx_modules_json}" "revision")
+ # Require version 1.
+ if (NOT _clang_modules_json_version EQUAL "1")
+ return ()
+ endif ()
+
+ string(JSON _clang_modules_json_nmodules LENGTH "${_clang_libcxx_modules_json}" "modules")
+ # Don't declare the target without any modules.
+ if (NOT _clang_modules_json_nmodules)
+ return ()
+ endif ()
+
+ # Declare the target.
+ set(_clang_libcxx_target "")
+ # Clang 18 does not provide the module initializer for the `std` modules.
+ # Create a static library to hold these. Hope that Clang 19 can provide this,
+ # but never run the code.
+ string(APPEND _clang_libcxx_target
+ "add_library(__cmake_cxx${std} STATIC)\n")
+ string(APPEND _clang_libcxx_target
+ "target_sources(__cmake_cxx${std} INTERFACE \"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:$<TARGET_OBJECTS:__cmake_cxx${std}>>\")\n")
+ string(APPEND _clang_libcxx_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY EXCLUDE_FROM_ALL 1)\n")
+ string(APPEND _clang_libcxx_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY CXX_SCAN_FOR_MODULES 1)\n")
+ string(APPEND _clang_libcxx_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY CXX_MODULE_STD 0)\n")
+ string(APPEND _clang_libcxx_target
+ "target_compile_features(__cmake_cxx${std} PUBLIC cxx_std_${std})\n")
+
+ set(_clang_modules_is_stdlib 0)
+ set(_clang_modules_include_dirs_list "")
+ set(_clang_modules_module_paths "")
+ get_filename_component(_clang_modules_dir "${_clang_libcxx_modules_json_file}" DIRECTORY)
+
+ # Add module sources.
+ math(EXPR _clang_modules_json_nmodules_range "${_clang_modules_json_nmodules} - 1")
+ foreach (_clang_modules_json_modules_idx RANGE 0 "${_clang_modules_json_nmodules_range}")
+ string(JSON _clang_modules_json_module GET "${_clang_libcxx_modules_json}" "modules" "${_clang_modules_json_modules_idx}")
+
+ string(JSON _clang_modules_json_module_source GET "${_clang_modules_json_module}" "source-path")
+ string(JSON _clang_modules_json_module_is_stdlib GET "${_clang_modules_json_module}" "is-std-library")
+ string(JSON _clang_modules_json_module_local_arguments GET "${_clang_modules_json_module}" "local-arguments")
+ string(JSON _clang_modules_json_module_nsystem_include_directories LENGTH "${_clang_modules_json_module_local_arguments}" "system-include-directories")
+
+ if (NOT IS_ABSOLUTE "${_clang_modules_json_module_source}")
+ string(PREPEND _clang_modules_json_module_source "${_clang_modules_dir}/")
+ endif ()
+ list(APPEND _clang_modules_module_paths
+ "${_clang_modules_json_module_source}")
+
+ if (_clang_modules_json_module_is_stdlib)
+ set(_clang_modules_is_stdlib 1)
+ endif ()
+
+ math(EXPR _clang_modules_json_module_nsystem_include_directories_range "${_clang_modules_json_module_nsystem_include_directories} - 1")
+ foreach (_clang_modules_json_modules_system_include_directories_idx RANGE 0 "${_clang_modules_json_module_nsystem_include_directories_range}")
+ string(JSON _clang_modules_json_module_system_include_directory GET "${_clang_modules_json_module_local_arguments}" "system-include-directories" "${_clang_modules_json_modules_system_include_directories_idx}")
+
+ if (NOT IS_ABSOLUTE "${_clang_modules_json_module_system_include_directory}")
+ string(PREPEND _clang_modules_json_module_system_include_directory "${_clang_modules_dir}/")
+ endif ()
+ list(APPEND _clang_modules_include_dirs_list
+ "${_clang_modules_json_module_system_include_directory}")
+ endforeach ()
+ endforeach ()
+
+ # Split the paths into basedirs and module paths.
+ set(_clang_modules_base_dirs_list "")
+ set(_clang_modules_files "")
+ foreach (_clang_modules_module_path IN LISTS _clang_modules_module_paths)
+ get_filename_component(_clang_module_dir "${_clang_modules_module_path}" DIRECTORY)
+
+ list(APPEND _clang_modules_base_dirs_list
+ "${_clang_module_dir}")
+ string(APPEND _clang_modules_files
+ " \"${_clang_modules_module_path}\"")
+ endforeach ()
+ list(REMOVE_DUPLICATES _clang_modules_base_dirs_list)
+ set(_clang_modules_base_dirs "")
+ foreach (_clang_modules_base_dir IN LISTS _clang_modules_base_dirs_list)
+ string(APPEND _clang_modules_base_dirs
+ " \"${_clang_modules_base_dir}\"")
+ endforeach ()
+
+ # If we have a standard library module, suppress warnings about reserved
+ # module names.
+ if (_clang_modules_is_stdlib)
+ string(APPEND _clang_libcxx_target
+ "target_compile_options(__cmake_cxx${std} PRIVATE -Wno-reserved-module-identifier)\n")
+ endif ()
+
+ # Set up include directories.
+ list(REMOVE_DUPLICATES _clang_modules_include_dirs_list)
+ set(_clang_modules_include_dirs "")
+ foreach (_clang_modules_include_dir IN LISTS _clang_modules_include_dirs_list)
+ string(APPEND _clang_modules_include_dirs
+ " \"${_clang_modules_include_dir}\"")
+ endforeach ()
+ string(APPEND _clang_libcxx_target
+ "target_include_directories(__cmake_cxx${std} PRIVATE ${_clang_modules_include_dirs})\n")
+
+ # Create the file set for the modules.
+ string(APPEND _clang_libcxx_target
+ "target_sources(__cmake_cxx${std}
+ PUBLIC
+ FILE_SET std TYPE CXX_MODULES
+ BASE_DIRS ${_clang_modules_base_dirs}
+ FILES ${_clang_modules_files})\n")
+
+ # Wrap the `__cmake_cxx${std}` target in a check.
+ string(PREPEND _clang_libcxx_target
+ "if (NOT TARGET \"__cmake_cxx${std}\")\n")
+ string(APPEND _clang_libcxx_target
+ "endif ()\n")
+ string(APPEND _clang_libcxx_target
+ "add_library(__CMAKE::CXX${std} ALIAS __cmake_cxx${std})\n")
+
+ set("${variable}" "${_clang_libcxx_target}" PARENT_SCOPE)
+endfunction ()
diff --git a/Modules/Compiler/Clang-OBJC.cmake b/Modules/Compiler/Clang-OBJC.cmake
index 7a83b77..c374d71 100644
--- a/Modules/Compiler/Clang-OBJC.cmake
+++ b/Modules/Compiler/Clang-OBJC.cmake
@@ -22,18 +22,24 @@ if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_OBJC11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_OBJC11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_OBJC11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 11)
endif()
if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 6.0)
set(CMAKE_OBJC17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_OBJC17_EXTENSION_COMPILE_OPTION "-std=gnu17")
set(CMAKE_OBJC17_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 17)
endif()
if(NOT CMAKE_OBJC_COMPILER_VERSION VERSION_LESS 9.0)
set(CMAKE_OBJC23_STANDARD_COMPILE_OPTION "-std=c2x")
set(CMAKE_OBJC23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
set(CMAKE_OBJC23_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_OBJC_STANDARD_LATEST 23)
endif()
__compiler_check_default_language_standard(OBJC 3.4 99 3.6 11)
diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 2452d5e..089b188 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -135,6 +135,7 @@ macro(__compiler_clang_cxx_standards lang)
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1)
set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+ set(CMAKE_${lang}_STANDARD_LATEST 98)
endif()
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.1)
@@ -142,19 +143,23 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 2.1)
set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++0x")
set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
endif()
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
endif()
set(_clang_version_std17 5.0)
@@ -165,17 +170,21 @@ macro(__compiler_clang_cxx_standards lang)
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.5)
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++1z")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
endif()
if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS "${_clang_version_std17}")
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
endif()
unset(_clang_version_std17)
@@ -190,9 +199,11 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26")
set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26")
+ set(CMAKE_${lang}_STANDARD_LATEST 26)
elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++2b")
set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ set(CMAKE_${lang}_STANDARD_LATEST 23)
endif()
unset(_clang_version_std23)
@@ -231,14 +242,18 @@ macro(__compiler_clang_cxx_standards lang)
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
+
if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std:c++latest")
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++20")
+ set(CMAKE_${lang}_STANDARD_LATEST 23)
elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
endif()
__compiler_check_default_language_standard(${lang} 3.9 14)
@@ -262,6 +277,14 @@ macro(__compiler_clang_cxx_standards lang)
# There is no meaningful default for this
set(CMAKE_${lang}_STANDARD_DEFAULT "")
+ if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.0)
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
+ elseif(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 18.0)
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
+ elseif(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 16.0)
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+ endif()
+
# There are no compiler modes so we only need to test features once.
# Override the default macro for this special case. Pretend that
# all language standards are available so that at least compilation
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index 9340948..51f8cc4 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -14,10 +14,12 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
set(CMAKE_C99_STANDARD_COMPILE_OPTION -h c99,conform)
set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 99)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5)
set(CMAKE_C11_STANDARD_COMPILE_OPTION -h std=c11,conform)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif ()
endif ()
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index 38c8b1e..9a40b98 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -11,15 +11,18 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION -h conform)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 98)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION -h std=c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION -h std=c++14)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif ()
endif ()
diff --git a/Modules/Compiler/CrayClang-C.cmake b/Modules/Compiler/CrayClang-C.cmake
index bf878fc..96e46be 100644
--- a/Modules/Compiler/CrayClang-C.cmake
+++ b/Modules/Compiler/CrayClang-C.cmake
@@ -27,4 +27,6 @@ set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17)
set(CMAKE_C23_STANDARD_COMPILE_OPTION -std=c2x)
set(CMAKE_C23_EXTENSION_COMPILE_OPTION -std=gnu2x)
+set(CMAKE_C_STANDARD_LATEST 23)
+
__compiler_check_default_language_standard(C 15.0.0 17)
diff --git a/Modules/Compiler/CrayClang-CXX.cmake b/Modules/Compiler/CrayClang-CXX.cmake
index de6a53c..a61edfa 100644
--- a/Modules/Compiler/CrayClang-CXX.cmake
+++ b/Modules/Compiler/CrayClang-CXX.cmake
@@ -32,4 +32,6 @@ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20)
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION -std=c++2b)
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION -std=gnu++2b)
+set(CMAKE_CXX_STANDARD_LATEST 23)
+
__compiler_check_default_language_standard(CXX 15.0.0 14)
diff --git a/Modules/Compiler/Fujitsu-C.cmake b/Modules/Compiler/Fujitsu-C.cmake
index dd31e43..0ffa82d 100644
--- a/Modules/Compiler/Fujitsu-C.cmake
+++ b/Modules/Compiler/Fujitsu-C.cmake
@@ -15,6 +15,8 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4)
set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=gnu11)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
__compiler_check_default_language_standard(C 4 11)
diff --git a/Modules/Compiler/Fujitsu-CXX.cmake b/Modules/Compiler/Fujitsu-CXX.cmake
index 0f42196..56f16c1 100644
--- a/Modules/Compiler/Fujitsu-CXX.cmake
+++ b/Modules/Compiler/Fujitsu-CXX.cmake
@@ -42,6 +42,8 @@ if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 4)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION -std=c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION -std=gnu++17)
+
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
__compiler_check_default_language_standard(CXX 4 14)
diff --git a/Modules/Compiler/GNU-C.cmake b/Modules/Compiler/GNU-C.cmake
index 03e8d2b..0ac4d8c 100644
--- a/Modules/Compiler/GNU-C.cmake
+++ b/Modules/Compiler/GNU-C.cmake
@@ -1,5 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(C)
+__compiler_gnu_c_standards(C)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
@@ -12,38 +13,4 @@ endif()
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5)
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
-elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
-endif()
-
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
- set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
-endif()
-
-if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
- set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
-elseif (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
-endif()
-
-if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
- set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
- set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
-endif()
-
-if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
- set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
- set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
-endif()
-
__compiler_check_default_language_standard(C 3.4 90 5.0 11 8.1 17)
diff --git a/Modules/Compiler/GNU-CXX.cmake b/Modules/Compiler/GNU-CXX.cmake
index 2e1b4ad..e98909b 100644
--- a/Modules/Compiler/GNU-CXX.cmake
+++ b/Modules/Compiler/GNU-CXX.cmake
@@ -1,5 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(CXX)
+__compiler_gnu_cxx_standards(CXX)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
@@ -22,55 +23,6 @@ else()
endif()
endif()
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
- set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
-elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4)
- # 4.3 supports 0x variants
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
- set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
-elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
- set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
- set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
- set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
-endif()
-
-if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
- set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
- set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
-elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
- set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
- set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
-endif()
-
-if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1)
- set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
- set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
- set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++23")
- set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
-elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
- set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
- set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
-endif()
-
__compiler_check_default_language_standard(CXX 3.4 98 6.0 14 11.1 17)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
diff --git a/Modules/Compiler/GNU-OBJC.cmake b/Modules/Compiler/GNU-OBJC.cmake
index 7eeed83..4a2cd85 100644
--- a/Modules/Compiler/GNU-OBJC.cmake
+++ b/Modules/Compiler/GNU-OBJC.cmake
@@ -1,5 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(OBJC)
+__compiler_gnu_c_standards(OBJC)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
diff --git a/Modules/Compiler/GNU-OBJCXX.cmake b/Modules/Compiler/GNU-OBJCXX.cmake
index 1047b5d..e3006f2 100644
--- a/Modules/Compiler/GNU-OBJCXX.cmake
+++ b/Modules/Compiler/GNU-OBJCXX.cmake
@@ -1,5 +1,6 @@
include(Compiler/GNU)
__compiler_gnu(OBJCXX)
+__compiler_gnu_cxx_standards(OBJCXX)
if((NOT DEFINED CMAKE_DEPENDS_USE_COMPILER OR CMAKE_DEPENDS_USE_COMPILER)
AND CMAKE_GENERATOR MATCHES "Makefiles|WMake"
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 138bb4b..3f705a9 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -151,7 +151,7 @@ macro(__compiler_gnu lang)
list(APPEND __lto_flags -flto)
endif()
- if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7 AND NOT APPLE)
# '-ffat-lto-objects' introduced since GCC 4.7:
# * https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Option-Summary.html (no)
# * https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/Option-Summary.html (yes)
@@ -207,3 +207,112 @@ macro(__compiler_gnu lang)
set(CMAKE_${lang}_COMPILE_OPTIONS_COLOR_DIAGNOSTICS_OFF "-fno-diagnostics-color")
endif()
endmacro()
+
+macro(__compiler_gnu_c_standards lang)
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.5)
+ set(CMAKE_${lang}90_STANDARD_COMPILE_OPTION "-std=c90")
+ set(CMAKE_${lang}90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+ set(CMAKE_${lang}_STANDARD_LATEST 90)
+ elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_${lang}90_STANDARD_COMPILE_OPTION "-std=c89")
+ set(CMAKE_${lang}90_EXTENSION_COMPILE_OPTION "-std=gnu89")
+ set(CMAKE_${lang}_STANDARD_LATEST 90)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_${lang}90_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_${lang}99_EXTENSION_COMPILE_OPTION "-std=gnu99")
+ set(CMAKE_${lang}99_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}_STANDARD_LATEST 99)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+ elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.6)
+ set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c1x")
+ set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu1x")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+ endif()
+
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
+ set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c17")
+ set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
+ endif()
+
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 9.1)
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c2x")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ set(CMAKE_${lang}_STANDARD_LATEST 23)
+ endif()
+endmacro()
+
+macro(__compiler_gnu_cxx_standards lang)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.4)
+ set(CMAKE_${lang}98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_${lang}98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+ set(CMAKE_${lang}_STANDARD_LATEST 98)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7)
+ set(CMAKE_${lang}98_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+ elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.4)
+ # 4.3 supports 0x variants
+ set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.8.1)
+ set(CMAKE_${lang}11_STANDARD__HAS_FULL_SUPPORT ON)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.9)
+ set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
+ elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.8)
+ set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 5.0)
+ set(CMAKE_${lang}14_STANDARD__HAS_FULL_SUPPORT ON)
+ endif()
+
+ if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0)
+ set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
+ elseif (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 5.1)
+ set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++1z")
+ set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
+ endif()
+
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 11.1)
+ set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+ set(CMAKE_${lang}23_STANDARD_COMPILE_OPTION "-std=c++23")
+ set(CMAKE_${lang}23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
+ set(CMAKE_${lang}_STANDARD_LATEST 23)
+ elseif(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
+ set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++2a")
+ set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
+ endif()
+
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
+ set(CMAKE_${lang}26_STANDARD_COMPILE_OPTION "-std=c++26")
+ set(CMAKE_${lang}26_EXTENSION_COMPILE_OPTION "-std=gnu++26")
+ set(CMAKE_${lang}_STANDARD_LATEST 26)
+ endif()
+endmacro()
diff --git a/Modules/Compiler/IBMClang-C.cmake b/Modules/Compiler/IBMClang-C.cmake
index b69b1b8..fde6a3b 100644
--- a/Modules/Compiler/IBMClang-C.cmake
+++ b/Modules/Compiler/IBMClang-C.cmake
@@ -23,8 +23,11 @@ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+set(CMAKE_C_STANDARD_LATEST 11)
+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ set(CMAKE_C_STANDARD_LATEST 17)
endif ()
__compiler_check_default_language_standard(C 17.1.0 17)
diff --git a/Modules/Compiler/IBMClang-CXX.cmake b/Modules/Compiler/IBMClang-CXX.cmake
index be9b525..ec97381 100644
--- a/Modules/Compiler/IBMClang-CXX.cmake
+++ b/Modules/Compiler/IBMClang-CXX.cmake
@@ -26,6 +26,8 @@ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+set(CMAKE_CXX_STANDARD_LATEST 14)
+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
@@ -33,6 +35,7 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1.0)
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b")
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 23)
endif()
__compiler_check_default_language_standard(CXX 17.1.0 17)
diff --git a/Modules/Compiler/Intel-C.cmake b/Modules/Compiler/Intel-C.cmake
index 9884b58..bfe5f07 100644
--- a/Modules/Compiler/Intel-C.cmake
+++ b/Modules/Compiler/Intel-C.cmake
@@ -19,12 +19,6 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
set(CMAKE_C_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11")
- set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
- endif()
-
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Qstd=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-Qstd=c89")
@@ -32,18 +26,20 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-Qstd=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-Qstd=c99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 99)
+ endif()
+
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 16.0.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd=c11")
+ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
else()
set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
- if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
- set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
- endif()
-
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89")
@@ -51,6 +47,14 @@ else()
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 99)
+ endif()
+
+ if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15.0.0)
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
endif()
diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake
index 7c9cca9..f9e3e7a 100644
--- a/Modules/Compiler/Intel-CXX.cmake
+++ b/Modules/Compiler/Intel-CXX.cmake
@@ -18,57 +18,70 @@ if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_CLANG_TIDY_DRIVER_MODE "cl")
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE_DRIVER_MODE "cl")
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
- set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20")
- set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20")
- endif()
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
- set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
- set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11")
+ else()
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++0x")
+ endif()
+
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-Qstd=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-Qstd=c++14")
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++11")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++11")
- elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-Qstd=c++0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-Qstd=c++0x")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-Qstd=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-Qstd=c++17")
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
- set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd=c++20")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
else()
set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0)
- set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
- set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
- endif()
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
+ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
+ set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
+ set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
- set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
- set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
+ else()
+ set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
+ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+ endif()
+
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0)
- set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
+ set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
endif()
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.2)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX_STANDARD_LATEST 14)
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
# Intel 15.0.2 accepts c++14 instead of c++1y, but not gnu++14
@@ -79,22 +92,20 @@ else()
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15.0)
- set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0)
+ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.0)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
- elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++0x")
- set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0)
+ set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
- if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12.1)
- set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
- set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
- set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.0.0.20190206)
+ set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
endif()
diff --git a/Modules/Compiler/IntelLLVM-C.cmake b/Modules/Compiler/IntelLLVM-C.cmake
index 3a81154..4da4dfb 100644
--- a/Modules/Compiler/IntelLLVM-C.cmake
+++ b/Modules/Compiler/IntelLLVM-C.cmake
@@ -42,24 +42,33 @@ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
- set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
- set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ set(CMAKE_C_STANDARD_LATEST 17)
+
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1.0)
+ set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
+ set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+ set(CMAKE_C_STANDARD_LATEST 23)
+ endif()
else()
- # clang-cl doesn't have any of these
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C90_STANDARD_COMPILE_OPTION "-Qstd:c90")
+ set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-Qstd:c90")
- set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-Qstd:c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-Qstd:c99")
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C11_STANDARD_COMPILE_OPTION "-Qstd:c11")
+ set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-Qstd:c11")
- set(CMAKE_C17_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C17_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C17_STANDARD_COMPILE_OPTION "-Qstd:c17")
+ set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-Qstd:c17")
- set(CMAKE_C23_STANDARD_COMPILE_OPTION "")
- set(CMAKE_C23_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C_STANDARD_LATEST 17)
+
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2022.1.0)
+ set(CMAKE_C23_STANDARD_COMPILE_OPTION "-Qstd:c2x")
+ set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-Qstd:c2x")
+ set(CMAKE_C_STANDARD_LATEST 23)
+ endif()
endif()
__compiler_check_default_language_standard(C 2020 17)
diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake
index 45b723f..989a1d4 100644
--- a/Modules/Compiler/IntelLLVM-CXX.cmake
+++ b/Modules/Compiler/IntelLLVM-CXX.cmake
@@ -47,8 +47,13 @@ if(NOT "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
- set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b")
- set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
+ set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++2b")
+ set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 23)
+ endif()
else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
@@ -65,8 +70,13 @@ else()
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-Qstd:c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-Qstd:c++20")
- set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-Qstd:c++2b")
- set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-Qstd:c++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
+
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
+ set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-Qstd:c++2b")
+ set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-Qstd:c++2b")
+ set(CMAKE_CXX_STANDARD_LATEST 23)
+ endif()
endif()
__compiler_check_default_language_standard(CXX 2020 14)
diff --git a/Modules/Compiler/LCC-C.cmake b/Modules/Compiler/LCC-C.cmake
index 52c3bf3..01e99d3 100644
--- a/Modules/Compiler/LCC-C.cmake
+++ b/Modules/Compiler/LCC-C.cmake
@@ -22,15 +22,19 @@ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C_STANDARD_LATEST 99)
+
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+ set(CMAKE_C_STANDARD_LATEST 17)
endif()
__compiler_check_default_language_standard(C 1.17 89 1.23 99 1.26 17)
diff --git a/Modules/Compiler/LCC-CXX.cmake b/Modules/Compiler/LCC-CXX.cmake
index 385947a..22f2cc3 100644
--- a/Modules/Compiler/LCC-CXX.cmake
+++ b/Modules/Compiler/LCC-CXX.cmake
@@ -18,26 +18,32 @@ set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98")
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX_STANDARD_LATEST 98)
+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.20)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.21)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.24)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 1.26)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
__compiler_check_default_language_standard(CXX 1.19 98 1.20 11 1.21 14 1.24 17 1.26 20)
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
index 6bf6b4e..d7fbf9f 100644
--- a/Modules/Compiler/MSVC-C.cmake
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -14,12 +14,15 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.27)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std:c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std:c11")
+ set(CMAKE_C_STANDARD_LATEST 11)
+
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std:c17")
set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std:c17")
+ set(CMAKE_C_STANDARD_LATEST 17)
else()
# Special case for 19.27 (VS 16.7): C11 has partial support.
macro(cmake_record_c_compile_features)
@@ -41,6 +44,7 @@ else()
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_C_STANDARD_LATEST 11)
# There is no meaningful default for this
set(CMAKE_C_STANDARD_DEFAULT "")
diff --git a/Modules/Compiler/MSVC-CXX-CXXImportStd.cmake b/Modules/Compiler/MSVC-CXX-CXXImportStd.cmake
new file mode 100644
index 0000000..f253f9e
--- /dev/null
+++ b/Modules/Compiler/MSVC-CXX-CXXImportStd.cmake
@@ -0,0 +1,103 @@
+function (_cmake_cxx_import_std std variable)
+ find_file(_msvc_modules_json_file
+ NAME modules.json
+ HINTS
+ "$ENV{VCToolsInstallDir}/modules"
+ PATHS
+ "$ENV{INCLUDE}"
+ "${CMAKE_CXX_COMPILER}/../../.."
+ "${CMAKE_CXX_COMPILER}/../.." # msvc-wine layout
+ PATH_SUFFIXES
+ ../modules
+ NO_CACHE)
+ # Without this file, we do not have modules installed.
+ if (NOT EXISTS "${_msvc_modules_json_file}")
+ return ()
+ endif ()
+
+ file(READ "${_msvc_modules_json_file}" _msvc_modules_json)
+ string(JSON _msvc_json_version GET "${_msvc_modules_json}" "version")
+ string(JSON _msvc_json_revision GET "${_msvc_modules_json}" "revision")
+ # Require version 1.
+ if (NOT _msvc_json_version EQUAL "1")
+ return ()
+ endif ()
+
+ string(JSON _msvc_json_library GET "${_msvc_modules_json}" "library")
+ # Bail if we don't understand the library.
+ if (NOT _msvc_json_library STREQUAL "microsoft/STL")
+ return ()
+ endif ()
+
+ string(JSON _msvc_json_nmodules LENGTH "${_msvc_modules_json}" "module-sources")
+ # Don't declare the target without any modules.
+ if (NOT _msvc_json_nmodules)
+ return ()
+ endif ()
+
+ # Declare the target.
+ set(_msvc_std_target "")
+ string(APPEND _msvc_std_target
+ "add_library(__cmake_cxx${std} STATIC)\n")
+ string(APPEND _msvc_std_target
+ "target_sources(__cmake_cxx${std} INTERFACE \"$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,STATIC_LIBRARY>:$<TARGET_OBJECTS:__cmake_cxx${std}>>\")\n")
+ string(APPEND _msvc_std_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY EXCLUDE_FROM_ALL 1)\n")
+ string(APPEND _msvc_std_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY CXX_SCAN_FOR_MODULES 1)\n")
+ string(APPEND _msvc_std_target
+ "set_property(TARGET __cmake_cxx${std} PROPERTY CXX_MODULE_STD 0)\n")
+ string(APPEND _msvc_std_target
+ "target_compile_features(__cmake_cxx${std} PUBLIC cxx_std_${std})\n")
+
+ set(_msvc_modules_module_paths "")
+ get_filename_component(_msvc_modules_dir "${_msvc_modules_json_file}" DIRECTORY)
+
+ # Add module sources.
+ math(EXPR _msvc_modules_json_nmodules_range "${_msvc_json_nmodules} - 1")
+ foreach (_msvc_modules_json_modules_idx RANGE 0 "${_msvc_modules_json_nmodules_range}")
+ string(JSON _msvc_modules_json_module_source GET "${_msvc_modules_json}" "module-sources" "${_msvc_modules_json_modules_idx}")
+
+ if (NOT IS_ABSOLUTE "${_msvc_modules_json_module_source}")
+ string(PREPEND _msvc_modules_json_module_source "${_msvc_modules_dir}/")
+ endif ()
+ list(APPEND _msvc_modules_module_paths
+ "${_msvc_modules_json_module_source}")
+ endforeach ()
+
+ # Split the paths into basedirs and module paths.
+ set(_msvc_modules_base_dirs_list "")
+ set(_msvc_modules_files "")
+ foreach (_msvc_modules_module_path IN LISTS _msvc_modules_module_paths)
+ get_filename_component(_msvc_module_dir "${_msvc_modules_module_path}" DIRECTORY)
+
+ list(APPEND _msvc_modules_base_dirs_list
+ "${_msvc_module_dir}")
+ string(APPEND _msvc_modules_files
+ " \"${_msvc_modules_module_path}\"")
+ endforeach ()
+ list(REMOVE_DUPLICATES _msvc_modules_base_dirs_list)
+ set(_msvc_modules_base_dirs "")
+ foreach (_msvc_modules_base_dir IN LISTS _msvc_modules_base_dirs_list)
+ string(APPEND _msvc_modules_base_dirs
+ " \"${_msvc_modules_base_dir}\"")
+ endforeach ()
+
+ # Create the file set for the modules.
+ string(APPEND _msvc_std_target
+ "target_sources(__cmake_cxx${std}
+ PUBLIC
+ FILE_SET std TYPE CXX_MODULES
+ BASE_DIRS ${_msvc_modules_base_dirs}
+ FILES ${_msvc_modules_files})\n")
+
+ # Wrap the `__cmake_cxx${std}` target in a check.
+ string(PREPEND _msvc_std_target
+ "if (NOT TARGET \"__cmake_cxx${std}\")\n")
+ string(APPEND _msvc_std_target
+ "endif ()\n")
+ string(APPEND _msvc_std_target
+ "add_library(__CMAKE::CXX${std} ALIAS __cmake_cxx${std})\n")
+
+ set("${variable}" "${_msvc_std_target}" PARENT_SCOPE)
+endfunction ()
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index 79cd2e0..2243a14 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -30,14 +30,18 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++latest")
endif()
+ set(CMAKE_CXX_STANDARD_LATEST 17)
+
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30129)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++20")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++20")
set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_CXX_STANDARD_LATEST 23)
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.12.25835)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std:c++latest")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std:c++latest")
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
__compiler_check_default_language_standard(CXX 19.0 14)
@@ -57,6 +61,14 @@ elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.0)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0)
+ set(CMAKE_CXX_STANDARD_LATEST 17)
+ elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
+ else()
+ set(CMAKE_CXX_STANDARD_LATEST 11)
+ endif()
+
# There is no meaningful default for this
set(CMAKE_CXX_STANDARD_DEFAULT "")
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
index b946cfd..a6636c4 100644
--- a/Modules/Compiler/NAG-Fortran.cmake
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -28,6 +28,13 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
endif()
endif()
+# Initial configuration flags.
+string(APPEND CMAKE_Fortran_FLAGS_INIT " ")
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -g")
+string(APPEND CMAKE_Fortran_FLAGS_MINSIZEREL_INIT " -O2 -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELEASE_INIT " -O4 -DNDEBUG")
+string(APPEND CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
+
set(CMAKE_Fortran_SUBMODULE_SEP ".")
set(CMAKE_Fortran_SUBMODULE_EXT ".sub")
set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
@@ -39,3 +46,6 @@ set(CMAKE_Fortran_COMPILE_OPTIONS_PIC "-PIC")
set(CMAKE_Fortran_COMPILE_OPTIONS_PIE "-PIC")
set(CMAKE_Fortran_RESPONSE_FILE_LINK_FLAG "-Wl,@")
set(CMAKE_Fortran_COMPILE_OPTIONS_PREPROCESS_ON "-fpp")
+
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -fpp <DEFINES> <INCLUDES> <FLAGS> -F <SOURCE> -o <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/NVHPC-C.cmake b/Modules/Compiler/NVHPC-C.cmake
index 9295abd..3838ebd 100644
--- a/Modules/Compiler/NVHPC-C.cmake
+++ b/Modules/Compiler/NVHPC-C.cmake
@@ -7,6 +7,7 @@ set(CMAKE_C_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c)
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.11)
set(CMAKE_C17_STANDARD_COMPILE_OPTION -std=c17)
set(CMAKE_C17_EXTENSION_COMPILE_OPTION -std=gnu17)
+ set(CMAKE_C_STANDARD_LATEST 17)
endif()
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
diff --git a/Modules/Compiler/NVHPC-CXX.cmake b/Modules/Compiler/NVHPC-CXX.cmake
index 59ba7bf..0d804f4 100644
--- a/Modules/Compiler/NVHPC-CXX.cmake
+++ b/Modules/Compiler/NVHPC-CXX.cmake
@@ -7,6 +7,7 @@ set(CMAKE_CXX_COMPILE_OPTIONS_EXPLICIT_LANGUAGE -x c++)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.11)
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION -std=c++20)
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION -std=gnu++20)
+ set(CMAKE_CXX_STANDARD_LATEST 20)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 21.07)
diff --git a/Modules/Compiler/NVIDIA.cmake b/Modules/Compiler/NVIDIA.cmake
index a126c57..21e71cc 100644
--- a/Modules/Compiler/NVIDIA.cmake
+++ b/Modules/Compiler/NVIDIA.cmake
@@ -17,6 +17,8 @@ macro(__compiler_nvidia_cxx_standards lang)
set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "")
set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 9.0)
if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.10.25017)
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14")
@@ -25,12 +27,15 @@ macro(__compiler_nvidia_cxx_standards lang)
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "")
set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "")
endif()
+
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
endif()
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505)
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
endif()
endif()
@@ -38,6 +43,7 @@ macro(__compiler_nvidia_cxx_standards lang)
if(CMAKE_${lang}_SIMULATE_VERSION VERSION_GREATER_EQUAL 19.11.25505)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
endif()
endif()
else()
@@ -47,21 +53,27 @@ macro(__compiler_nvidia_cxx_standards lang)
set(CMAKE_${lang}11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_${lang}11_EXTENSION_COMPILE_OPTION "-std=c++11")
+ set(CMAKE_${lang}_STANDARD_LATEST 11)
+
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 9.0)
set(CMAKE_${lang}03_STANDARD_COMPILE_OPTION "-std=c++03")
set(CMAKE_${lang}03_EXTENSION_COMPILE_OPTION "-std=c++03")
set(CMAKE_${lang}14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_${lang}14_EXTENSION_COMPILE_OPTION "-std=c++14")
+
+ set(CMAKE_${lang}_STANDARD_LATEST 14)
endif()
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0)
set(CMAKE_${lang}17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_${lang}17_EXTENSION_COMPILE_OPTION "-std=c++17")
+ set(CMAKE_${lang}_STANDARD_LATEST 17)
endif()
if (NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 12.0)
set(CMAKE_${lang}20_STANDARD_COMPILE_OPTION "-std=c++20")
set(CMAKE_${lang}20_EXTENSION_COMPILE_OPTION "-std=c++20")
+ set(CMAKE_${lang}_STANDARD_LATEST 20)
endif()
endif()
diff --git a/Modules/Compiler/OrangeC-C.cmake b/Modules/Compiler/OrangeC-C.cmake
index 15a6476..f0dfcd1 100644
--- a/Modules/Compiler/OrangeC-C.cmake
+++ b/Modules/Compiler/OrangeC-C.cmake
@@ -15,6 +15,8 @@ set(CMAKE_C11_STANDARD_COMPILE_OPTION -std=c11)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -std=c11)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_C_STANDARD_LATEST 11)
+
__compiler_orangec(C)
#- 6.38 is the earliest version which version info is available in the preprocessor
__compiler_check_default_language_standard(C 6.38 11)
diff --git a/Modules/Compiler/OrangeC-CXX.cmake b/Modules/Compiler/OrangeC-CXX.cmake
index 3f9d59c..575c09d 100644
--- a/Modules/Compiler/OrangeC-CXX.cmake
+++ b/Modules/Compiler/OrangeC-CXX.cmake
@@ -20,6 +20,8 @@ set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+set(CMAKE_CXX_STANDARD_LATEST 14)
+
__compiler_orangec(CXX)
#- 6.38 is the earliest version which version info is available in the preprocessor
__compiler_check_default_language_standard(CXX 6.38 14)
diff --git a/Modules/Compiler/PGI-C.cmake b/Modules/Compiler/PGI-C.cmake
index c39dbe5..798fc84 100644
--- a/Modules/Compiler/PGI-C.cmake
+++ b/Modules/Compiler/PGI-C.cmake
@@ -10,10 +10,13 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
set(CMAKE_C99_STANDARD_COMPILE_OPTION -c99)
set(CMAKE_C99_EXTENSION_COMPILE_OPTION -c99)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C_STANDARD_LATEST 99)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 15.3)
set(CMAKE_C11_STANDARD_COMPILE_OPTION -c11)
set(CMAKE_C11_EXTENSION_COMPILE_OPTION -c11)
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif ()
endif ()
diff --git a/Modules/Compiler/PGI-CXX.cmake b/Modules/Compiler/PGI-CXX.cmake
index 1279c19..972e43a 100644
--- a/Modules/Compiler/PGI-CXX.cmake
+++ b/Modules/Compiler/PGI-CXX.cmake
@@ -7,19 +7,23 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.10)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --gnu_extensions)
set(CMAKE_CXX98_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 98)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.10)
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION --c++03)
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION --c++03 --gnu_extensions)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION --c++11 --gnu_extensions)
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.7)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14)
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION --c++14 --gnu_extensions)
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.1)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17)
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION --c++17 --gnu_extensions)
+ set(CMAKE_CXX_STANDARD_LATEST 17)
endif()
endif()
endif()
diff --git a/Modules/Compiler/SunPro-C.cmake b/Modules/Compiler/SunPro-C.cmake
index b06719d..7b4478c 100644
--- a/Modules/Compiler/SunPro-C.cmake
+++ b/Modules/Compiler/SunPro-C.cmake
@@ -52,11 +52,15 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.13)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C_STANDARD_LATEST 11)
elseif (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.11)
set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-xc99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-xc99")
+
+ set(CMAKE_C_STANDARD_LATEST 99)
endif()
__compiler_check_default_language_standard(C 5.11 90 5.14 11)
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index f835f2d..1db6aa7 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -54,14 +54,18 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
+
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.14)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++14")
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-library=stlport4")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-library=stlport4")
set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1)
+ set(CMAKE_CXX_STANDARD_LATEST 98)
endif()
__compiler_check_default_language_standard(CXX 1 98)
diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake
index bd88989..7f3b67c 100644
--- a/Modules/Compiler/TI-C.cmake
+++ b/Modules/Compiler/TI-C.cmake
@@ -34,18 +34,23 @@ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C99_VERSION_$
set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99" "--strict_ansi")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99" "--relaxed_ansi")
+ set(CMAKE_C_STANDARD_LATEST 99)
+
if(DEFINED __COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID} AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_C11_VERSION_${CMAKE_C_COMPILER_ARCHITECTURE_ID}}")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "--c11" "--strict_ansi")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--c11" "--relaxed_ansi")
+ set(CMAKE_C_STANDARD_LATEST 11)
+
endif()
else()
set(CMAKE_C90_STANDARD_COMPILE_OPTION "--strict_ansi")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+ set(CMAKE_C_STANDARD_LATEST 90)
endif()
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index 4b6efcd..c904239 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -39,16 +39,19 @@ if(DEFINED __COMPILER_TI_CXX14_VERSION AND
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++14" "--strict_ansi")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++14" "--relaxed_ansi")
+ set(CMAKE_CXX_STANDARD_LATEST 14)
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "${__COMPILER_TI_CXX03_VERSION}")
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--c++03" "--strict_ansi")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--c++03" "--relaxed_ansi")
+ set(CMAKE_CXX_STANDARD_LATEST 98)
else()
set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "--strict_ansi")
set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "--relaxed_ansi")
+ set(CMAKE_CXX_STANDARD_LATEST 98)
endif()
diff --git a/Modules/Compiler/TIClang-C.cmake b/Modules/Compiler/TIClang-C.cmake
index 2721fef..b6ce3dc 100644
--- a/Modules/Compiler/TIClang-C.cmake
+++ b/Modules/Compiler/TIClang-C.cmake
@@ -21,3 +21,13 @@ set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+
+set(CMAKE_C_STANDARD_LATEST 11)
+
+# Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-C.cmake" script above may set several other compile option
+# variables which do not necessarily apply here. So, we unset those variables accordingly.
+unset(CMAKE_C17_STANDARD_COMPILE_OPTION)
+unset(CMAKE_C17_EXTENSION_COMPILE_OPTION)
+
+unset(CMAKE_C23_STANDARD_COMPILE_OPTION)
+unset(CMAKE_C23_EXTENSION_COMPILE_OPTION)
diff --git a/Modules/Compiler/TIClang-CXX.cmake b/Modules/Compiler/TIClang-CXX.cmake
index 860bb42..e1367df 100644
--- a/Modules/Compiler/TIClang-CXX.cmake
+++ b/Modules/Compiler/TIClang-CXX.cmake
@@ -23,3 +23,16 @@ set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
+
+set(CMAKE_CXX_STANDARD_LATEST 17)
+
+# Including the "${CMAKE_ROOT}/Modules/Compiler/Clang-CXX.cmake" script above may set several other compile option
+# variables which do not necessarily apply here. So, we unset those variables accordingly.
+unset(CMAKE_CXX20_STANDARD_COMPILE_OPTION)
+unset(CMAKE_CXX20_EXTENSION_COMPILE_OPTION)
+
+unset(CMAKE_CXX23_STANDARD_COMPILE_OPTION)
+unset(CMAKE_CXX23_EXTENSION_COMPILE_OPTION)
+
+unset(CMAKE_CXX26_STANDARD_COMPILE_OPTION)
+unset(CMAKE_CXX26_EXTENSION_COMPILE_OPTION)
diff --git a/Modules/Compiler/Tasking-C.cmake b/Modules/Compiler/Tasking-C.cmake
index 0ea3cd2..938f46e 100644
--- a/Modules/Compiler/Tasking-C.cmake
+++ b/Modules/Compiler/Tasking-C.cmake
@@ -10,6 +10,8 @@ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--iso=99" " ")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "--iso=11" "--strict")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--iso=11" " ")
+set(CMAKE_C_STANDARD_LATEST 11)
+
if(CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "TriCore")
if(CMAKE_TASKING_TOOLSET STREQUAL "SmartCode")
__compiler_check_default_language_standard(C 10.1 11)
diff --git a/Modules/Compiler/Tasking-CXX.cmake b/Modules/Compiler/Tasking-CXX.cmake
index 635104c..20e007f 100644
--- a/Modules/Compiler/Tasking-CXX.cmake
+++ b/Modules/Compiler/Tasking-CXX.cmake
@@ -12,6 +12,8 @@ set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "--c++=11" " ")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "--c++=14" "--strict")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "--c++=14" " ")
+set(CMAKE_CXX_STANDARD_LATEST 14)
+
if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "TriCore")
if(CMAKE_TASKING_TOOLSET STREQUAL "SmartCode")
__compiler_check_default_language_standard(CXX 10.1 14)
diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake
index 2077bda..d14ac85 100644
--- a/Modules/Compiler/XL-C.cmake
+++ b/Modules/Compiler/XL-C.cmake
@@ -13,10 +13,13 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99")
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_C_STANDARD_LATEST 99)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_C_STANDARD_LATEST 11)
endif ()
endif()
diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake
index 41e3e11..57bd5a9 100644
--- a/Modules/Compiler/XL-CXX.cmake
+++ b/Modules/Compiler/XL-CXX.cmake
@@ -24,10 +24,13 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1)
# compiler mode for the corresponding standard.
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 11)
+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0 AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-qlanglvl=extended1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif()
endif ()
diff --git a/Modules/Compiler/XLClang-C.cmake b/Modules/Compiler/XLClang-C.cmake
index 1668a4d..7ca76e4 100644
--- a/Modules/Compiler/XLClang-C.cmake
+++ b/Modules/Compiler/XLClang-C.cmake
@@ -12,11 +12,14 @@ if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x")
+
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
endif ()
+
+ set(CMAKE_C_STANDARD_LATEST 11)
endif()
__compiler_check_default_language_standard(C 13.1.1 99)
diff --git a/Modules/Compiler/XLClang-CXX.cmake b/Modules/Compiler/XLClang-CXX.cmake
index 02638c7..b324987 100644
--- a/Modules/Compiler/XLClang-CXX.cmake
+++ b/Modules/Compiler/XLClang-CXX.cmake
@@ -10,12 +10,17 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x")
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_CXX_STANDARD_LATEST 11)
+
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2)
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
+
+ set(CMAKE_CXX_STANDARD_LATEST 14)
endif ()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16.1.0)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index afa36f7..67d9f8f 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -95,6 +95,9 @@ TimeOut: @DART_TESTING_TIMEOUT@
# so would cause the system load to exceed this value.
TestLoad: @CTEST_TEST_LOAD@
+TLSVerify: @CTEST_TLS_VERIFY@
+TLSVersion: @CTEST_TLS_VERSION@
+
UseLaunchers: @CTEST_USE_LAUNCHERS@
CurlOptions: @CTEST_CURL_OPTIONS@
# warning, if you add new options here that have to do with submit,
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 965b25c..3323b18 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -225,22 +225,45 @@ URL
Provides an arbitrary list of HTTP headers for the download operation.
This can be useful for accessing content in systems like AWS, etc.
+``TLS_VERSION <min>``
+ .. versionadded:: 3.30
+
+ Specify minimum TLS version for ``https://`` URLs. If this option is
+ not provided, the value of the :variable:`CMAKE_TLS_VERSION` variable
+ or the :envvar:`CMAKE_TLS_VERSION` environment variable will be used
+ instead (see :command:`file(DOWNLOAD)`).
+
+ This option also applies to ``git clone`` invocations, although the
+ default behavior is different. If none of the ``TLS_VERSION`` option,
+ :variable:`CMAKE_TLS_VERSION` variable, or :envvar:`CMAKE_TLS_VERSION`
+ environment variable is specified, the behavior will be determined by
+ git's default or a ``http.sslVersion`` git config option the user may
+ have set at a global level.
+
``TLS_VERIFY <bool>``
Specifies whether certificate verification should be performed for
- https URLs. If this option is not provided, the default behavior is
- determined by the :variable:`CMAKE_TLS_VERIFY` variable (see
- :command:`file(DOWNLOAD)`). If that is also not set, certificate
- verification will not be performed. In situations where ``URL_HASH``
- cannot be provided, this option can be an alternative verification
- measure.
+ ``https://`` URLs. If this option is not provided, the value of the
+ :variable:`CMAKE_TLS_VERIFY` variable or the :envvar:`CMAKE_TLS_VERIFY`
+ environment variable will be used instead (see :command:`file(DOWNLOAD)`).
+ If neither of those is set, certificate verification will not be performed.
+ In situations where ``URL_HASH`` cannot be provided, this option can
+ be an alternative verification measure.
+
+ This option also applies to ``git clone`` invocations, although the
+ default behavior is different. If none of the ``TLS_VERIFY`` option,
+ :variable:`CMAKE_TLS_VERIFY` variable, or :envvar:`CMAKE_TLS_VERIFY`
+ environment variable is specified, the behavior will be determined by
+ git's default (true) or a ``http.sslVerify`` git config option the
+ user may have set at a global level.
.. versionchanged:: 3.6
- This option also applies to ``git clone`` invocations, although the
- default behavior is different. If ``TLS_VERIFY`` is not given and
- :variable:`CMAKE_TLS_VERIFY` is not set, the behavior will be
- determined by git's defaults. Normally, the ``sslVerify`` git
- config setting defaults to true, but the user may have overridden
- this at a global level.
+
+ Previously this option did not apply to ``git clone`` invocations.
+
+ .. versionchanged:: 3.30
+
+ Previously the :envvar:`CMAKE_TLS_VERIFY` environment variable
+ was not checked.
``TLS_CAINFO <file>``
Specify a custom certificate authority file to use if ``TLS_VERIFY``
@@ -1357,6 +1380,63 @@ define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED)
define_property(DIRECTORY PROPERTY "EP_INDEPENDENT_STEP_TARGETS" INHERITED)
define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" INHERITED)
+function(_ep_get_tls_version name tls_version_var)
+ set(tls_version_regex "^1\\.[0-3]$")
+ get_property(tls_version TARGET ${name} PROPERTY _EP_TLS_VERSION)
+ if(NOT "x${tls_version}" STREQUAL "x")
+ if(NOT tls_version MATCHES "${tls_version_regex}")
+ message(FATAL_ERROR "TLS_VERSION '${tls_version}' not known")
+ endif()
+ elseif(NOT "x${CMAKE_TLS_VERSION}" STREQUAL "x")
+ set(tls_version "${CMAKE_TLS_VERSION}")
+ if(NOT tls_version MATCHES "${tls_version_regex}")
+ message(FATAL_ERROR "CMAKE_TLS_VERSION '${tls_version}' not known")
+ endif()
+ elseif(NOT "x$ENV{CMAKE_TLS_VERSION}" STREQUAL "x")
+ set(tls_version "$ENV{CMAKE_TLS_VERSION}")
+ if(NOT tls_version MATCHES "${tls_version_regex}")
+ message(FATAL_ERROR "ENV{CMAKE_TLS_VERSION} '${tls_version}' not known")
+ endif()
+ endif()
+ set("${tls_version_var}" "${tls_version}" PARENT_SCOPE)
+endfunction()
+
+function(_ep_get_tls_verify name tls_verify_var)
+ get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
+ if("x${tls_verify}" STREQUAL "x")
+ if(NOT "x${CMAKE_TLS_VERIFY}" STREQUAL "x")
+ set(tls_verify "${CMAKE_TLS_VERIFY}")
+ elseif(NOT "x$ENV{CMAKE_TLS_VERIFY}" STREQUAL "x")
+ set(tls_verify "$ENV{CMAKE_TLS_VERIFY}")
+ endif()
+ endif()
+ set("${tls_verify_var}" "${tls_verify}" PARENT_SCOPE)
+endfunction()
+
+function(_ep_get_tls_cainfo name tls_cainfo_var)
+ get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
+ if("x${tls_cainfo}" STREQUAL "x" AND DEFINED CMAKE_TLS_CAINFO)
+ set(tls_cainfo "${CMAKE_TLS_CAINFO}")
+ endif()
+ set("${tls_cainfo_var}" "${tls_cainfo}" PARENT_SCOPE)
+endfunction()
+
+function(_ep_get_netrc name netrc_var)
+ get_property(netrc TARGET ${name} PROPERTY _EP_NETRC)
+ if("x${netrc}" STREQUAL "x" AND DEFINED CMAKE_NETRC)
+ set(netrc "${CMAKE_NETRC}")
+ endif()
+ set("${netrc_var}" "${netrc}" PARENT_SCOPE)
+endfunction()
+
+function(_ep_get_netrc_file name netrc_file_var)
+ get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE)
+ if("x${netrc_file}" STREQUAL "x" AND DEFINED CMAKE_NETRC_FILE)
+ set(netrc_file "${CMAKE_NETRC_FILE}")
+ endif()
+ set("${netrc_file_var}" "${netrc_file}" PARENT_SCOPE)
+endfunction()
+
function(_ep_write_gitclone_script
script_filename
source_dir
@@ -1374,6 +1454,7 @@ function(_ep_write_gitclone_script
work_dir
gitclone_infofile
gitclone_stampfile
+ tls_version
tls_verify
)
@@ -1390,8 +1471,6 @@ function(_ep_write_gitclone_script
message(FATAL_ERROR "Tag for git checkout should not be empty.")
endif()
- set(git_submodules_config_options "")
-
if(GIT_VERSION_STRING VERSION_LESS 2.20 OR
2.21 VERSION_LESS_EQUAL GIT_VERSION_STRING)
set(git_clone_options "--no-checkout")
@@ -1414,21 +1493,27 @@ function(_ep_write_gitclone_script
if(NOT ${git_remote_name} STREQUAL "origin")
list(APPEND git_clone_options --origin \"${git_remote_name}\")
endif()
+
+ # The clone config option is sticky, it will apply to all subsequent git
+ # update operations. The submodules config option is not sticky, because
+ # git doesn't provide any way to do that. Thus, we will have to pass the
+ # same config option in the update step too for submodules, but not for
+ # the main git repo.
+ set(git_submodules_config_options "")
+ if(NOT "x${tls_version}" STREQUAL "x")
+ list(APPEND git_clone_options -c http.sslVersion=tlsv${tls_version})
+ list(APPEND git_submodules_config_options -c http.sslVersion=tlsv${tls_version})
+ endif()
if(NOT "x${tls_verify}" STREQUAL "x")
- # The clone config option is sticky, it will apply to all subsequent git
- # update operations. The submodules config option is not sticky, because
- # git doesn't provide any way to do that. Thus, we will have to pass the
- # same config option in the update step too for submodules, but not for
- # the main git repo.
if(tls_verify)
# Default git behavior is "true", but the user might have changed the
# global default to "false". Since TLS_VERIFY was given, ensure we honor
# the specified setting regardless of what the global default might be.
list(APPEND git_clone_options -c http.sslVerify=true)
- set(git_submodules_config_options -c http.sslVerify=true)
+ list(APPEND git_submodules_config_options -c http.sslVerify=true)
else()
list(APPEND git_clone_options -c http.sslVerify=false)
- set(git_submodules_config_options -c http.sslVerify=false)
+ list(APPEND git_submodules_config_options -c http.sslVerify=false)
endif()
endif()
@@ -1476,6 +1561,7 @@ function(_ep_write_gitupdate_script
git_repository
work_dir
git_update_strategy
+ tls_version
tls_verify
)
@@ -1491,19 +1577,22 @@ function(_ep_write_gitupdate_script
list(APPEND git_stash_save_options --all)
endif()
+ # The submodules config option is not sticky, git doesn't provide any way
+ # to do that. We have to pass this config option for the update step too.
+ # We don't need to set it for the non-submodule update because it gets
+ # recorded as part of the clone operation in a sticky manner.
set(git_submodules_config_options "")
+ if(NOT "x${tls_version}" STREQUAL "x")
+ list(APPEND git_submodules_config_options -c http.sslVersion=tlsv${tls_version})
+ endif()
if(NOT "x${tls_verify}" STREQUAL "x")
- # The submodules config option is not sticky, git doesn't provide any way
- # to do that. We have to pass this config option for the update step too.
- # We don't need to set it for the non-submodule update because it gets
- # recorded as part of the clone operation in a sticky manner.
if(tls_verify)
# Default git behavior is "true", but the user might have changed the
# global default to "false". Since TLS_VERIFY was given, ensure we honor
# the specified setting regardless of what the global default might be.
- set(git_submodules_config_options -c http.sslVerify=true)
+ list(APPEND git_submodules_config_options -c http.sslVerify=true)
else()
- set(git_submodules_config_options -c http.sslVerify=false)
+ list(APPEND git_submodules_config_options -c http.sslVerify=false)
endif()
endif()
@@ -1522,6 +1611,7 @@ function(_ep_write_downloadfile_script
inactivity_timeout
no_progress
hash
+ tls_version
tls_verify
tls_cainfo
userpwd
@@ -1574,46 +1664,28 @@ function(_ep_write_downloadfile_script
set(EXPECT_VALUE "")
endif()
- set(TLS_VERIFY_CODE "")
- set(TLS_CAINFO_CODE "")
- set(NETRC_CODE "")
- set(NETRC_FILE_CODE "")
-
- # check for curl globals in the project
- if(DEFINED CMAKE_TLS_VERIFY)
- set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
- endif()
- if(DEFINED CMAKE_TLS_CAINFO)
- set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")")
- endif()
- if(DEFINED CMAKE_NETRC)
- set(NETRC_CODE "set(CMAKE_NETRC \"${CMAKE_NETRC}\")")
- endif()
- if(DEFINED CMAKE_NETRC_FILE)
- set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${CMAKE_NETRC_FILE}\")")
+ set(TLS_VERSION_CODE "")
+ if(NOT "x${tls_version}" STREQUAL "x")
+ set(TLS_VERSION_CODE "set(CMAKE_TLS_VERSION \"${tls_version}\")")
endif()
- # now check for curl locals so that the local values
- # will override the globals
-
- # check for tls_verify argument
- string(LENGTH "${tls_verify}" tls_verify_len)
- if(tls_verify_len GREATER 0)
- set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY ${tls_verify})")
+ set(TLS_VERIFY_CODE "")
+ if(NOT "x${tls_verify}" STREQUAL "x")
+ set(TLS_VERIFY_CODE "set(CMAKE_TLS_VERIFY \"${tls_verify}\")")
endif()
- # check for tls_cainfo argument
- string(LENGTH "${tls_cainfo}" tls_cainfo_len)
- if(tls_cainfo_len GREATER 0)
+
+ set(TLS_CAINFO_CODE "")
+ if(NOT "x${tls_cainfo}" STREQUAL "x")
set(TLS_CAINFO_CODE "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")")
endif()
- # check for netrc argument
- string(LENGTH "${netrc}" netrc_len)
- if(netrc_len GREATER 0)
+
+ set(NETRC_CODE "")
+ if(NOT "x${netrc}" STREQUAL "x")
set(NETRC_CODE "set(CMAKE_NETRC \"${netrc}\")")
endif()
- # check for netrc_file argument
- string(LENGTH "${netrc_file}" netrc_file_len)
- if(netrc_file_len GREATER 0)
+
+ set(NETRC_FILE_CODE "")
+ if(NOT "x${netrc_file}" STREQUAL "x")
set(NETRC_FILE_CODE "set(CMAKE_NETRC_FILE \"${netrc_file}\")")
endif()
@@ -1633,6 +1705,7 @@ function(_ep_write_downloadfile_script
endif()
# Used variables:
+ # * TLS_VERSION_CODE
# * TLS_VERIFY_CODE
# * TLS_CAINFO_CODE
# * ALGO
@@ -2970,10 +3043,8 @@ function(_ep_add_download_command name)
set(git_remote_name "origin")
endif()
- get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
- if("x${tls_verify}" STREQUAL "x" AND DEFINED CMAKE_TLS_VERIFY)
- set(tls_verify "${CMAKE_TLS_VERIFY}")
- endif()
+ _ep_get_tls_version(${name} tls_version)
+ _ep_get_tls_verify(${name} tls_verify)
get_property(git_shallow TARGET ${name} PROPERTY _EP_GIT_SHALLOW)
get_property(git_progress TARGET ${name} PROPERTY _EP_GIT_PROGRESS)
get_property(git_config TARGET ${name} PROPERTY _EP_GIT_CONFIG)
@@ -3023,6 +3094,7 @@ CMP0097=${_EP_CMP0097}
${work_dir}
${stamp_dir}/${name}-gitinfo.txt
${stamp_dir}/${name}-gitclone-lastrun.txt
+ "${tls_version}"
"${tls_verify}"
)
set(comment "Performing download step (git clone) for '${name}'")
@@ -3157,10 +3229,11 @@ hash=${hash}
TARGET ${name}
PROPERTY _EP_DOWNLOAD_NO_PROGRESS
)
- get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
- get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
- get_property(netrc TARGET ${name} PROPERTY _EP_NETRC)
- get_property(netrc_file TARGET ${name} PROPERTY _EP_NETRC_FILE)
+ _ep_get_tls_version(${name} tls_version)
+ _ep_get_tls_verify(${name} tls_verify)
+ _ep_get_tls_cainfo(${name} tls_cainfo)
+ _ep_get_netrc(${name} netrc)
+ _ep_get_netrc_file(${name} netrc_file)
get_property(http_username TARGET ${name} PROPERTY _EP_HTTP_USERNAME)
get_property(http_password TARGET ${name} PROPERTY _EP_HTTP_PASSWORD)
get_property(http_headers TARGET ${name} PROPERTY _EP_HTTP_HEADER)
@@ -3173,6 +3246,7 @@ hash=${hash}
"${inactivity_timeout}"
"${no_progress}"
"${hash}"
+ "${tls_version}"
"${tls_verify}"
"${tls_cainfo}"
"${http_username}:${http_password}"
@@ -3483,10 +3557,8 @@ function(_ep_add_update_command name)
_ep_get_git_submodules_recurse(git_submodules_recurse)
- get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
- if("x${tls_verify}" STREQUAL "x" AND DEFINED CMAKE_TLS_VERIFY)
- set(tls_verify "${CMAKE_TLS_VERIFY}")
- endif()
+ _ep_get_tls_version(${name} tls_version)
+ _ep_get_tls_verify(${name} tls_verify)
set(update_script "${tmp_dir}/${name}-gitupdate.cmake")
list(APPEND file_deps ${update_script})
@@ -3501,6 +3573,7 @@ function(_ep_add_update_command name)
"${git_repository}"
"${work_dir}"
"${git_update_strategy}"
+ "${tls_version}"
"${tls_verify}"
)
set(cmd ${CMAKE_COMMAND} -Dcan_fetch=YES -P ${update_script})
@@ -4274,6 +4347,7 @@ function(ExternalProject_Add name)
HTTP_USERNAME
HTTP_PASSWORD
HTTP_HEADER
+ TLS_VERSION # Also used for git clone operations
TLS_VERIFY # Also used for git clone operations
TLS_CAINFO
NETRC
diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in
index 0ad0dd3..f21a91a 100644
--- a/Modules/ExternalProject/download.cmake.in
+++ b/Modules/ExternalProject/download.cmake.in
@@ -100,7 +100,7 @@ message(STATUS "Downloading...
timeout='@TIMEOUT_MSG@'
inactivity timeout='@INACTIVITY_TIMEOUT_MSG@'"
)
-set(download_retry_codes 7 6 8 15 28)
+set(download_retry_codes 7 6 8 15 28 35)
set(skip_url_list)
set(status_code)
foreach(i RANGE ${retry_number})
@@ -111,6 +111,7 @@ foreach(i RANGE ${retry_number})
if(NOT url IN_LIST skip_url_list)
message(STATUS "Using src='${url}'")
+ @TLS_VERSION_CODE@
@TLS_VERIFY_CODE@
@TLS_CAINFO_CODE@
@NETRC_CODE@
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index fae51cf..3c01c2a 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1650,6 +1650,7 @@ ExternalProject_Add_Step(${contentName}-populate copyfile
set(__FETCHCONTENT_CACHED_INFO "")
set(__passthrough_vars
CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY
+ CMAKE_TLS_VERSION
CMAKE_TLS_VERIFY
CMAKE_TLS_CAINFO
CMAKE_NETRC
diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake
index 627866a..e332c14 100644
--- a/Modules/FindALSA.cmake
+++ b/Modules/FindALSA.cmake
@@ -43,6 +43,9 @@ The following cache variables may also be set:
the absolute path of the asound library
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(ALSA_INCLUDE_DIR NAMES alsa/asoundlib.h
DOC "The ALSA (asound) include directory"
)
@@ -74,3 +77,5 @@ if(ALSA_FOUND)
endif()
mark_as_advanced(ALSA_INCLUDE_DIR ALSA_LIBRARY)
+
+cmake_policy(POP)
diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake
index f959356..8faa653 100644
--- a/Modules/FindArmadillo.cmake
+++ b/Modules/FindArmadillo.cmake
@@ -34,6 +34,9 @@ This module sets the following variables:
ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech")
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(ARMADILLO_INCLUDE_DIR
NAMES armadillo
PATHS "$ENV{ProgramFiles}/Armadillo/include"
@@ -133,3 +136,5 @@ unset(_ARMA_USE_ARPACK)
unset(_ARMA_USE_HDF5)
unset(_ARMA_CONFIG_CONTENTS)
unset(_ARMA_HEADER_CONTENTS)
+
+cmake_policy(POP)
diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake
index 326e700..4714dfc 100644
--- a/Modules/FindBZip2.cmake
+++ b/Modules/FindBZip2.cmake
@@ -55,6 +55,9 @@ The following variables are provided for backward compatibility:
Superseded by ``BZIP2_VERSION``.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
set(_BZIP2_PATHS PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Bzip2;InstallPath]"
)
@@ -120,3 +123,5 @@ if (BZIP2_FOUND)
endif ()
mark_as_advanced(BZIP2_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 46b62d2..4d3186c 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -36,6 +36,17 @@ with the contents like the following::
#endif
And then reference that generated header file in actual source.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+.. versionadded:: 3.30
+
+This module defines the following :prop_tgt:`IMPORTED` targets:
+
+``Backtrace::Backtrace``
+ An interface library providing usage requirements for the found components.
+
#]=======================================================================]
include(CMakePushCheckState)
@@ -89,3 +100,14 @@ set(Backtrace_HEADER "${_Backtrace_HEADER_TRY}" CACHE STRING "Header providing b
find_package_handle_standard_args(Backtrace FOUND_VAR Backtrace_FOUND REQUIRED_VARS ${_Backtrace_STD_ARGS})
mark_as_advanced(Backtrace_HEADER Backtrace_INCLUDE_DIR Backtrace_LIBRARY)
+
+if(Backtrace_FOUND AND NOT TARGET Backtrace::Backtrace)
+ if(Backtrace_LIBRARY)
+ add_library(Backtrace::Backtrace UNKNOWN IMPORTED)
+ set_property(TARGET Backtrace::Backtrace PROPERTY IMPORTED_LOCATION "${Backtrace_LIBRARY}")
+ else()
+ add_library(Backtrace::Backtrace INTERFACE IMPORTED)
+ target_link_libraries(Backtrace::Backtrace INTERFACE ${Backtrace_LIBRARIES})
+ endif()
+ target_include_directories(Backtrace::Backtrace INTERFACE ${Backtrace_INCLUDE_DIRS})
+endif()
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 54d1a78..df71350 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -387,6 +387,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
cmake_policy(SET CMP0102 NEW) # if mark_as_advanced(non_cache_var)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
function(_boost_get_existing_target component target_var)
set(names "${component}")
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 203a473..130b239 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -891,26 +891,29 @@ if(CMAKE_CROSSCOMPILING)
SET (CUDA_TOOLKIT_ROOT $ENV{CUDA_TOOLKIT_ROOT})
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7-a")
# Support for NVPACK
- set (CUDA_TOOLKIT_TARGET_NAME "armv7-linux-androideabi")
+ set (CUDA_TOOLKIT_TARGET_NAMES "armv7-linux-androideabi")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
# Support for arm cross compilation
- set(CUDA_TOOLKIT_TARGET_NAME "armv7-linux-gnueabihf")
+ set(CUDA_TOOLKIT_TARGET_NAMES "armv7-linux-gnueabihf")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
# Support for aarch64 cross compilation
if (ANDROID_ARCH_NAME STREQUAL "arm64")
- set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux-androideabi")
+ set(CUDA_TOOLKIT_TARGET_NAMES "aarch64-linux-androideabi")
elseif (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- set(CUDA_TOOLKIT_TARGET_NAME "aarch64-qnx")
+ set(CUDA_TOOLKIT_TARGET_NAMES "aarch64-qnx")
else()
- set(CUDA_TOOLKIT_TARGET_NAME "aarch64-linux")
+ set(CUDA_TOOLKIT_TARGET_NAMES "aarch64-linux" "sbsa-linux")
endif (ANDROID_ARCH_NAME STREQUAL "arm64")
endif()
- if (EXISTS "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}")
- set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}" CACHE PATH "CUDA Toolkit target location.")
- SET (CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT})
- mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
- endif()
+ foreach(CUDA_TOOLKIT_TARGET_NAME IN LISTS CUDA_TOOLKIT_TARGET_NAMES)
+ if (EXISTS "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}")
+ set(CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT}/targets/${CUDA_TOOLKIT_TARGET_NAME}" CACHE PATH "CUDA Toolkit target location.")
+ SET (CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT} CACHE PATH "Toolkit location." FORCE)
+ mark_as_advanced(CUDA_TOOLKIT_TARGET_DIR)
+ break()
+ endif()
+ endforeach()
# add known CUDA targetr root path to the set of directories we search for programs, libraries and headers
set( CMAKE_FIND_ROOT_PATH "${CUDA_TOOLKIT_TARGET_DIR};${CMAKE_FIND_ROOT_PATH}")
diff --git a/Modules/FindCUDAToolkit.cmake b/Modules/FindCUDAToolkit.cmake
index 2229de6..44d09f5 100644
--- a/Modules/FindCUDAToolkit.cmake
+++ b/Modules/FindCUDAToolkit.cmake
@@ -123,6 +123,8 @@ of the following libraries that are part of the CUDAToolkit:
- :ref:`nvidia-ML<cuda_toolkit_nvML>`
- :ref:`nvPTX Compiler<cuda_toolkit_nvptx>`
- :ref:`nvRTC<cuda_toolkit_nvRTC>`
+- :ref:`nvJitLink<cuda_toolkit_nvJitLink>`
+- :ref:`nvFatBin<cuda_toolkit_nvfatbin>`
- :ref:`nvToolsExt<cuda_toolkit_nvToolsExt>`
- :ref:`nvtx3<cuda_toolkit_nvtx3>`
- :ref:`OpenCL<cuda_toolkit_opencl>`
@@ -158,7 +160,7 @@ Targets Created:
cuBLAS
""""""
-The `cuBLAS <https://docs.nvidia.com/cuda/cublas/index.html>`_ library.
+The `cuBLAS <https://docs.nvidia.com/cuda/cublas>`_ library.
Targets Created:
@@ -174,7 +176,7 @@ cuDLA
.. versionadded:: 3.27
-The NVIDIA Tegra Deep Learning Accelerator `cuDLA <https://docs.nvidia.com/cuda/cublas/index.html>`_ library.
+The NVIDIA Tegra Deep Learning Accelerator `cuDLA <https://docs.nvidia.com/cuda/cublas>`_ library.
Targets Created:
@@ -187,7 +189,7 @@ cuFile
.. versionadded:: 3.25
-The NVIDIA GPUDirect Storage `cuFile <https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html>`_ library.
+The NVIDIA GPUDirect Storage `cuFile <https://docs.nvidia.com/gpudirect-storage/api-reference-guide>`_ library.
Targets Created:
@@ -201,7 +203,7 @@ Targets Created:
cuFFT
"""""
-The `cuFFT <https://docs.nvidia.com/cuda/cufft/index.html>`_ library.
+The `cuFFT <https://docs.nvidia.com/cuda/cufft>`_ library.
Targets Created:
@@ -214,7 +216,7 @@ Targets Created:
cuRAND
""""""
-The `cuRAND <https://docs.nvidia.com/cuda/curand/index.html>`_ library.
+The `cuRAND <https://docs.nvidia.com/cuda/curand>`_ library.
Targets Created:
@@ -226,7 +228,7 @@ Targets Created:
cuSOLVER
""""""""
-The `cuSOLVER <https://docs.nvidia.com/cuda/cusolver/index.html>`_ library.
+The `cuSOLVER <https://docs.nvidia.com/cuda/cusolver>`_ library.
Targets Created:
@@ -238,7 +240,7 @@ Targets Created:
cuSPARSE
""""""""
-The `cuSPARSE <https://docs.nvidia.com/cuda/cusparse/index.html>`_ library.
+The `cuSPARSE <https://docs.nvidia.com/cuda/cusparse>`_ library.
Targets Created:
@@ -269,7 +271,7 @@ Targets Created:
NPP
"""
-The `NPP <https://docs.nvidia.com/cuda/npp/index.html>`_ libraries.
+The `NPP <https://docs.nvidia.com/cuda/npp>`_ libraries.
Targets Created:
@@ -339,7 +341,7 @@ Targets Created:
nvBLAS
""""""
-The `nvBLAS <https://docs.nvidia.com/cuda/nvblas/index.html>`_ libraries.
+The `nvBLAS <https://docs.nvidia.com/cuda/nvblas>`_ libraries.
This is a shared library only.
Targets Created:
@@ -365,7 +367,7 @@ Targets Created:
nvJPEG
""""""
-The `nvJPEG <https://docs.nvidia.com/cuda/nvjpeg/index.html>`_ library.
+The `nvJPEG <https://docs.nvidia.com/cuda/nvjpeg>`_ library.
Introduced in CUDA 10.
Targets Created:
@@ -380,7 +382,7 @@ nvPTX Compiler
.. versionadded:: 3.25
-The `nvPTX <https://docs.nvidia.com/cuda/ptx-compiler-api/index.html>`_ (PTX Compilation) library.
+The `nvPTX <https://docs.nvidia.com/cuda/ptx-compiler-api>`_ (PTX Compilation) library.
The PTX Compiler APIs are a set of APIs which can be used to compile a PTX program into GPU assembly code.
Introduced in CUDA 11.1
This is a static library only.
@@ -394,7 +396,7 @@ Targets Created:
nvRTC
"""""
-The `nvRTC <https://docs.nvidia.com/cuda/nvrtc/index.html>`_ (Runtime Compilation) library.
+The `nvRTC <https://docs.nvidia.com/cuda/nvrtc>`_ (Runtime Compilation) library.
Targets Created:
@@ -418,12 +420,26 @@ Targets Created:
- ``CUDA::nvJitLink`` starting in CUDA 12.0
- ``CUDA::nvJitLink_static`` starting in CUDA 12.0
+.. _`cuda_toolkit_nvfatbin`:
+
+nvFatBin
+"""""""""
+
+.. versionadded:: 3.30
+
+The `nvFatBin <https://docs.nvidia.com/cuda/>`_ (Runtime fatbin creation) library.
+
+Targets Created:
+
+- ``CUDA::nvfatbin`` starting in CUDA 12.4
+- ``CUDA::nvfatbin_static`` starting in CUDA 12.4
+
.. _`cuda_toolkit_nvml`:
nvidia-ML
"""""""""
-The `NVIDIA Management Library <https://developer.nvidia.com/nvidia-management-library-nvml>`_.
+The `NVIDIA Management Library <https://developer.nvidia.com/management-library-nvml>`_.
This is a shared library only.
Targets Created:
@@ -451,7 +467,7 @@ nvtx3
.. versionadded:: 3.25
-The header-only `NVIDIA Tools Extension Library <https://nvidia.github.io/NVTX/doxygen/index.html>`_.
+The header-only `NVIDIA Tools Extension Library <https://nvidia.github.io/NVTX/doxygen>`_.
Introduced in CUDA 10.0.
Targets created:
@@ -1168,6 +1184,11 @@ if(CUDAToolkit_FOUND)
_CUDAToolkit_find_and_add_import_lib(nvJitLink_static DEPS cudart_static_deps)
endif()
+ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.4.0)
+ _CUDAToolkit_find_and_add_import_lib(nvfatbin DEPS cudart_static_deps)
+ _CUDAToolkit_find_and_add_import_lib(nvfatbin_static DEPS cudart_static_deps)
+ endif()
+
_CUDAToolkit_find_and_add_import_lib(culibos) # it's a static library
foreach (cuda_lib cublasLt cufft nvjpeg)
_CUDAToolkit_find_and_add_import_lib(${cuda_lib})
@@ -1183,7 +1204,7 @@ if(CUDAToolkit_FOUND)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.0.0)
# cublas depends on cublasLt
- # https://docs.nvidia.com/cuda/archive/11.0/cublas/index.html#static-library
+ # https://docs.nvidia.com/cuda/archive/11.0/cublas#static-library
_CUDAToolkit_find_and_add_import_lib(cublas DEPS cublasLt culibos)
_CUDAToolkit_find_and_add_import_lib(cublas_static DEPS cublasLt_static culibos)
else()
@@ -1216,14 +1237,14 @@ if(CUDAToolkit_FOUND)
set(cusolver_static_deps cublas_static cusparse_static culibos)
if(CUDAToolkit_VERSION VERSION_GREATER 11.2.1)
# cusolver depends on libcusolver_metis and cublasLt
- # https://docs.nvidia.com/cuda/archive/11.2.2/cusolver/index.html#link-dependency
+ # https://docs.nvidia.com/cuda/archive/11.2.2/cusolver#link-dependency
list(APPEND cusolver_deps cublasLt)
_CUDAToolkit_find_and_add_import_lib(cusolver_metis_static ALT metis_static) # implementation detail static lib
list(APPEND cusolver_static_deps cusolver_metis_static cublasLt_static)
endif()
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 10.1.2)
# cusolver depends on liblapack_static.a starting with CUDA 10.1 update 2,
- # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver/index.html#static-link-lapack
+ # https://docs.nvidia.com/cuda/archive/11.5.0/cusolver#static-link-lapack
_CUDAToolkit_find_and_add_import_lib(cusolver_lapack_static ALT lapack_static) # implementation detail static lib
list(APPEND cusolver_static_deps cusolver_lapack_static)
endif()
@@ -1281,17 +1302,17 @@ if(CUDAToolkit_FOUND)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.1.0)
if(NOT TARGET CUDA::nvptxcompiler_static)
- _CUDAToolkit_find_and_add_import_lib(nvptxcompiler_static DEPS cuda_driver)
+ _CUDAToolkit_find_and_add_import_lib(nvptxcompiler_static)
if(TARGET CUDA::nvptxcompiler_static)
target_link_libraries(CUDA::nvptxcompiler_static INTERFACE CUDA::cudart_static_deps)
endif()
endif()
endif()
- _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins ALT nvrtc-builtins DEPS cuda_driver)
+ _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins ALT nvrtc-builtins)
_CUDAToolkit_find_and_add_import_lib(nvrtc DEPS nvrtc_builtins nvJitLink)
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 11.5.0)
- _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static DEPS cuda_driver)
+ _CUDAToolkit_find_and_add_import_lib(nvrtc_builtins_static ALT nvrtc-builtins_static)
if(NOT TARGET CUDA::nvrtc_static)
_CUDAToolkit_find_and_add_import_lib(nvrtc_static DEPS nvrtc_builtins_static nvptxcompiler_static nvJitLink_static)
if(TARGET CUDA::nvrtc_static AND WIN32 AND NOT (BORLAND OR MINGW OR CYGWIN))
diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake
index 5e5f1f8..5ce8a90 100644
--- a/Modules/FindCURL.cmake
+++ b/Modules/FindCURL.cmake
@@ -72,6 +72,9 @@ Hints
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
if(NOT CURL_NO_CURL_CMAKE)
@@ -86,6 +89,8 @@ if(NOT CURL_NO_CURL_CMAKE)
find_package_handle_standard_args(CURL HANDLE_COMPONENTS CONFIG_MODE)
# The upstream curl package sets CURL_VERSION, not CURL_VERSION_STRING.
set(CURL_VERSION_STRING "${CURL_VERSION}")
+
+ cmake_policy(POP)
return()
endif()
endif()
@@ -117,6 +122,8 @@ if(NOT CURL_LIBRARY)
curllib_static
# Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip):
libcurl
+ # Some Windows prebuilt versions distribute `libcurl_a.lib` instead of `libcurl.lib`
+ libcurl_a
NAMES_PER_DIR
HINTS ${PC_CURL_LIBRARY_DIRS}
)
@@ -239,3 +246,5 @@ if(CURL_FOUND)
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake
index cf0d341..ceed009 100644
--- a/Modules/FindCups.cmake
+++ b/Modules/FindCups.cmake
@@ -41,6 +41,9 @@ The following cache variables may also be set:
the directory containing the Cups headers
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(CUPS_INCLUDE_DIR cups/cups.h )
find_library(CUPS_LIBRARIES NAMES cups )
@@ -98,3 +101,5 @@ if (CUPS_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${CUPS_INCLUDE_DIR}")
endif ()
endif ()
+
+cmake_policy(POP)
diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake
index 762931e..398a415 100644
--- a/Modules/FindEXPAT.cmake
+++ b/Modules/FindEXPAT.cmake
@@ -41,6 +41,9 @@ Hints
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_package(PkgConfig QUIET)
pkg_check_modules(PC_EXPAT QUIET expat)
@@ -156,3 +159,5 @@ if(EXPAT_FOUND)
endif()
mark_as_advanced(EXPAT_INCLUDE_DIR EXPAT_LIBRARY)
+
+cmake_policy(POP)
diff --git a/Modules/FindFontconfig.cmake b/Modules/FindFontconfig.cmake
index 5228831..9cce952 100644
--- a/Modules/FindFontconfig.cmake
+++ b/Modules/FindFontconfig.cmake
@@ -34,6 +34,8 @@ This will define the following variables in your project:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
@@ -101,3 +103,5 @@ if(Fontconfig_FOUND)
set(Fontconfig_LIBRARIES ${Fontconfig_LIBRARY})
set(Fontconfig_INCLUDE_DIRS ${Fontconfig_INCLUDE_DIR})
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake
index 82885cb..6d0ed68 100644
--- a/Modules/FindFreetype.cmake
+++ b/Modules/FindFreetype.cmake
@@ -47,6 +47,9 @@ The user may set the environment variable ``FREETYPE_DIR`` to the root
directory of a Freetype installation.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
# This file has been renamed to "FindFreetype.cmake" instead of the correct
@@ -202,3 +205,5 @@ if(Freetype_FOUND)
endif()
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake
index e6eac30..a9c5740 100644
--- a/Modules/FindGDAL.cmake
+++ b/Modules/FindGDAL.cmake
@@ -72,6 +72,9 @@ The following variables may be set to modify the search strategy:
#
#include "gdal.h"
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(GDAL_INCLUDE_DIR gdal.h
HINTS
ENV GDAL_DIR
@@ -197,3 +200,5 @@ if (GDAL_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${GDAL_INCLUDE_DIR}")
endif ()
endif ()
+
+cmake_policy(POP)
diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake
index cea9cd8..9a11b88 100644
--- a/Modules/FindGIF.cmake
+++ b/Modules/FindGIF.cmake
@@ -46,6 +46,9 @@ Hints
``./configure --prefix=$GIF_DIR``.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Created by Eric Wing.
# Modifications by Alexander Neundorf, Ben Campbell
@@ -126,3 +129,5 @@ if(GIF_FOUND)
endif()
mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
+
+cmake_policy(POP)
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index dff53e1..f6b7b1a 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -223,7 +223,10 @@ endif()
# Read version from GL/glew.h file
if(EXISTS "${GLEW_INCLUDE_DIR}/GL/glew.h")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${GLEW_INCLUDE_DIR}/GL/glew.h" _contents REGEX "^VERSION_.+ [0-9]+")
+ cmake_policy(POP)
if(_contents)
string(REGEX REPLACE ".*VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" GLEW_VERSION_MAJOR "${_contents}")
string(REGEX REPLACE ".*VERSION_MINOR[ \t]+([0-9]+).*" "\\1" GLEW_VERSION_MINOR "${_contents}")
diff --git a/Modules/FindGSL.cmake b/Modules/FindGSL.cmake
index 1943847..e9d8109 100644
--- a/Modules/FindGSL.cmake
+++ b/Modules/FindGSL.cmake
@@ -59,6 +59,9 @@ help this module find the correct files::
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
#=============================================================================
@@ -229,3 +232,5 @@ if( GSL_FOUND AND NOT TARGET GSL::gsl )
INTERFACE_LINK_LIBRARIES GSL::gslcblas )
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 4634876..f91d2fd 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -175,7 +175,10 @@ Use the results:
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS ${_gtkversion_hdr} _contents REGEX "#define GTK_M[A-Z]+_VERSION[ \t]+")
+ cmake_policy(POP)
if(_contents)
string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
@@ -211,7 +214,10 @@ endfunction()
#=============================================================
function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversion_hdr)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS ${_sigcxxversion_hdr} _contents REGEX "#define SIGCXX_M[A-Z]+_VERSION[ \t]+")
+ cmake_policy(POP)
if(_contents)
string(REGEX REPLACE ".*#define SIGCXX_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_major} "${_contents}")
string(REGEX REPLACE ".*#define SIGCXX_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" ${_OUT_minor} "${_contents}")
@@ -300,6 +306,10 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
endif()
find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr}
PATHS
+ ${PC_GLIB2_INCLUDEDIR}
+ ${PC_GLIB2_LIBDIR}
+ ${PC_GTK2_INCLUDEDIR}
+ ${PC_GTK2_LIBDIR}
${_gtk2_arch_dir}
/usr/local/libx32
/usr/local/lib64
@@ -610,6 +620,23 @@ if(NOT GTK2_FIND_COMPONENTS)
set(GTK2_FIND_COMPONENTS gtk)
endif()
+# Retrieve LIBDIR from the GTK2 and GLIB2 pkg-config files, which are
+# used to compute the arch-specific include prefixes. While at it,
+# also retrieve their INCLUDEDIR, to accommodate non-standard layouts.
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_GTK2 QUIET gtk+-2.0)
+ if(PC_GTK2_FOUND)
+ pkg_get_variable(PC_GTK2_INCLUDEDIR gtk+-2.0 includedir)
+ pkg_get_variable(PC_GTK2_LIBDIR gtk+-2.0 libdir)
+ endif()
+ pkg_check_modules(PC_GLIB2 QUIET glib-2.0)
+ if(PC_GLIB2_FOUND)
+ pkg_get_variable(PC_GLIB2_INCLUDEDIR glib-2.0 includedir)
+ pkg_get_variable(PC_GLIB2_LIBDIR glib-2.0 libdir)
+ endif()
+endif()
+
#
# If specified, enforce version number
#
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 92334e4..c2128a9 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -125,7 +125,10 @@ macro(__gtest_determine_windows_library_type _var)
if(EXISTS "${${_var}}")
file(TO_NATIVE_PATH "${${_var}}" _lib_path)
get_filename_component(_name "${${_var}}" NAME_WE)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${${_var}}" _match REGEX "${_name}\\.dll" LIMIT_COUNT 1)
+ cmake_policy(POP)
if(NOT _match STREQUAL "")
set(${_var}_TYPE SHARED PARENT_SCOPE)
else()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index cc6186f..bd21e3d 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -157,6 +157,9 @@ The following variables can be set to guide the search for HDF5 libraries and in
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# We haven't found HDF5 yet. Clear its state in case it is set in the parent
# scope somewhere else. We can't rely on it because different components may
# have been requested for this call.
@@ -1243,3 +1246,5 @@ if (HDF5_FIND_DEBUG)
endif()
unset(_lang)
unset(_HDF5_NEED_TO_SEARCH)
+
+cmake_policy(POP)
diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake
index 9724d2c..ca09444 100644
--- a/Modules/FindHSPELL.cmake
+++ b/Modules/FindHSPELL.cmake
@@ -25,6 +25,9 @@ Once done this will define
HSPELL_MINOR_VERSION - The minor version of Hspell
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(HSPELL_INCLUDE_DIR hspell.h)
find_library(HSPELL_LIBRARIES NAMES hspell)
@@ -43,3 +46,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL
VERSION_VAR HSPELL_VERSION_STRING)
mark_as_advanced(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES)
+
+cmake_policy(POP)
diff --git a/Modules/FindICU.cmake b/Modules/FindICU.cmake
index 9514d2d..63c2576 100644
--- a/Modules/FindICU.cmake
+++ b/Modules/FindICU.cmake
@@ -24,10 +24,10 @@ platform-specific library name will be automatically selected.
This module reports information about the ICU installation in
several variables. General variables::
- ICU_VERSION - ICU release version
ICU_FOUND - true if the main programs and libraries were found
- ICU_LIBRARIES - component libraries to be linked
ICU_INCLUDE_DIRS - the directories containing the ICU headers
+ ICU_LIBRARIES - component libraries to be linked
+ ICU_VERSION - ICU release version
Imported targets::
@@ -83,12 +83,10 @@ The following cache variables may also be set::
In most cases none of the above variables will require setting,
unless multiple ICU versions are available and a specific version
is required.
-
-Other variables one may set to control this module are::
-
- ICU_DEBUG - Set to ON to enable debug output from FindICU.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# Written by Roger Leigh <rleigh@codelibre.net>
set(icu_programs
@@ -179,7 +177,6 @@ function(_ICU_FIND)
# Find all ICU libraries
list(APPEND icu_library_suffixes "${_lib64}" "lib")
- set(ICU_REQUIRED_LIBS_FOUND ON)
set(static_prefix )
# static icu libraries compiled with MSVC have the prefix 's'
if(MSVC)
@@ -190,8 +187,9 @@ function(_ICU_FIND)
set(component_cache "ICU_${component_upcase}_LIBRARY")
set(component_cache_release "${component_cache}_RELEASE")
set(component_cache_debug "${component_cache}_DEBUG")
- set(component_found "ICU_${component_upcase}_FOUND")
+ set(component_found "ICU_${component}_FOUND")
set(component_found_compat "${component_upcase}_FOUND")
+ set(component_found_compat2 "ICU_${component_upcase}_FOUND")
set(component_libnames "icu${component}")
set(component_debug_libnames "icu${component}d")
@@ -254,27 +252,17 @@ function(_ICU_FIND)
if(${component_cache})
set("${component_found}" ON)
set("${component_found_compat}" ON)
+ set("${component_found_compat2}" ON)
list(APPEND ICU_LIBRARY "${${component_cache}}")
- if (ICU_FIND_REQUIRED_${component})
- list(APPEND ICU_LIBS_FOUND "${component} (required): ${${component_cache}}")
- else()
- list(APPEND ICU_LIBS_FOUND "${component} (optional): ${${component_cache}}")
- endif()
- else()
- if (ICU_FIND_REQUIRED_${component})
- set(ICU_REQUIRED_LIBS_FOUND OFF)
- list(APPEND ICU_LIBS_NOTFOUND "${component} (required)")
- else()
- list(APPEND ICU_LIBS_NOTFOUND "${component} (optional)")
- endif()
endif()
mark_as_advanced("${component_found}")
mark_as_advanced("${component_found_compat}")
+ mark_as_advanced("${component_found_compat2}")
set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
set("${component_found}" "${${component_found}}" PARENT_SCOPE)
set("${component_found_compat}" "${${component_found_compat}}" PARENT_SCOPE)
+ set("${component_found_compat2}" "${${component_found_compat2}}" PARENT_SCOPE)
endforeach()
- set(_ICU_REQUIRED_LIBS_FOUND "${ICU_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
set(ICU_LIBRARY "${ICU_LIBRARY}" PARENT_SCOPE)
# Find all ICU data files
@@ -303,43 +291,21 @@ function(_ICU_FIND)
mark_as_advanced("${cache_var}")
set("${data_var}" "${${cache_var}}" PARENT_SCOPE)
endforeach()
-
- if(NOT ICU_FIND_QUIETLY)
- if(ICU_LIBS_FOUND)
- message(STATUS "Found the following ICU libraries:")
- foreach(found ${ICU_LIBS_FOUND})
- message(STATUS " ${found}")
- endforeach()
- endif()
- if(ICU_LIBS_NOTFOUND)
- message(STATUS "The following ICU libraries were not found:")
- foreach(notfound ${ICU_LIBS_NOTFOUND})
- message(STATUS " ${notfound}")
- endforeach()
- endif()
- endif()
-
- if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake search debug--------")
- message(STATUS "ICU binary path search order: ${icu_roots}")
- message(STATUS "ICU include path search order: ${icu_roots}")
- message(STATUS "ICU library path search order: ${icu_roots}")
- message(STATUS "----------------")
- endif()
endfunction()
_ICU_FIND()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU
- FOUND_VAR ICU_FOUND
- REQUIRED_VARS ICU_INCLUDE_DIR
- ICU_LIBRARY
- _ICU_REQUIRED_LIBS_FOUND
- VERSION_VAR ICU_VERSION
- FAIL_MESSAGE "Failed to find all ICU components")
-
-unset(_ICU_REQUIRED_LIBS_FOUND)
+find_package_handle_standard_args(ICU
+ REQUIRED_VARS
+ ICU_INCLUDE_DIR
+ ICU_LIBRARY
+ VERSION_VAR
+ ICU_VERSION
+ HANDLE_COMPONENTS
+ FAIL_MESSAGE
+ "Failed to find all ICU components"
+)
if(ICU_FOUND)
set(ICU_INCLUDE_DIRS "${ICU_INCLUDE_DIR}")
@@ -393,45 +359,5 @@ if(ICU_FOUND)
endforeach()
endif()
-if(ICU_DEBUG)
- message(STATUS "--------FindICU.cmake results debug--------")
- message(STATUS "ICU found: ${ICU_FOUND}")
- message(STATUS "ICU_VERSION number: ${ICU_VERSION}")
- message(STATUS "ICU_ROOT directory: ${ICU_ROOT}")
- message(STATUS "ICU_INCLUDE_DIR directory: ${ICU_INCLUDE_DIR}")
- message(STATUS "ICU_LIBRARIES: ${ICU_LIBRARIES}")
-
- foreach(program IN LISTS icu_programs)
- string(TOUPPER "${program}" program_upcase)
- set(program_lib "ICU_${program_upcase}_EXECUTABLE")
- message(STATUS "${program} program: ${program_lib}=${${program_lib}}")
- unset(program_upcase)
- unset(program_lib)
- endforeach()
-
- foreach(data IN LISTS icu_data)
- string(TOUPPER "${data}" data_upcase)
- string(REPLACE "." "_" data_upcase "${data_upcase}")
- set(data_lib "ICU_${data_upcase}")
- message(STATUS "${data} data: ${data_lib}=${${data_lib}}")
- unset(data_upcase)
- unset(data_lib)
- endforeach()
-
- foreach(component IN LISTS ICU_FIND_COMPONENTS)
- string(TOUPPER "${component}" component_upcase)
- set(component_lib "ICU_${component_upcase}_LIBRARIES")
- set(component_found "ICU_${component_upcase}_FOUND")
- set(component_found_compat "${component_upcase}_FOUND")
- message(STATUS "${component} library found: ${component_found}=${${component_found}}")
- message(STATUS "${component} library found (compat name): ${component_found_compat}=${${component_found_compat}}")
- message(STATUS "${component} library: ${component_lib}=${${component_lib}}")
- unset(component_upcase)
- unset(component_lib)
- unset(component_found)
- unset(component_found_compat)
- endforeach()
- message(STATUS "----------------")
-endif()
-
unset(icu_programs)
+cmake_policy(POP)
diff --git a/Modules/FindIconv.cmake b/Modules/FindIconv.cmake
index 566330f..879ff16f 100644
--- a/Modules/FindIconv.cmake
+++ b/Modules/FindIconv.cmake
@@ -75,6 +75,9 @@ The following cache variables may also be set:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
if(CMAKE_C_COMPILER_LOADED)
include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
@@ -101,7 +104,7 @@ if(NOT DEFINED Iconv_IS_BUILT_IN)
"
#include <stddef.h>
#include <iconv.h>
- int main() {
+ int main(void) {
char *a, *b;
size_t i, j;
iconv_t ic;
@@ -180,3 +183,5 @@ if(Iconv_FOUND)
set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "${Iconv_LIBRARIES}")
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindIntl.cmake b/Modules/FindIntl.cmake
index 95eeabd..04f5a23 100644
--- a/Modules/FindIntl.cmake
+++ b/Modules/FindIntl.cmake
@@ -82,6 +82,9 @@ The following cache variables may also be set:
``msgfmt``, etc.), use :module:`FindGettext`.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
if(CMAKE_C_COMPILER_LOADED)
include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
@@ -181,3 +184,5 @@ if(Intl_FOUND)
INTERFACE_LINK_LIBRARIES "${Intl_LIBRARIES}")
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 3f243de..08a0bd3 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -56,6 +56,9 @@ Obsolete variables
where to find the JPEG library.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(JPEG_INCLUDE_DIR jpeglib.h)
set(jpeg_names ${JPEG_NAMES} jpeg jpeg-static libjpeg libjpeg-static)
@@ -140,3 +143,5 @@ if(JPEG_FOUND)
endif()
mark_as_advanced(JPEG_LIBRARY JPEG_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake
index ec2907d..79afcd5 100644
--- a/Modules/FindJasper.cmake
+++ b/Modules/FindJasper.cmake
@@ -42,6 +42,9 @@ The following cache variables may also be set:
where to find the Jasper library (debug).
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(JASPER_INCLUDE_DIR jasper/jasper.h)
mark_as_advanced(JASPER_INCLUDE_DIR)
@@ -88,3 +91,5 @@ if(JASPER_FOUND)
endif()
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindLTTngUST.cmake b/Modules/FindLTTngUST.cmake
index eaace4f..34b2e82 100644
--- a/Modules/FindLTTngUST.cmake
+++ b/Modules/FindLTTngUST.cmake
@@ -37,6 +37,9 @@ This module sets the following
``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(LTTNGUST_INCLUDE_DIRS NAMES lttng/tracepoint.h)
find_library(LTTNGUST_LIBRARIES NAMES lttng-ust)
@@ -100,3 +103,5 @@ find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
LTTNGUST_INCLUDE_DIRS
VERSION_VAR LTTNGUST_VERSION_STRING)
mark_as_advanced(LTTNGUST_LIBRARIES LTTNGUST_INCLUDE_DIRS)
+
+cmake_policy(POP)
diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake
index 9d3ac13..38a43db 100644
--- a/Modules/FindLibArchive.cmake
+++ b/Modules/FindLibArchive.cmake
@@ -31,6 +31,9 @@ The module defines the following ``IMPORTED`` targets:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(LibArchive_INCLUDE_DIR
NAMES archive.h
PATHS
@@ -81,3 +84,5 @@ if(LibArchive_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${LibArchive_INCLUDE_DIR}")
endif ()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake
index 1b3929b..7b0c530 100644
--- a/Modules/FindLibLZMA.cmake
+++ b/Modules/FindLibLZMA.cmake
@@ -58,6 +58,9 @@ The following variables are provided for backward compatibility:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(LIBLZMA_INCLUDE_DIR lzma.h )
if(NOT LIBLZMA_LIBRARY)
find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
@@ -140,3 +143,5 @@ if (LIBLZMA_FOUND)
endif()
endif()
endif ()
+
+cmake_policy(POP)
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index ce28d03..1c5f9be 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -52,6 +52,9 @@ The following cache variables may also be set:
path to the LibXml2 library
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
@@ -122,3 +125,5 @@ if(LIBXML2_XMLLINT_EXECUTABLE AND NOT TARGET LibXml2::xmllint)
add_executable(LibXml2::xmllint IMPORTED)
set_target_properties(LibXml2::xmllint PROPERTIES IMPORTED_LOCATION "${LIBXML2_XMLLINT_EXECUTABLE}")
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake
index a9920ee..1154ae1 100644
--- a/Modules/FindLibXslt.cmake
+++ b/Modules/FindLibXslt.cmake
@@ -45,6 +45,9 @@ for using xslt):
Contains the full path to the xsltproc executable if found.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
@@ -133,3 +136,5 @@ if(LIBXSLT_XSLTPROC_EXECUTABLE AND NOT TARGET LibXslt::xsltproc)
add_executable(LibXslt::xsltproc IMPORTED)
set_target_properties(LibXslt::xsltproc PROPERTIES IMPORTED_LOCATION "${LIBXSLT_XSLTPROC_EXECUTABLE}")
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index b56a7b1..b4106c4 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -45,6 +45,7 @@ locations other than lua/
cmake_policy(PUSH) # Policies apply to functions at definition-time
cmake_policy(SET CMP0012 NEW) # For while(TRUE)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
unset(_lua_include_subdirs)
unset(_lua_library_names)
diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake
index 405a7a7..2249ab1 100644
--- a/Modules/FindLua51.cmake
+++ b/Modules/FindLua51.cmake
@@ -26,6 +26,9 @@ This is because, the lua location is not standardized and may exist in
locations other than lua/
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
@@ -73,3 +76,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
+
+cmake_policy(POP)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 7aa371a..e35697e 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -265,6 +265,7 @@ Additionally, the following variables are deprecated:
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package(PkgConfig QUIET)
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 2488bd9..84f7c62 100644
--- a/Modules/FindMatlab.cmake
+++ b/Modules/FindMatlab.cmake
@@ -42,6 +42,13 @@ The module supports the following components:
Removed the ``MX_LIBRARY``, ``ENGINE_LIBRARY`` and ``DATAARRAY_LIBRARY``
components. These libraries are found unconditionally.
+.. versionadded:: 3.30
+ Added support for specifying a version range to :command:`find_package` and
+ added support for specifying ``REGISTRY_VIEW`` to :command:`find_package`,
+ :command:`matlab_extract_all_installed_versions_from_registry` and
+ :command:`matlab_get_all_valid_matlab_roots_from_registry`. The default
+ behavior remained unchanged, by using the registry view ``TARGET``.
+
.. note::
The version given to the :command:`find_package` directive is the Matlab
@@ -56,7 +63,8 @@ the path of the desired Matlab version. Otherwise, the behavior is platform
specific:
* Windows: The installed versions of Matlab/MCR are retrieved from the
- Windows registry
+ Windows registry. The ``REGISTRY_VIEW`` argument may optionally be specified
+ to manually control whether 32bit or 64bit versions shall be searched for.
* macOS: The installed versions of Matlab/MCR are given by the MATLAB
default installation paths in ``/Application``. If no such application is
found, it falls back to the one that might be accessible from the ``PATH``.
@@ -283,13 +291,17 @@ Reference
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}")
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-include(CheckCXXCompilerFlag)
-include(CheckCCompilerFlag)
+if(NOT WIN32 AND NOT APPLE AND NOT Threads_FOUND)
+ # MEX files use pthread if available
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads)
+endif()
# The currently supported versions. Other version can be added by the user by
# providing MATLAB_ADDITIONAL_VERSIONS
@@ -438,20 +450,33 @@ endmacro()
#[=======================================================================[.rst:
.. command:: matlab_extract_all_installed_versions_from_registry
- .. code-block:: cmake
+ This function parses the Windows registry and finds the Matlab versions that
+ are installed. The found versions are stored in ``matlab_versions``.
+
+ .. signature::
+ matlab_extract_all_installed_versions_from_registry(matlab_versions
+ [REGISTRY_VIEW view])
+
+ .. versionadded:: 3.30
+ * Output: ``matlab_versions`` is a list of all the versions of Matlab found
+ * Input: ``REGISTRY_VIEW`` Optional registry view to use for registry
+ interaction. The argument is passed (or omitted) to
+ :command:`cmake_host_system_information` without further checks or
+ modification.
+
+ .. signature::
matlab_extract_all_installed_versions_from_registry(win64 matlab_versions)
- * Input: ``win64`` is a boolean to search for the 64 bit version of Matlab
- * Output: ``matlab_versions`` is a list of all the versions of Matlab found
+ * Input: ``win64`` is a boolean to search for the 64 bit version of
+ Matlab. Set to ``ON`` to use the 64bit registry view or ``OFF`` to use the
+ 32bit registry view. If finer control is needed, see signature above.
+ * Output: ``matlab_versions`` is a list of all the versions of Matlab found
- This function parses the Windows registry and founds the Matlab versions that
- are installed. The found versions are returned in `matlab_versions`.
- Set `win64` to `TRUE` if the 64 bit version of Matlab should be looked for
The returned list contains all versions under
- ``HKLM\\SOFTWARE\\Mathworks\\MATLAB``,
- ``HKLM\\SOFTWARE\\Mathworks\\MATLAB Runtime`` and
- ``HKLM\\SOFTWARE\\Mathworks\\MATLAB Compiler Runtime`` or an empty list in
+ ``HKLM\SOFTWARE\Mathworks\MATLAB``,
+ ``HKLM\SOFTWARE\Mathworks\MATLAB Runtime`` and
+ ``HKLM\SOFTWARE\Mathworks\MATLAB Compiler Runtime`` or an empty list in
case an error occurred (or nothing found).
.. note::
@@ -460,16 +485,32 @@ endmacro()
installation referenced in the registry,
#]=======================================================================]
-function(matlab_extract_all_installed_versions_from_registry win64 matlab_versions)
+function(matlab_extract_all_installed_versions_from_registry win64_or_matlab_versions)
if(NOT CMAKE_HOST_WIN32)
message(FATAL_ERROR "[MATLAB] This function can only be called by a Windows host")
endif()
- if(${win64} AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "64")
- set(_view "64")
+ set(_registry_view_args)
+ if("${ARGC}" EQUAL "2")
+ # Old API: <win64> <matlab_versions>
+ if(${win64_or_matlab_versions})
+ set(_registry_view_args VIEW 64)
+ else()
+ set(_registry_view_args VIEW 32)
+ endif()
+ set(matlab_versions ${ARGV1})
else()
- set(_view "32")
+ # New API: <matlab_versions> [REGISTRY_VIEW <view>]
+ set(matlab_versions ${win64_or_matlab_versions})
+ cmake_parse_arguments(_Matlab "" "REGISTRY_VIEW" "" ${ARGN})
+ if(_Matlab_REGISTRY_VIEW)
+ set(_registry_view_args VIEW "${_Matlab_REGISTRY_VIEW}")
+ endif()
+ endif()
+
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Extracting MATLAB versions with registry view args '${_registry_view_args}'")
endif()
set(matlabs_from_registry)
@@ -477,20 +518,15 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio
foreach(_installation_type IN ITEMS "MATLAB" "MATLAB Runtime" "MATLAB Compiler Runtime")
cmake_host_system_information(RESULT _reg
- QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}"
- SUBKEYS VIEW ${_view}
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}"
+ SUBKEYS
+ ${_registry_view_args}
)
- if(_reg)
- string(REGEX MATCHALL "([0-9]+(\\.[0-9]+)+)" _versions_regex "${_reg}")
+ string(REGEX MATCHALL "([0-9]+(\\.[0-9]+)+)" _versions_regex "${_reg}")
- foreach(_match IN LISTS _versions_regex)
- if(_match MATCHES "([0-9]+(\\.[0-9]+)+)")
- list(APPEND matlabs_from_registry ${_match})
- endif()
- endforeach()
+ list(APPEND matlabs_from_registry ${_versions_regex})
- endif()
endforeach()
if(matlabs_from_registry)
@@ -531,10 +567,19 @@ endmacro()
.. code-block:: cmake
- matlab_get_all_valid_matlab_roots_from_registry(matlab_versions matlab_roots)
+ matlab_get_all_valid_matlab_roots_from_registry(matlab_versions matlab_roots [REGISTRY_VIEW view])
* Input: ``matlab_versions`` of each of the Matlab or MCR installations
* Output: ``matlab_roots`` location of each of the Matlab or MCR installations
+ * Input: ``REGISTRY_VIEW`` Optional registry view to use for registry
+ interaction. The argument is passed (or omitted) to
+ :command:`cmake_host_system_information` without further checks or
+ modification.
+
+ .. versionadded:: 3.30
+ The optional ``REGISTRY_VIEW`` argument was added to provide a more precise
+ interface on how to interact with the Windows Registry.
+
#]=======================================================================]
function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_roots)
@@ -542,6 +587,15 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
# extract_matlab_versions_from_registry_brute_force or
# matlab_extract_all_installed_versions_from_registry.
+ cmake_parse_arguments(_Matlab "" "REGISTRY_VIEW" "" ${ARGN})
+ set(_registry_view_args)
+ if(_Matlab_REGISTRY_VIEW)
+ set(_registry_view_args VIEW "${_Matlab_REGISTRY_VIEW}")
+ endif()
+ if(MATLAB_FIND_DEBUG)
+ message(STATUS "[MATLAB] Getting MATLAB roots with registry view args '${_registry_view_args}'")
+ endif()
+
# Mostly the major.minor version is used in Mathworks Windows Registry keys.
# If the patch is not zero, major.minor.patch is used.
list(TRANSFORM matlab_versions REPLACE "^([0-9]+\\.[0-9]+(\\.[1-9][0-9]*)?).*" "\\1")
@@ -552,57 +606,41 @@ function(matlab_get_all_valid_matlab_roots_from_registry matlab_versions matlab_
cmake_host_system_information(RESULT current_MATLAB_ROOT
QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB/${_matlab_current_version}"
VALUE "MATLABROOT"
+ ${_registry_view_args}
)
cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
if(IS_DIRECTORY "${current_MATLAB_ROOT}")
_Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp)
if("${_matlab_version_tmp}" STREQUAL "unknown")
- list(APPEND _matlab_roots_list "MATLAB" ${_matlab_current_version} ${current_MATLAB_ROOT})
- else()
- list(APPEND _matlab_roots_list "MATLAB" ${_matlab_version_tmp} ${current_MATLAB_ROOT})
+ set(_matlab_version_tmp ${_matlab_current_version})
endif()
+ list(APPEND _matlab_roots_list "MATLAB" ${_matlab_version_tmp} ${current_MATLAB_ROOT})
endif()
endforeach()
# Check for MCR installations
- foreach(_matlab_current_version IN LISTS matlab_versions)
- cmake_host_system_information(RESULT current_MATLAB_ROOT
- QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB Runtime/${_matlab_current_version}"
- VALUE "MATLABROOT"
- )
- cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
+ foreach(_installation_type IN ITEMS "MATLAB Runtime" "MATLAB Compiler Runtime")
+ foreach(_matlab_current_version IN LISTS matlab_versions)
+ cmake_host_system_information(RESULT current_MATLAB_ROOT
+ QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/${_installation_type}/${_matlab_current_version}"
+ VALUE "MATLABROOT"
+ ${_registry_view_args}
+ )
+ cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
- # remove the dot
- string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
+ # remove the dot
+ string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
- if(IS_DIRECTORY "${current_MATLAB_ROOT}")
- _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp)
- if("${_matlab_version_tmp}" STREQUAL "unknown")
- list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
- else()
+ if(IS_DIRECTORY "${current_MATLAB_ROOT}")
+ _Matlab_VersionInfoXML("${current_MATLAB_ROOT}" _matlab_version_tmp)
+ if("${_matlab_version_tmp}" STREQUAL "unknown")
+ set(_matlab_version_tmp ${_matlab_current_version})
+ endif()
list(APPEND _matlab_roots_list "MCR" ${_matlab_version_tmp} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
endif()
- endif()
-
- endforeach()
-
- # Check for old MCR installations
- foreach(_matlab_current_version IN LISTS matlab_versions)
- cmake_host_system_information(RESULT current_MATLAB_ROOT
- QUERY WINDOWS_REGISTRY "HKLM/SOFTWARE/Mathworks/MATLAB Compiler Runtime/${_matlab_current_version}"
- VALUE "MATLABROOT"
- )
- cmake_path(CONVERT "${current_MATLAB_ROOT}" TO_CMAKE_PATH_LIST current_MATLAB_ROOT)
-
- # remove the dot
- string(REPLACE "." "" _matlab_current_version_without_dot "${_matlab_current_version}")
-
- if(IS_DIRECTORY "${current_MATLAB_ROOT}")
- list(APPEND _matlab_roots_list "MCR" ${_matlab_current_version} "${current_MATLAB_ROOT}/v${_matlab_current_version_without_dot}")
- endif()
-
+ endforeach()
endforeach()
set(${matlab_roots} ${_matlab_roots_list} PARENT_SCOPE)
endfunction()
@@ -1069,20 +1107,6 @@ endfunction()
#]=======================================================================]
function(matlab_add_mex)
- if(NOT WIN32)
- # we do not need all this on Windows
- # pthread options
- if(CMAKE_CXX_COMPILER_LOADED)
- check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD)
- elseif(CMAKE_C_COMPILER_LOADED)
- check_c_compiler_flag(-pthread HAS_MINUS_PTHREAD)
- endif()
- # we should use try_compile instead, the link flags are discarded from
- # this compiler_flag function.
- #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY)
-
- endif()
-
set(options EXECUTABLE MODULE SHARED R2017b R2018a EXCLUDE_FROM_ALL NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES)
set(oneValueArgs NAME DOCUMENTATION OUTPUT_NAME)
set(multiValueArgs LINK_TO SRC)
@@ -1099,14 +1123,27 @@ function(matlab_add_mex)
endif()
if(NOT Matlab_VERSION_STRING VERSION_LESS "9.1") # For 9.1 (R2016b) and newer, add version source file
+ # Compilers officially supported by Matlab 9.1 (R2016b):
+ # MinGW 4.9, MSVC 2012, Intel C++ 2013, Xcode 6, GCC 4.9
+ # These compilers definitely support the -w flag to suppress warnings.
+ # Other compilers (Clang) may support the -w flag and can be added here.
+ set(_Matlab_silenceable_compilers AppleClang Clang GNU Intel IntelLLVM MSVC)
+
# Add the correct version file depending on which languages are enabled in the project
if(CMAKE_C_COMPILER_LOADED)
# If C is enabled, use the .c file as it will work fine also with C++
set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/c_mexapi_version.c")
+ # Silence warnings for version source file
+ if("${CMAKE_C_COMPILER_ID}" IN_LIST _Matlab_silenceable_compilers)
+ set_source_files_properties("${MEX_VERSION_FILE}" PROPERTIES COMPILE_OPTIONS -w)
+ endif()
elseif(CMAKE_CXX_COMPILER_LOADED)
# If C is not enabled, check if CXX is enabled and use the .cpp file
# to avoid that the .c file is silently ignored
set(MEX_VERSION_FILE "${Matlab_ROOT_DIR}/extern/version/cpp_mexapi_version.cpp")
+ if("${CMAKE_CXX_COMPILER_ID}" IN_LIST _Matlab_silenceable_compilers)
+ set_source_files_properties("${MEX_VERSION_FILE}" PROPERTIES COMPILE_OPTIONS -w)
+ endif()
else()
# If neither C or CXX is enabled, warn because we cannot add the source.
# TODO: add support for fortran mex files
@@ -1237,10 +1274,8 @@ function(matlab_add_mex)
else() # Linux
- if(HAS_MINUS_PTHREAD)
- # Apparently, compiling with -pthread generated the proper link flags
- # and some defines at compilation
- target_compile_options(${${prefix}_NAME} PRIVATE "-pthread")
+ if(Threads_FOUND)
+ target_link_libraries(${${prefix}_NAME} Threads::Threads)
endif()
string(APPEND _link_flags " -Wl,--as-needed")
@@ -1433,13 +1468,7 @@ function(_Matlab_find_instances_win32 matlab_roots)
# testing if we are able to extract the needed information from the registry
set(_matlab_versions_from_registry)
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(_matlab_win64 ON)
- else()
- set(_matlab_win64 OFF)
- endif()
-
- matlab_extract_all_installed_versions_from_registry(_matlab_win64 _matlab_versions_from_registry)
+ matlab_extract_all_installed_versions_from_registry(_matlab_versions_from_registry ${ARGN})
# the returned list is empty, doing the search on all known versions
if(NOT _matlab_versions_from_registry)
@@ -1450,7 +1479,7 @@ function(_Matlab_find_instances_win32 matlab_roots)
endif()
# filtering the results with the registry keys
- matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots)
+ matlab_get_all_valid_matlab_roots_from_registry("${_matlab_versions_from_registry}" _matlab_possible_roots ${ARGN})
set(${matlab_roots} ${_matlab_possible_roots} PARENT_SCOPE)
endfunction()
@@ -1600,7 +1629,10 @@ else()
# one installation using the appropriate heuristics.
# There is apparently no standard way on Linux.
if(CMAKE_HOST_WIN32)
- _Matlab_find_instances_win32(_matlab_possible_roots_win32)
+ if(NOT DEFINED Matlab_FIND_REGISTRY_VIEW)
+ set(Matlab_FIND_REGISTRY_VIEW TARGET)
+ endif()
+ _Matlab_find_instances_win32(_matlab_possible_roots_win32 REGISTRY_VIEW ${Matlab_FIND_REGISTRY_VIEW})
list(APPEND _matlab_possible_roots ${_matlab_possible_roots_win32})
elseif(APPLE)
_Matlab_find_instances_macos(_matlab_possible_roots_macos)
@@ -1625,62 +1657,29 @@ list(LENGTH _matlab_possible_roots _numbers_of_matlab_roots)
set(Matlab_VERSION_STRING "NOTFOUND")
set(Matlab_Or_MCR "UNKNOWN")
if(_numbers_of_matlab_roots GREATER 0)
- if(Matlab_FIND_VERSION_EXACT)
- set(_list_index -1)
- foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3)
- list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version)
- # only the major.minor version is used
- string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _matlab_root_version "${_matlab_root_version}")
- if(_matlab_root_version VERSION_EQUAL Matlab_FIND_VERSION)
- set(_list_index ${_matlab_root_index})
- break()
- endif()
- endforeach()
-
- if(_list_index LESS 0)
- set(_list_index 1)
+ set(_list_index -1)
+ foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3)
+ list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version)
+ find_package_check_version(${_matlab_root_version} _matlab_version_ok HANDLE_VERSION_RANGE)
+ if(_matlab_version_ok)
+ set(_list_index ${_matlab_root_index})
+ break()
endif()
+ endforeach()
- math(EXPR _matlab_or_mcr_index "${_list_index} - 1")
- math(EXPR _matlab_root_dir_index "${_list_index} + 1")
-
- list(GET _matlab_possible_roots ${_matlab_or_mcr_index} Matlab_Or_MCR)
- list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING)
- list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR)
- elseif(DEFINED Matlab_FIND_VERSION)
- set(_list_index -1)
- foreach(_matlab_root_index RANGE 1 ${_numbers_of_matlab_roots} 3)
- list(GET _matlab_possible_roots ${_matlab_root_index} _matlab_root_version)
- if(_matlab_root_version VERSION_GREATER_EQUAL Matlab_FIND_VERSION)
- set(_list_index ${_matlab_root_index})
- break()
- endif()
- endforeach()
-
- if(_list_index LESS 0)
- set(_list_index 1)
- endif()
+ if(_list_index LESS 0)
+ set(_list_index 1)
+ endif()
- math(EXPR _matlab_or_mcr_index "${_list_index} - 1")
- math(EXPR _matlab_root_dir_index "${_list_index} + 1")
- list(GET _matlab_possible_roots ${_matlab_or_mcr_index} Matlab_Or_MCR)
- list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING)
- list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR)
- # adding a warning in case of ambiguity
- if(_numbers_of_matlab_roots GREATER 3 AND MATLAB_FIND_DEBUG)
- message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})."
- " If this is not the desired behavior, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line")
- endif()
- else()
- list(GET _matlab_possible_roots 0 Matlab_Or_MCR)
- list(GET _matlab_possible_roots 1 Matlab_VERSION_STRING)
- list(GET _matlab_possible_roots 2 Matlab_ROOT_DIR)
-
- # adding a warning in case of ambiguity
- if(_numbers_of_matlab_roots GREATER 3 AND MATLAB_FIND_DEBUG)
- message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})."
- " If this is not the desired behavior, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line")
- endif()
+ math(EXPR _matlab_or_mcr_index "${_list_index} - 1")
+ math(EXPR _matlab_root_dir_index "${_list_index} + 1")
+ list(GET _matlab_possible_roots ${_matlab_or_mcr_index} Matlab_Or_MCR)
+ list(GET _matlab_possible_roots ${_list_index} Matlab_VERSION_STRING)
+ list(GET _matlab_possible_roots ${_matlab_root_dir_index} Matlab_ROOT_DIR)
+ # adding a warning in case of ambiguity
+ if(_numbers_of_matlab_roots GREATER 3 AND NOT Matlab_FIND_VERSION_EXACT AND MATLAB_FIND_DEBUG)
+ message(WARNING "[MATLAB] Found several distributions of Matlab. Setting the current version to ${Matlab_VERSION_STRING} (located ${Matlab_ROOT_DIR})."
+ " If this is not the desired behavior, use the EXACT keyword or provide the -DMatlab_ROOT_DIR=... on the command line")
endif()
endif()
@@ -1744,12 +1743,6 @@ if(Matlab_ROOT_DIR)
file(TO_CMAKE_PATH ${Matlab_ROOT_DIR} Matlab_ROOT_DIR)
endif()
-if(CMAKE_SIZEOF_VOID_P EQUAL 4)
- set(_matlab_64Build FALSE)
-else()
- set(_matlab_64Build TRUE)
-endif()
-
if(NOT DEFINED Matlab_MEX_EXTENSION)
set(_matlab_mex_extension "")
@@ -1783,7 +1776,7 @@ endif()
set(MATLAB_INCLUDE_DIR_TO_LOOK ${Matlab_ROOT_DIR}/extern/include)
-if(_matlab_64Build)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_matlab_current_suffix ${_matlab_bin_suffix_64bits})
else()
set(_matlab_current_suffix ${_matlab_bin_suffix_32bits})
@@ -1808,11 +1801,9 @@ else()
set(_matlab_lib_prefix_for_search "lib")
endif()
-unset(_matlab_64Build)
-
if(MATLAB_FIND_DEBUG)
- message(STATUS "[MATLAB] [DEBUG]_matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}")
+ message(STATUS "[MATLAB] _matlab_lib_prefix_for_search = ${_matlab_lib_prefix_for_search} | _matlab_lib_dir_for_search = ${_matlab_lib_dir_for_search}")
endif()
@@ -2031,6 +2022,7 @@ find_package_handle_standard_args(
FOUND_VAR Matlab_FOUND
REQUIRED_VARS ${_matlab_required_variables}
VERSION_VAR Matlab_VERSION
+ HANDLE_VERSION_RANGE
HANDLE_COMPONENTS)
unset(_matlab_required_variables)
diff --git a/Modules/FindOpenACC.cmake b/Modules/FindOpenACC.cmake
index e9ca683..d5d26a1 100644
--- a/Modules/FindOpenACC.cmake
+++ b/Modules/FindOpenACC.cmake
@@ -70,9 +70,12 @@ If set, will the correct target accelerator flag set to the <target> will
be returned with OpenACC_<lang>_FLAGS.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
set(OpenACC_C_CXX_TEST_SOURCE
"
-int main(){
+int main(void){
#ifdef _OPENACC
return 0;
#else
@@ -102,7 +105,7 @@ const char accver_str[] = { 'I', 'N', 'F', 'O', ':', 'O', 'p', 'e', 'n', 'A',
('0' + ((_OPENACC/10)%10)),
('0' + ((_OPENACC/1)%10)),
']', '\\0' };
-int main()
+int main(void)
{
puts(accver_str);
return 0;
@@ -306,3 +309,5 @@ unset(OpenACC_C_CXX_TEST_SOURCE)
unset(OpenACC_Fortran_TEST_SOURCE)
unset(OpenACC_C_CXX_CHECK_VERSION_SOURCE)
unset(OpenACC_Fortran_CHECK_VERSION_SOURCE)
+
+cmake_policy(POP)
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 1d36b9b..f88e43c 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -16,8 +16,22 @@ flag to support OpenMP.
.. versionadded:: 3.5
Clang support.
-Variables
-^^^^^^^^^
+Input Variables
+^^^^^^^^^^^^^^^
+
+The following variables may be set to influence this module's behavior:
+
+``OpenMP_RUNTIME_MSVC``
+ .. versionadded:: 3.30
+
+ Specify the `OpenMP Runtime <msvc-openmp_>`_ when compiling with MSVC.
+ If set to a non-empty value, such as ``experimental`` or ``llvm``, it
+ will be passed as the value of the ``-openmp:`` flag.
+
+.. _`msvc-openmp`: https://learn.microsoft.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support
+
+Result Variables
+^^^^^^^^^^^^^^^^
.. versionadded:: 3.10
The module exposes the components ``C``, ``CXX``, and ``Fortran``.
@@ -96,6 +110,7 @@ cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW) # if() recognizes numbers and booleans
cmake_policy(SET CMP0054 NEW) # if() quoted variables not dereferenced
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
function(_OPENMP_FLAG_CANDIDATES LANG)
if(NOT OpenMP_${LANG}_FLAG)
@@ -120,7 +135,11 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
else()
set(OMP_FLAG_IntelLLVM "-fiopenmp")
endif()
- set(OMP_FLAG_MSVC "-openmp")
+ if(OpenMP_RUNTIME_MSVC)
+ set(OMP_FLAG_MSVC "-openmp:${OpenMP_RUNTIME_MSVC}")
+ else()
+ set(OMP_FLAG_MSVC "-openmp")
+ endif()
set(OMP_FLAG_PathScale "-openmp")
set(OMP_FLAG_NAG "-openmp")
set(OMP_FLAG_Absoft "-openmp")
diff --git a/Modules/FindOpenSP.cmake b/Modules/FindOpenSP.cmake
index 25d0e6f..4255aef 100644
--- a/Modules/FindOpenSP.cmake
+++ b/Modules/FindOpenSP.cmake
@@ -63,6 +63,9 @@ The following cache variables may also be set:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_package(PkgConfig QUIET)
if (PkgConfig_FOUND)
pkg_check_modules(PC_OpenSP QUIET opensp)
@@ -158,3 +161,5 @@ set_package_properties(OpenSP PROPERTIES
URL "http://openjade.sourceforge.net/doc/index.htm"
DESCRIPTION "An SGML System Conforming to International Standard ISO 8879"
)
+
+cmake_policy(POP)
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 057a8d1..01b18f3 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -111,6 +111,9 @@ The following variables may be set to control search behavior:
locations. Useful on multi-lib systems.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
unset(_OpenSSL_extra_static_deps)
if(UNIX AND
@@ -796,3 +799,5 @@ unset(_OpenSSL_extra_static_deps)
unset(_OpenSSL_has_dependency_dl)
unset(_OpenSSL_has_dependency_threads)
unset(_OpenSSL_has_dependency_zlib)
+
+cmake_policy(POP)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 27909bc..9df2a62 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -101,6 +101,9 @@ This module defines the following output variables:
target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
#
# Naming convention:
# Local variables of the form _osg_foo
@@ -230,3 +233,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph
unset(_osg_component_founds)
set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR})
+
+cmake_policy(POP)
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index 043b69c..4294326 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -48,6 +48,9 @@ Since PNG depends on the ZLib compression library, none of the above
will be defined unless ZLib can be found.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Default install location on windows when installing from included cmake build
# From FindZLIB.cmake
set(_PNG_x86 "(x86)")
@@ -177,3 +180,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(PNG
REQUIRED_VARS PNG_LIBRARY PNG_PNG_INCLUDE_DIR
VERSION_VAR PNG_VERSION_STRING)
+
+cmake_policy(POP)
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index 63b2bf2..c6db433 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -225,6 +225,9 @@ macro(_FPHSA_FAILURE_MESSAGE _msg)
set (__msg "${_msg}")
if (FPHSA_REASON_FAILURE_MESSAGE)
string(APPEND __msg "\n Reason given by package: ${FPHSA_REASON_FAILURE_MESSAGE}\n")
+ elseif(NOT DEFINED PROJECT_NAME)
+ string(APPEND __msg "\n"
+ "Hint: The project() command has not yet been called. It sets up system-specific search paths.")
endif()
if (${_NAME}_FIND_REQUIRED)
message(FATAL_ERROR "${__msg}")
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index f3bacc3..450acf4 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -158,6 +158,17 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
endif()
+ # pkg-config <0.29.1 and pkgconf <1.5.1 prints quoted variables without unquoting
+ # unquote only if quotes are first and last characters
+ if((PKG_CONFIG_VERSION_STRING VERSION_LESS 0.29.1) OR
+ (PKG_CONFIG_VERSION_STRING VERSION_GREATER_EQUAL 1.0 AND PKG_CONFIG_VERSION_STRING VERSION_LESS 1.5.1))
+ if (_pkgconfig_invoke_result MATCHES "^\"(.*)\"$")
+ set(_pkgconfig_invoke_result "${CMAKE_MATCH_1}")
+ elseif(_pkgconfig_invoke_result MATCHES "^'(.*)'$")
+ set(_pkgconfig_invoke_result "${CMAKE_MATCH_1}")
+ endif()
+ endif()
+
# pkg-config can represent "spaces within an argument" by backslash-escaping the space.
# UNIX_COMMAND mode treats backslash-escaped spaces as "not a space that delimits arguments".
separate_arguments(_pkgconfig_invoke_result UNIX_COMMAND "${_pkgconfig_invoke_result}")
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 84bc1ed..1984e18 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -93,6 +93,7 @@ is set regardless of the presence of the ``Server`` component in find_package ca
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include")
set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}")
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index a7ee0c4..8ad3270 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -218,6 +218,9 @@ Example:
GENERATE_EXTENSIONS .grpc.pb.h .grpc.pb.cc)
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
function(protobuf_generate)
set(_options APPEND_PATH DESCRIPTORS)
set(_singleargs LANGUAGE OUT_VAR EXPORT_MACRO PROTOC_OUT_DIR PLUGIN PLUGIN_OPTIONS DEPENDENCIES)
@@ -782,3 +785,5 @@ foreach(Camel
string(TOUPPER ${Camel} UPPER)
set(${UPPER} ${${Camel}})
endforeach()
+
+cmake_policy(POP)
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 08ab9c0..410b736 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -20,6 +20,8 @@ cmake_policy (SET CMP0057 NEW)
cmake_policy (SET CMP0124 NEW)
# registry view behavior
cmake_policy (SET CMP0134 NEW)
+# file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+cmake_policy(SET CMP0159 NEW)
if (NOT DEFINED _PYTHON_PREFIX)
message (FATAL_ERROR "FindPython: INTERNAL ERROR")
@@ -3782,6 +3784,14 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
endif()
endif()
+ # Workaround Intel MKL library outputting a message in stdout, which cause
+ # incorrect detection of numpy.get_include() and numpy.__version__
+ # See https://github.com/numpy/numpy/issues/23775
+ if(DEFINED ENV{MKL_ENABLE_INSTRUCTIONS})
+ set(_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS ENV{MKL_ENABLE_INSTRUCTIONS})
+ endif()
+ set(ENV{MKL_ENABLE_INSTRUCTIONS} "SSE4_2")
+
if (NOT _${_PYTHON_PREFIX}_NumPy_INCLUDE_DIR)
execute_process(COMMAND ${${_PYTHON_PREFIX}_INTERPRETER_LAUNCHER} "${_${_PYTHON_PREFIX}_EXECUTABLE}" -c
"import sys\ntry: import numpy; sys.stdout.write(numpy.get_include())\nexcept:pass\n"
@@ -3822,6 +3832,14 @@ if ("NumPy" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS AND ${_PYTHON_PREFIX}_Inte
set (${_PYTHON_PREFIX}_NumPy_FOUND FALSE)
endif()
+ # Restore previous value of MKL_ENABLE_INSTRUCTIONS
+ if(DEFINED _${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
+ set(ENV{MKL_ENABLE_INSTRUCTIONS} ${_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS})
+ unset(_${_PYTHON_PREFIX}_BACKUP_ENV_VAR_MKL_ENABLE_INSTRUCTIONS)
+ else()
+ unset(ENV{MKL_ENABLE_INSTRUCTIONS})
+ endif()
+
if (${_PYTHON_PREFIX}_NumPy_FOUND)
unset (_${_PYTHON_PREFIX}_NumPy_REASON_FAILURE CACHE)
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index b13d96b..112adae 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -48,6 +48,9 @@ get the currently active Python version by default with a consistent version
of PYTHON_LIBRARIES.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
cmake_policy(GET CMP0148 _FindPythonLibs_CMP0148)
if(_FindPythonLibs_CMP0148 STREQUAL "NEW")
message(FATAL_ERROR "The FindPythonLibs module has been removed by policy CMP0148.")
@@ -55,6 +58,7 @@ endif()
if(_FindPythonLibs_testing)
set(_FindPythonLibs_included TRUE)
+ cmake_policy(POP)
return()
endif()
@@ -410,3 +414,5 @@ extern \"C\" {
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
endfunction()
+
+cmake_policy(POP)
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index da82e59..5a0037c 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -34,6 +34,9 @@ Also defined, but not for general use are:
library. This is only required by Qt3 on Windows.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# These are around for backwards compatibility
# they will be set
# QT_WRAP_CPP, set true if QT_MOC_EXECUTABLE is found
@@ -47,6 +50,7 @@ if(QT4_FOUND)
if(NOT Qt3_FIND_QUIETLY)
message( STATUS "Qt3 and Qt4 cannot be used together in one project.")
endif()
+ cmake_policy(POP)
return()
endif()
endif()
@@ -304,3 +308,5 @@ mark_as_advanced(
QT_WRAP_CPP
QT_WRAP_UI
)
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake
index 7691eb7..a4c8668 100644
--- a/Modules/FindSDL.cmake
+++ b/Modules/FindSDL.cmake
@@ -110,6 +110,9 @@ This needed to change because "proper" SDL convention is #include
because not all systems place things in SDL/ (see FreeBSD).
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(SDL_INCLUDE_DIR SDL.h
HINTS
ENV SDLDIR
@@ -235,3 +238,5 @@ if(SDL_FOUND)
INTERFACE_LINK_LIBRARIES "${SDL_LIBRARY}")
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_gfx.cmake b/Modules/FindSDL_gfx.cmake
index 2dd96e9..82c2039 100644
--- a/Modules/FindSDL_gfx.cmake
+++ b/Modules/FindSDL_gfx.cmake
@@ -24,6 +24,9 @@ This module defines:
``./configure --prefix=$SDLDIR`` used in building SDL.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
find_path(SDL_GFX_INCLUDE_DIRS
NAMES
SDL_framerate.h
@@ -84,3 +87,5 @@ if(SDL_gfx_FOUND)
INTERFACE_LINK_LIBRARIES "${SDL_GFX_LIBRARIES}")
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_image.cmake b/Modules/FindSDL_image.cmake
index 324fef5..33a0695 100644
--- a/Modules/FindSDL_image.cmake
+++ b/Modules/FindSDL_image.cmake
@@ -33,6 +33,9 @@ $SDLDIR is an environment variable that would correspond to the
./configure --prefix=$SDLDIR used in building SDL.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(NOT SDL_IMAGE_INCLUDE_DIR AND SDLIMAGE_INCLUDE_DIR)
set(SDL_IMAGE_INCLUDE_DIR ${SDLIMAGE_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
@@ -95,3 +98,5 @@ set(SDLIMAGE_INCLUDE_DIR ${SDL_IMAGE_INCLUDE_DIRS})
set(SDLIMAGE_FOUND ${SDL_IMAGE_FOUND})
mark_as_advanced(SDL_IMAGE_LIBRARY SDL_IMAGE_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_mixer.cmake b/Modules/FindSDL_mixer.cmake
index 8ed3cb4..f48015e 100644
--- a/Modules/FindSDL_mixer.cmake
+++ b/Modules/FindSDL_mixer.cmake
@@ -33,6 +33,9 @@ $SDLDIR is an environment variable that would correspond to the
./configure --prefix=$SDLDIR used in building SDL.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(NOT SDL_MIXER_INCLUDE_DIR AND SDLMIXER_INCLUDE_DIR)
set(SDL_MIXER_INCLUDE_DIR ${SDLMIXER_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
@@ -95,3 +98,5 @@ set(SDLMIXER_INCLUDE_DIR ${SDL_MIXER_INCLUDE_DIRS})
set(SDLMIXER_FOUND ${SDL_MIXER_FOUND})
mark_as_advanced(SDL_MIXER_LIBRARY SDL_MIXER_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_net.cmake b/Modules/FindSDL_net.cmake
index 639e5bd..9d0b949 100644
--- a/Modules/FindSDL_net.cmake
+++ b/Modules/FindSDL_net.cmake
@@ -32,6 +32,9 @@ $SDLDIR is an environment variable that would correspond to the
./configure --prefix=$SDLDIR used in building SDL.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(NOT SDL_NET_INCLUDE_DIR AND SDLNET_INCLUDE_DIR)
set(SDL_NET_INCLUDE_DIR ${SDLNET_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
@@ -94,3 +97,5 @@ set(SDLNET_INCLUDE_DIR ${SDL_NET_INCLUDE_DIRS})
set(SDLNET_FOUND ${SDL_NET_FOUND})
mark_as_advanced(SDL_NET_LIBRARY SDL_NET_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake
index 3443959..50b4b55 100644
--- a/Modules/FindSDL_sound.cmake
+++ b/Modules/FindSDL_sound.cmake
@@ -84,6 +84,9 @@ parses the error output for known symbol names to figure out which
libraries are needed.
#]]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
set(SDL_SOUND_EXTRAS "" CACHE STRING "SDL_sound extra flags")
mark_as_advanced(SDL_SOUND_EXTRAS)
@@ -371,3 +374,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL_sound
REQUIRED_VARS SDL_SOUND_LIBRARY SDL_SOUND_INCLUDE_DIR
VERSION_VAR SDL_SOUND_VERSION_STRING)
+
+cmake_policy(POP)
diff --git a/Modules/FindSDL_ttf.cmake b/Modules/FindSDL_ttf.cmake
index d67c089..8f3b02a 100644
--- a/Modules/FindSDL_ttf.cmake
+++ b/Modules/FindSDL_ttf.cmake
@@ -32,6 +32,9 @@ $SDLDIR is an environment variable that would correspond to the
./configure --prefix=$SDLDIR used in building SDL.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(NOT SDL_TTF_INCLUDE_DIR AND SDLTTF_INCLUDE_DIR)
set(SDL_TTF_INCLUDE_DIR ${SDLTTF_INCLUDE_DIR} CACHE PATH "directory cache
entry initialized from old variable name")
@@ -94,3 +97,5 @@ set(SDLTTF_INCLUDE_DIR ${SDL_TTF_INCLUDE_DIRS})
set(SDLTTF_FOUND ${SDL_TTF_FOUND})
mark_as_advanced(SDL_TTF_LIBRARY SDL_TTF_INCLUDE_DIR)
+
+cmake_policy(POP)
diff --git a/Modules/FindSQLite3.cmake b/Modules/FindSQLite3.cmake
index 88c7dd2..308a444 100644
--- a/Modules/FindSQLite3.cmake
+++ b/Modules/FindSQLite3.cmake
@@ -32,12 +32,24 @@ This module will set the following variables if found:
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_SQLite3 QUIET sqlite3)
+
# Look for the necessary header
-find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
+find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h
+ HINTS
+ ${PC_SQLite3_INCLUDE_DIRS}
+)
mark_as_advanced(SQLite3_INCLUDE_DIR)
# Look for the necessary library
-find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
+find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite
+ HINTS
+ ${PC_SQLite3_LIBRARY_DIRS}
+)
mark_as_advanced(SQLite3_LIBRARY)
# Extract version information from the header file
@@ -66,3 +78,5 @@ if(SQLite3_FOUND)
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 370fff0..3104b2c 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -58,6 +58,50 @@ optional Fortran support:
#]=======================================================================]
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+
+function(_swig_get_version _swig_executable _swig_version)
+ unset(${_swig_version} PARENT_SCOPE)
+ # Determine SWIG version
+ execute_process(COMMAND "${_swig_executable}" -version
+ OUTPUT_VARIABLE _swig_output
+ ERROR_VARIABLE _swig_output
+ RESULT_VARIABLE _swig_result)
+ if(_swig_result)
+ set_property (CACHE _SWIG_REASON_FAILURE PROPERTY VALUE "Cannot use the executable \"${_swig_executable}\"")
+ if (_swig_output)
+ set_property (CACHE _SWIG_REASON_FAILURE APPEND_STRING PROPERTY VALUE ": ${_swig_output}")
+ endif()
+ else()
+ string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
+ _swig_output "${_swig_output}")
+ set(${_swig_version} ${_swig_output} PARENT_SCOPE)
+ endif()
+endfunction()
+
+function(_swig_validate_find_executable status executable)
+ _swig_get_version("${executable}" _swig_find_version)
+ if(NOT _swig_find_version)
+ # executable is unusable
+ set (${status} FALSE PARENT_SCOPE)
+ return()
+ endif()
+ if(NOT SWIG_FIND_VERSION)
+ return()
+ endif()
+
+ find_package_check_version(${_swig_find_version} _swig_version_is_valid HANDLE_VERSION_RANGE)
+ if(_swig_version_is_valid)
+ unset(_SWIG_REASON_FAILURE CACHE)
+ else()
+ set (${status} FALSE PARENT_SCOPE)
+ set_property (CACHE _SWIG_REASON_FAILURE PROPERTY VALUE "Could NOT find SWIG: Found unsuitable version \"${_swig_find_version}\" for the executable \"${executable}\"")
+ endif()
+endfunction()
+
+unset (_SWIG_REASON_FAILURE)
+set (_SWIG_REASON_FAILURE CACHE INTERNAL "SWIG reason failure")
+
# compute list of possible names
unset (_SWIG_NAMES)
if (SWIG_FIND_VERSION_RANGE)
@@ -86,7 +130,8 @@ if (NOT _SWIG_NAMES)
set (_SWIG_NAMES swig4.0 swig3.0 swig2.0)
endif()
-find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig)
+find_program(SWIG_EXECUTABLE NAMES ${_SWIG_NAMES} swig NAMES_PER_DIR
+ VALIDATOR _swig_validate_find_executable)
unset(_SWIG_NAMES)
if(SWIG_EXECUTABLE AND NOT SWIG_DIR)
@@ -115,17 +160,8 @@ endif()
if(SWIG_EXECUTABLE AND SWIG_DIR AND NOT SWIG_VERSION)
# Determine SWIG version
- execute_process(COMMAND "${SWIG_EXECUTABLE}" -version
- OUTPUT_VARIABLE _swig_output
- ERROR_VARIABLE _swig_output
- RESULT_VARIABLE _swig_result)
- if(_swig_result)
- message(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -version\" failed with output:\n${_swig_output}")
- else()
- string(REGEX REPLACE ".*SWIG Version[^0-9.]*\([0-9.]+\).*" "\\1"
- _swig_output "${_swig_output}")
- set(SWIG_VERSION ${_swig_output} CACHE STRING "Swig version" FORCE)
- endif()
+ _swig_get_version("${SWIG_EXECUTABLE}" _swig_output)
+ set(SWIG_VERSION ${_swig_output} CACHE STRING "Swig version" FORCE)
endif()
if(SWIG_EXECUTABLE AND SWIG_FIND_COMPONENTS)
@@ -145,16 +181,18 @@ if(SWIG_EXECUTABLE AND SWIG_FIND_COMPONENTS)
endif()
endif()
-unset(_swig_output)
-unset(_swig_error)
-unset(_swig_result)
-
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
find_package_handle_standard_args(
SWIG HANDLE_COMPONENTS
REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
VERSION_VAR SWIG_VERSION
- HANDLE_VERSION_RANGE)
+ HANDLE_VERSION_RANGE
+ FAIL_MESSAGE "${_SWIG_REASON_FAILURE}")
+
+unset(_swig_output)
+unset(_swig_error)
+unset(_swig_result)
+
+unset(_SWIG_REASON_FAILURE CACHE)
if(SWIG_FOUND)
set(SWIG_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseSWIG.cmake")
diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake
index fe1e94e..27beaa0 100644
--- a/Modules/FindTIFF.cmake
+++ b/Modules/FindTIFF.cmake
@@ -67,6 +67,7 @@ The following cache variables may also be set:
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
set(_TIFF_args)
if (TIFF_FIND_VERSION)
diff --git a/Modules/FindVulkan.cmake b/Modules/FindVulkan.cmake
index 0f45b63..2262119 100644
--- a/Modules/FindVulkan.cmake
+++ b/Modules/FindVulkan.cmake
@@ -221,6 +221,7 @@ environment.
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# Provide compatibility with a common invalid component request that
# was silently ignored prior to CMake 3.24.
diff --git a/Modules/FindXalanC.cmake b/Modules/FindXalanC.cmake
index a7fb766..338d0c0 100644
--- a/Modules/FindXalanC.cmake
+++ b/Modules/FindXalanC.cmake
@@ -44,6 +44,9 @@ The following cache variables may also be set:
the Xalan library
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Written by Roger Leigh <rleigh@codelibre.net>
function(_XalanC_GET_VERSION version_hdr)
@@ -153,3 +156,5 @@ if(XalanC_FOUND)
set_target_properties(XalanC::XalanC PROPERTIES INTERFACE_LINK_LIBRARIES XercesC::XercesC)
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake
index d39bbf6..ee6a401 100644
--- a/Modules/FindXercesC.cmake
+++ b/Modules/FindXercesC.cmake
@@ -47,6 +47,9 @@ The following cache variables may also be set:
Debug and Release variants are found separately.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Written by Roger Leigh <rleigh@codelibre.net>
function(_XercesC_GET_VERSION version_hdr)
@@ -149,3 +152,5 @@ if(XercesC_FOUND)
endif()
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 4e7d5d6..0842f4c 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -84,6 +84,9 @@ module where to look.
#]=======================================================================]
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(ZLIB_FIND_COMPONENTS AND NOT ZLIB_FIND_QUIETLY)
message(AUTHOR_WARNING
"ZLIB does not provide any COMPONENTS. Calling\n"
@@ -232,3 +235,5 @@ if(ZLIB_FOUND)
endif()
endif()
endif()
+
+cmake_policy(POP)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index a0f1862..2e8e14f 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -113,11 +113,15 @@ target_link_libraries(FortranCInterface PUBLIC symbols)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options(FortranCInterface PRIVATE "-fno-lto")
- target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+ if(NOT APPLE)
+ target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+ endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
- target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
+ if(NOT APPLE)
+ target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
+ endif()
endif()
file(GENERATE OUTPUT exe-$<CONFIG>.cmake CONTENT [[
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index d65c865..c975a4b 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -76,8 +76,11 @@ endif()
# Load symbols from INFO:symbol[] strings in the executable.
set(FortranCInterface_SYMBOLS)
if(FortranCInterface_EXE)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${FortranCInterface_EXE}" _info_strings
LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
+ cmake_policy(POP)
foreach(info ${_info_strings})
if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index 9fdc783..c959168 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -210,8 +210,8 @@ endmacro()
# TODO: Install this macro separately?
macro(_check_c_compiler_attribute _ATTRIBUTE _RESULT)
- check_source_compiles(C "${_ATTRIBUTE} int somefunc() { return 0; }
- int main() { return somefunc();}" ${_RESULT}
+ check_source_compiles(C "${_ATTRIBUTE} int somefunc(void) { return 0; }
+ int main(void) { return somefunc();}" ${_RESULT}
)
endmacro()
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake
index b62f839..e187804 100644
--- a/Modules/GoogleTest.cmake
+++ b/Modules/GoogleTest.cmake
@@ -347,16 +347,51 @@ function(gtest_add_tests)
unset(testList)
- set(gtest_case_name_regex ".*\\( *([A-Za-z_0-9]+) *, *([A-Za-z_0-9]+) *\\).*")
+ set(gtest_case_name_regex ".*\\([ \r\n\t]*([A-Za-z_0-9]+)[ \r\n\t]*,[ \r\n\t]*([A-Za-z_0-9]+)[ \r\n\t]*\\).*")
set(gtest_test_type_regex "(TYPED_TEST|TEST)_?[FP]?")
+ set(each_line_regex "([^\r\n]*[\r\n])")
foreach(source IN LISTS ARGS_SOURCES)
if(NOT ARGS_SKIP_DEPENDENCY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${source})
endif()
file(READ "${source}" contents)
- string(REGEX MATCHALL "${gtest_test_type_regex} *\\(([A-Za-z_0-9 ,]+)\\)" found_tests "${contents}")
- foreach(hit ${found_tests})
+ # Replace characters in file content that are special to CMake
+ string(REPLACE "[" "<OPEN_BRACKET>" contents "${contents}")
+ string(REPLACE "]" "<CLOSE_BRACKET>" contents "${contents}")
+ string(REPLACE ";" "\\;" contents "${contents}")
+ # Split into lines
+ string(REGEX MATCHALL "${each_line_regex}" content_lines "${contents}")
+ set(line "0")
+ # Stores the line number of the start of a test definition
+ set(accumulate_line "0")
+ # Stores accumulated lines to match multi-line test definitions
+ set(accumulated "")
+ # Iterate over each line in the file so that we know the line number of a test definition
+ foreach(line_str IN LISTS content_lines)
+ MATH(EXPR line "${line}+1")
+ # Check if the current line is the start of a test definition
+ string(REGEX MATCH "[ \t]*${gtest_test_type_regex}[ \t]*[\\(]*" accumlate_start_hit "${line_str}")
+ if(accumlate_start_hit)
+ set(accumulate_line "${line}")
+ endif()
+ # Append the current line to the accumulated string
+ set(accumulated "${accumulated}${line_str}")
+ # Attempt to match a complete test definition in the accumulated string
+ string(REGEX MATCH "${gtest_test_type_regex}[ \r\n\t]*\\(([A-Za-z_0-9 ,\r\n\t]+)\\)" hit "${accumulated}")
+ if(hit)
+ # Reset accumulated for the next match
+ set(accumulated "")
+ else()
+ # Continue accumulating lines
+ continue()
+ endif()
+ # At this point, the start line of the test definition is known
+ # Hence, we can set the test's DEF_SOURCE_LINE property with
+ # ${source}:${accumulate_line} below.
+ # VS Code CMake Tools extension looks for DEF_SOURCE_LINE
+ # to locate the test definition for its "Go to test" feature.
+
string(REGEX MATCH "${gtest_test_type_regex}" test_type ${hit})
# Parameterized tests have a different signature for the filter
@@ -394,7 +429,8 @@ function(gtest_add_tests)
--gtest_filter=${gtest_test_name}
${ARGS_EXTRA_ARGS}
)
- set_tests_properties(${ctest_test_name} PROPERTIES DISABLED TRUE)
+ set_tests_properties(${ctest_test_name} PROPERTIES DISABLED TRUE
+ DEF_SOURCE_LINE "${source}:${accumulate_line}")
list(APPEND testList ${ctest_test_name})
endif()
else()
@@ -410,6 +446,7 @@ function(gtest_add_tests)
${ctest_test_name}
PROPERTIES
SKIP_REGULAR_EXPRESSION "\\[ SKIPPED \\]"
+ DEF_SOURCE_LINE "${source}:${accumulate_line}"
)
list(APPEND testList ${ctest_test_name})
endif()
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 55a621c..5a78e3f 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -487,7 +487,7 @@ function(cpack_deb_prepare_package_vars)
if(DEFINED ${_component_var})
set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}")
if(CPACK_DEBIAN_PACKAGE_DEBUG)
- message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} "
+ message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' ${value_type_} "
"value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'")
endif()
endif()
diff --git a/Modules/Internal/CPack/CPackWIX.cmake b/Modules/Internal/CPack/CPackWIX.cmake
index 5fe772e..103d21c 100644
--- a/Modules/Internal/CPack/CPackWIX.cmake
+++ b/Modules/Internal/CPack/CPackWIX.cmake
@@ -5,18 +5,24 @@ if(NOT CPACK_WIX_ROOT)
string(REPLACE "\\" "/" CPACK_WIX_ROOT "$ENV{WIX}")
endif()
-find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
- PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+if(CPACK_WIX_VERSION VERSION_GREATER_EQUAL 4)
+ find_program(CPACK_WIX_EXECUTABLE NAMES wix
+ PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+ if(NOT CPACK_WIX_EXECUTABLE)
+ message(FATAL_ERROR "Could not find the 'wix' executable.")
+ endif()
+else()
+ find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
+ PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+ if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
+ message(FATAL_ERROR "Could not find the WiX candle executable.")
+ endif()
-if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
- message(FATAL_ERROR "Could not find the WiX candle executable.")
-endif()
-
-find_program(CPACK_WIX_LIGHT_EXECUTABLE light
- PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
-
-if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
- message(FATAL_ERROR "Could not find the WiX light executable.")
+ find_program(CPACK_WIX_LIGHT_EXECUTABLE light
+ PATHS "${CPACK_WIX_ROOT}" PATH_SUFFIXES "bin")
+ if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
+ message(FATAL_ERROR "Could not find the WiX light executable.")
+ endif()
endif()
if(NOT DEFINED CPACK_WIX_INSTALL_SCOPE)
diff --git a/Modules/Internal/CPack/WIX-v3/WIX.template.in b/Modules/Internal/CPack/WIX-v3/WIX.template.in
new file mode 100644
index 0000000..71ec5b2
--- /dev/null
+++ b/Modules/Internal/CPack/WIX-v3/WIX.template.in
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?include "cpack_variables.wxi"?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"@CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
+ RequiredVersion="3.6.3303.0">
+
+ <Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
+ Name="$(var.CPACK_PACKAGE_NAME)"
+ Language="1033"
+ Version="$(var.CPACK_PACKAGE_VERSION)"
+ Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
+ UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
+
+
+ <?if $(var.CPACK_WIX_INSTALL_SCOPE) = "NONE" ?>
+ <Package InstallerVersion="301" Compressed="yes"/>
+ <?else?>
+ <Package InstallerVersion="301" Compressed="yes" InstallScope="$(var.CPACK_WIX_INSTALL_SCOPE)"/>
+ <?endif?>
+
+ <Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
+
+ <MajorUpgrade
+ Schedule="afterInstallInitialize"
+ AllowSameVersionUpgrades="yes"
+ DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
+
+ <WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
+
+ <?ifdef CPACK_WIX_PRODUCT_ICON?>
+ <Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
+ <Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
+ <?endif?>
+
+ <?ifdef CPACK_WIX_UI_BANNER?>
+ <WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
+ <?endif?>
+
+ <?ifdef CPACK_WIX_UI_DIALOG?>
+ <WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
+ <?endif?>
+
+ <FeatureRef Id="ProductFeature"/>
+
+ <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+
+ <?include "properties.wxi"?>
+ <?include "product_fragment.wxi"?>
+ </Product>
+</Wix>
diff --git a/Modules/Internal/CPack/WIX.template.in b/Modules/Internal/CPack/WIX.template.in
index 95ba7fa..7cad186 100644
--- a/Modules/Internal/CPack/WIX.template.in
+++ b/Modules/Internal/CPack/WIX.template.in
@@ -2,22 +2,22 @@
<?include "cpack_variables.wxi"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" @CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
- RequiredVersion="3.6.3303.0">
+<Wix
+ xmlns="http://wixtoolset.org/schemas/v4/wxs"@CPACK_WIX_CUSTOM_XMLNS_EXPANDED@
+ RequiredVersion="4.0"
+ >
- <Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
+ <Package
Name="$(var.CPACK_PACKAGE_NAME)"
- Language="1033"
Version="$(var.CPACK_PACKAGE_VERSION)"
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
- UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
-
-
- <?if $(var.CPACK_WIX_INSTALL_SCOPE) = "NONE" ?>
- <Package InstallerVersion="301" Compressed="yes"/>
- <?else?>
- <Package InstallerVersion="301" Compressed="yes" InstallScope="$(var.CPACK_WIX_INSTALL_SCOPE)"/>
- <?endif?>
+ UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)"
+ ProductCode="$(var.CPACK_WIX_PRODUCT_GUID)"
+ Scope="$(var.CPACK_WIX_INSTALL_SCOPE)"
+ InstallerVersion="500"
+ Language="1033"
+ Compressed="yes"
+ >
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
@@ -30,7 +30,7 @@
<Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
<?ifdef CPACK_WIX_PRODUCT_ICON?>
- <Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
+ <Property Id="ARPPRODUCTICON" Value="ProductIcon.ico" />
<Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
<?endif?>
@@ -44,10 +44,10 @@
<FeatureRef Id="ProductFeature"/>
- <UIRef Id="$(var.CPACK_WIX_UI_REF)" />
+ <ui:WixUI Id="$(var.CPACK_WIX_UI_REF)" />
<UIRef Id="WixUI_ErrorProgressText" />
<?include "properties.wxi"?>
<?include "product_fragment.wxi"?>
- </Product>
+ </Package>
</Wix>
diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake
index c2bd14f..64d477b 100644
--- a/Modules/Internal/FeatureTesting.cmake
+++ b/Modules/Internal/FeatureTesting.cmake
@@ -52,8 +52,11 @@ macro(_record_compiler_features lang compile_flags feature_list)
if (_result EQUAL 0)
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin"
features REGEX "${lang}_FEATURE:.*")
+ cmake_policy(POP)
foreach(info ${features})
string(REPLACE "${lang}_FEATURE:" "" info ${info})
string(SUBSTRING ${info} 0 1 has_feature)
diff --git a/Modules/KDE3Macros.cmake b/Modules/KDE3Macros.cmake
index 1c353ba..42f6d2c 100644
--- a/Modules/KDE3Macros.cmake
+++ b/Modules/KDE3Macros.cmake
@@ -213,7 +213,10 @@ macro(KDE3_AUTOMOC)
if (EXISTS ${_abs_FILE} AND NOT _skip)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS ${_abs_FILE} _match REGEX "#include +[^ ]+\\.moc[\">]")
+ cmake_policy(POP)
get_filename_component(_abs_PATH ${_abs_FILE} PATH)
diff --git a/Modules/Platform/AIX/ExportImportList b/Modules/Platform/AIX/ExportImportList
index 5e16fcb..7c269fd 100755
--- a/Modules/Platform/AIX/ExportImportList
+++ b/Modules/Platform/AIX/ExportImportList
@@ -63,7 +63,7 @@ if test -z "$no_objects"; then
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
}
- /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
+ /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|tdata|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
print $NF V[$(NF-1)]
}
diff --git a/Modules/Platform/Android-Determine.cmake b/Modules/Platform/Android-Determine.cmake
index 307e4c9..cecdde8 100644
--- a/Modules/Platform/Android-Determine.cmake
+++ b/Modules/Platform/Android-Determine.cmake
@@ -32,6 +32,7 @@ endif()
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # if IN_LIST
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
# If using Android tools for Visual Studio, compile a sample project to get the
# NDK path and set the processor from the generator platform.
diff --git a/Modules/Platform/Android/Determine-Compiler-NDK.cmake b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
index a4d67c4..4e58d69 100644
--- a/Modules/Platform/Android/Determine-Compiler-NDK.cmake
+++ b/Modules/Platform/Android/Determine-Compiler-NDK.cmake
@@ -46,6 +46,9 @@ endif()
# -target <triple>
# -gcc-toolchain <ndk>/toolchains/<triple-or-arch>-<gcc-version>
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
# Glob available toolchains in the NDK, restricted by any version request.
if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION STREQUAL "clang")
set(_ANDROID_TOOL_PATTERNS "*-clang" "*-clang[0-9].[0-9]")
@@ -269,3 +272,5 @@ unset(_ANDROID_TOOL_PREFIX)
unset(_ANDROID_TOOL_CLANG_NAME)
unset(_ANDROID_TOOL_CLANG_VERS)
unset(_ANDROID_TOOL_LLVM_NAME)
+
+cmake_policy(POP)
diff --git a/Modules/Platform/Apple-Apple-Swift.cmake b/Modules/Platform/Apple-Apple-Swift.cmake
index 237f6e4..9f27efa 100644
--- a/Modules/Platform/Apple-Apple-Swift.cmake
+++ b/Modules/Platform/Apple-Apple-Swift.cmake
@@ -7,8 +7,11 @@ if("${CMAKE_GENERATOR}" STREQUAL Xcode)
set(CMAKE_Swift_USING_LINKER_APPLE_CLASSIC "-fuse-ld=ld" "LINKER:-ld_classic")
set(CMAKE_Swift_USING_LINKER_LLD "-fuse-ld=lld")
set(CMAKE_Swift_USING_LINKER_SYSTEM "-fuse-ld=ld")
+ set(CMAKE_SHARED_MODULE_LOADER_Swift_FLAG "-Wl,-bundle_loader,")
else()
set(CMAKE_Swift_USING_LINKER_APPLE_CLASSIC "-use-ld=ld" "LINKER:-ld_classic")
set(CMAKE_Swift_USING_LINKER_LLD "-use-ld=lld")
set(CMAKE_Swift_USING_LINKER_SYSTEM "-use-ld=ld")
+ set(CMAKE_SHARED_MODULE_LOADER_Swift_FLAG "-Xclang-linker -Wl,-bundle_loader,")
+ set(CMAKE_SHARED_MODULE_CREATE_Swift_FLAGS "-Xlinker -bundle")
endif()
diff --git a/Modules/Platform/Apple-NAG-Fortran.cmake b/Modules/Platform/Apple-NAG-Fortran.cmake
index 8d3e741..828d7ab 100644
--- a/Modules/Platform/Apple-NAG-Fortran.cmake
+++ b/Modules/Platform/Apple-NAG-Fortran.cmake
@@ -3,12 +3,17 @@
set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
-# Need -fpp explicitly on case-insensitive filesystem.
-set(CMAKE_Fortran_COMPILE_OBJECT
- "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE>")
+# FIXME(#25900): We need -fpp explicitly on case-insensitive filesystems,
+# but this does not work with the Ninja generator's separate preprocessing
+# and compilation steps.
+if(NOT CMAKE_GENERATOR MATCHES "^Ninja")
+ set(CMAKE_Fortran_COMPILE_OBJECT
+ "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <INCLUDES> <FLAGS> -c <SOURCE>")
+endif()
set(CMAKE_Fortran_OSX_COMPATIBILITY_VERSION_FLAG "-Wl,-compatibility_version -Wl,")
set(CMAKE_Fortran_OSX_CURRENT_VERSION_FLAG "-Wl,-current_version -Wl,")
+set(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS "-Wl,-bundle")
set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared")
set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-install_name -Wl,")
set(CMAKE_Fortran_CREATE_SHARED_LIBRARY
diff --git a/Modules/Platform/CrayLinuxEnvironment.cmake b/Modules/Platform/CrayLinuxEnvironment.cmake
index 648806f..daff647 100644
--- a/Modules/Platform/CrayLinuxEnvironment.cmake
+++ b/Modules/Platform/CrayLinuxEnvironment.cmake
@@ -6,7 +6,10 @@ if(DEFINED ENV{CRAYOS_VERSION})
elseif(DEFINED ENV{XTOS_VERSION})
set(CMAKE_SYSTEM_VERSION "$ENV{XTOS_VERSION}")
elseif(EXISTS /etc/opt/cray/release/cle-release)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS /etc/opt/cray/release/cle-release release REGEX "^RELEASE=.*")
+ cmake_policy(POP)
string(REGEX REPLACE "^RELEASE=(.*)$" "\\1" CMAKE_SYSTEM_VERSION "${release}")
unset(release)
elseif(EXISTS /etc/opt/cray/release/clerelease)
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 8d5bf8c..1b9cece 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -159,7 +159,10 @@ function(_apple_resolve_supported_archs_for_sdk_from_system_lib sdk_path ret ret
# Newer SDKs ship text based dylib stub files which contain the architectures supported by the
# library in text form.
if(EXISTS "${system_lib_tbd_path}")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${system_lib_tbd_path}" tbd_lines REGEX "^(archs|targets): +\\[.+\\]")
+ cmake_policy(POP)
if(NOT tbd_lines)
set(${ret_failed} TRUE PARENT_SCOPE)
return()
diff --git a/Modules/Platform/Linux-Apple-Swift.cmake b/Modules/Platform/Linux-Apple-Swift.cmake
index 22f0554..248d2de 100644
--- a/Modules/Platform/Linux-Apple-Swift.cmake
+++ b/Modules/Platform/Linux-Apple-Swift.cmake
@@ -1,3 +1,5 @@
+set(CMAKE_EXE_EXPORTS_Swift_FLAG "-Xclang-linker -Wl,--export-dynamic")
+
# Linker Selection
# BFD is known to mislink Swift objects resulting in missing type info
set(CMAKE_Swift_USING_LINKER_SYSTEM "")
diff --git a/Modules/Platform/Windows3x-OpenWatcom.cmake b/Modules/Platform/Windows3x-OpenWatcom.cmake
index 6fcceea..0882df6 100644
--- a/Modules/Platform/Windows3x-OpenWatcom.cmake
+++ b/Modules/Platform/Windows3x-OpenWatcom.cmake
@@ -8,8 +8,8 @@ set(CMAKE_BUILD_TYPE_INIT Debug)
if(DEFINED CMAKE_SYSTEM_PROCESSOR AND CMAKE_SYSTEM_PROCESSOR STREQUAL "I86")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system windows")
- string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system windows")
- string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system windows")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system windows_dll")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " system windows_dll")
else()
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " system win386")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " system win386")
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index 47e266d..9e1d473 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -207,7 +207,10 @@ function(ProcessorCount var)
# Systems with /proc/cpuinfo:
set(cpuinfo_file /proc/cpuinfo)
if(EXISTS "${cpuinfo_file}")
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file(STRINGS "${cpuinfo_file}" procs REGEX "^processor.: [0-9]+$")
+ cmake_policy(POP)
list(LENGTH procs count)
#message("ProcessorCount: trying cpuinfo '${cpuinfo_file}'")
endif()
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 12b6816..03c8588 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -91,12 +91,17 @@ macro(__TEST_BIG_ENDIAN_LEGACY_IMPL VARIABLE)
if(HAVE_${VARIABLE})
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
CMAKE_TEST_ENDIANESS_STRINGS_LE LIMIT_COUNT 1 REGEX "THIS IS LITTLE ENDIAN")
file(STRINGS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TestEndianess.bin"
CMAKE_TEST_ENDIANESS_STRINGS_BE LIMIT_COUNT 1 REGEX "THIS IS BIG ENDIAN")
+ cmake_policy(POP)
+
# on mac, if there are universal binaries built both will be true
# return the result depending on the machine on which cmake runs
if(CMAKE_TEST_ENDIANESS_STRINGS_BE AND CMAKE_TEST_ENDIANESS_STRINGS_LE)
diff --git a/Modules/UseJava/ClearClassFiles.cmake b/Modules/UseJava/ClearClassFiles.cmake
index f3115c6..2c41665 100644
--- a/Modules/UseJava/ClearClassFiles.cmake
+++ b/Modules/UseJava/ClearClassFiles.cmake
@@ -3,6 +3,9 @@
# This script deletes compiled Java class files.
+cmake_policy(PUSH)
+cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
+
if(CMAKE_JAVA_CLASS_OUTPUT_PATH)
if(EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist")
file(STRINGS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist" classes)
@@ -15,3 +18,5 @@ if(CMAKE_JAVA_CLASS_OUTPUT_PATH)
else()
message(FATAL_ERROR "Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH")
endif()
+
+cmake_policy(POP)
diff --git a/Modules/UseJava/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in
index f3670c2..dc20c82 100644
--- a/Modules/UseJava/javaTargets.cmake.in
+++ b/Modules/UseJava/javaTargets.cmake.in
@@ -1,5 +1,5 @@
cmake_policy(PUSH)
-cmake_policy(VERSION 2.8.12...3.27)
+cmake_policy(VERSION 2.8.12...3.28)
#----------------------------------------------------------------
# Generated CMake Java target import file.
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index f264fb6..c58511a 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -466,7 +466,10 @@ function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
# try to get module name from "%module foo" syntax
if ( EXISTS "${infile}" )
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*[a-zA-Z0-9_]+.*" )
+ cmake_policy(POP)
endif ()
if ( module_basename )
string ( REGEX REPLACE "[ ]*%module[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
@@ -474,7 +477,10 @@ function(SWIG_GET_EXTRA_OUTPUT_FILES language outfiles generatedpath infile)
else ()
# try to get module name from "%module (options=...) foo" syntax
if ( EXISTS "${infile}" )
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
file ( STRINGS "${infile}" module_basename REGEX "[ ]*%module[ ]*\\(.*\\)[ ]*[a-zA-Z0-9_]+.*" )
+ cmake_policy(POP)
endif ()
if ( module_basename )
string ( REGEX REPLACE "[ ]*%module[ ]*\\(.*\\)[ ]*([a-zA-Z0-9_]+).*" "\\1" module_basename "${module_basename}" )
diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in
index c518b3d..7659958 100644
--- a/Modules/exportheader.cmake.in
+++ b/Modules/exportheader.cmake.in
@@ -33,6 +33,7 @@
# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if @DEFINE_NO_DEPRECATED@ /* DEFINE_NO_DEPRECATED */
# ifndef @NO_DEPRECATED_MACRO_NAME@
# define @NO_DEPRECATED_MACRO_NAME@
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 02288ae..bcadc20 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 29)
-set(CMake_VERSION_PATCH 2)
+set(CMake_VERSION_PATCH 20240503)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 5724175..b3e5fe4 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -55,7 +55,6 @@ int cmCPackIFWGenerator::PackageFiles()
std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
{
std::vector<std::string> ifwCmd;
- std::string ifwArg;
ifwCmd.emplace_back(this->RepoGen);
@@ -104,7 +103,7 @@ std::vector<std::string> cmCPackIFWGenerator::BuildRepogenCommand()
if (!this->OnlineOnly && !this->DownloadedPackages.empty()) {
ifwCmd.emplace_back("-i");
auto it = this->DownloadedPackages.begin();
- ifwArg = (*it)->Name;
+ std::string ifwArg = (*it)->Name;
++it;
while (it != this->DownloadedPackages.end()) {
ifwArg += "," + (*it)->Name;
@@ -417,10 +416,10 @@ int cmCPackIFWGenerator::InitializeInternal()
}
if (cmValue ifwDownloadAll = this->GetOption("CPACK_IFW_DOWNLOAD_ALL")) {
- this->OnlineOnly = cmIsOn(ifwDownloadAll);
+ this->OnlineOnly = ifwDownloadAll.IsOn();
} else if (cmValue cpackDownloadAll =
this->GetOption("CPACK_DOWNLOAD_ALL")) {
- this->OnlineOnly = cmIsOn(cpackDownloadAll);
+ this->OnlineOnly = cpackDownloadAll.IsOn();
} else {
this->OnlineOnly = false;
}
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index 6918b5e..8532b3e 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -74,7 +74,7 @@ bool cmCPackWIXGenerator::RunWiXCommand(std::string const& command)
if (!status || returnValue) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem running WiX candle. "
+ "Problem running WiX. "
"Please check '"
<< logFileName << "' for errors." << std::endl);
@@ -166,6 +166,16 @@ int cmCPackWIXGenerator::PackageFiles()
bool cmCPackWIXGenerator::InitializeWiXConfiguration()
{
+ if (cmValue wixVersion = GetOption("CPACK_WIX_VERSION")) {
+ if (!cmStrToULong(*wixVersion, &this->WixVersion) ||
+ this->WixVersion < 3 || this->WixVersion > 4) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "CPACK_WIX_VERSION has unknown value '"
+ << *wixVersion << "'" << std::endl);
+ return false;
+ }
+ }
+
if (!ReadListFile("Internal/CPack/CPackWIX.cmake")) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error while executing CPackWIX.cmake" << std::endl);
@@ -232,14 +242,22 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
SetOption("CPACK_WIX_PROPERTY_ARPCONTACT", packageContact);
}
- CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
- CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions);
+ if (this->WixVersion >= 4) {
+ CollectExtensions("CPACK_WIX_EXTENSIONS", this->WixExtensions);
+ if (!GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION").IsOn()) {
+ this->WixExtensions.insert("WixToolset.UI.wixext");
+ }
+ } else {
+ CollectExtensions("CPACK_WIX_EXTENSIONS", this->CandleExtensions);
+ CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", this->CandleExtensions);
- if (!cmIsOn(GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION"))) {
- this->LightExtensions.insert("WixUIExtension");
+ if (!GetOption("CPACK_WIX_SKIP_WIX_UI_EXTENSION").IsOn()) {
+ this->LightExtensions.insert("WixUIExtension");
+ }
+ CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions);
+ CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions);
}
- CollectExtensions("CPACK_WIX_EXTENSIONS", this->LightExtensions);
- CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", this->LightExtensions);
+
CollectXmlNamespaces("CPACK_WIX_CUSTOM_XMLNS", this->CustomXmlNamespaces);
cmValue patchFilePath = GetOption("CPACK_WIX_PATCH_FILE");
@@ -255,7 +273,7 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
// if install folder is supposed to be set absolutely, the default
// component guid "*" cannot be used
- if (cmIsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
+ if (GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER").IsOn()) {
this->ComponentGuidType = cmWIXSourceWriter::CMAKE_GENERATED_GUID;
}
@@ -278,6 +296,53 @@ bool cmCPackWIXGenerator::PackageFilesImpl()
AppendUserSuppliedExtraSources();
+ return this->WixVersion >= 4 ? this->PackageWithWix()
+ : this->PackageWithWix3();
+}
+
+bool cmCPackWIXGenerator::PackageWithWix()
+{
+ std::string wixExecutable;
+ if (!RequireOption("CPACK_WIX_EXECUTABLE", wixExecutable)) {
+ return false;
+ }
+
+ std::string arch;
+ if (cmValue archOpt = GetOption("CPACK_WIX_ARCHITECTURE")) {
+ arch = *archOpt;
+ } else {
+ arch = GetArchitecture();
+ cmCPackLogger(
+ cmCPackLog::LOG_VERBOSE,
+ "CPACK_WIX_ARCHITECTURE was not set. Invoking WiX with architecture "
+ << arch << ". " << std::endl);
+ }
+
+ std::ostringstream command;
+ command << QuotePath(wixExecutable) << " build"
+ << " -arch " << arch << " -out "
+ << QuotePath(CMakeToWixPath(packageFileNames.at(0)));
+
+ for (std::string const& ext : this->WixExtensions) {
+ command << " -ext " << QuotePath(ext);
+ }
+
+ cmList cultures{ GetOption("CPACK_WIX_CULTURES") };
+ for (std::string const& culture : cultures) {
+ command << " -culture \"" << culture << "\"";
+ }
+
+ AddCustomFlags("CPACK_WIX_BUILD_EXTRA_FLAGS", command);
+
+ for (std::string const& sourceFilename : this->WixSources) {
+ command << " -src " << QuotePath(CMakeToWixPath(sourceFilename));
+ }
+
+ return RunWiXCommand(command.str());
+}
+
+bool cmCPackWIXGenerator::PackageWithWix3()
+{
std::set<std::string> usedBaseNames;
std::ostringstream objectFiles;
@@ -341,8 +406,8 @@ void cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
std::string includeFilename =
cmStrCat(this->CPackTopLevel, "/cpack_variables.wxi");
- cmWIXSourceWriter includeFile(this->Logger, includeFilename,
- this->ComponentGuidType,
+ cmWIXSourceWriter includeFile(this->WixVersion, this->Logger,
+ includeFilename, this->ComponentGuidType,
cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
InjectXmlNamespaces(includeFile);
@@ -367,8 +432,8 @@ void cmCPackWIXGenerator::CreateWiXPropertiesIncludeFile()
std::string includeFilename =
cmStrCat(this->CPackTopLevel, "/properties.wxi");
- cmWIXSourceWriter includeFile(this->Logger, includeFilename,
- this->ComponentGuidType,
+ cmWIXSourceWriter includeFile(this->WixVersion, this->Logger,
+ includeFilename, this->ComponentGuidType,
cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
InjectXmlNamespaces(includeFile);
@@ -417,8 +482,8 @@ void cmCPackWIXGenerator::CreateWiXProductFragmentIncludeFile()
std::string includeFilename =
cmStrCat(this->CPackTopLevel, "/product_fragment.wxi");
- cmWIXSourceWriter includeFile(this->Logger, includeFilename,
- this->ComponentGuidType,
+ cmWIXSourceWriter includeFile(this->WixVersion, this->Logger,
+ includeFilename, this->ComponentGuidType,
cmWIXSourceWriter::INCLUDE_ELEMENT_ROOT);
InjectXmlNamespaces(includeFile);
@@ -459,7 +524,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
this->WixSources.push_back(directoryDefinitionsFilename);
cmWIXDirectoriesSourceWriter directoryDefinitions(
- this->Logger, directoryDefinitionsFilename, this->ComponentGuidType);
+ this->WixVersion, this->Logger, directoryDefinitionsFilename,
+ this->ComponentGuidType);
InjectXmlNamespaces(directoryDefinitions);
directoryDefinitions.BeginElement("Fragment");
@@ -468,11 +534,13 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
return false;
}
- directoryDefinitions.BeginElement("Directory");
- directoryDefinitions.AddAttribute("Id", "TARGETDIR");
- directoryDefinitions.AddAttribute("Name", "SourceDir");
+ if (this->WixVersion == 3) {
+ directoryDefinitions.BeginElement("Directory");
+ directoryDefinitions.AddAttribute("Id", "TARGETDIR");
+ directoryDefinitions.AddAttribute("Name", "SourceDir");
+ }
- size_t installRootSize =
+ auto installationPrefixDirectory =
directoryDefinitions.BeginInstallationPrefixDirectory(GetRootFolderId(),
installRoot);
@@ -481,7 +549,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
this->WixSources.push_back(fileDefinitionsFilename);
- cmWIXFilesSourceWriter fileDefinitions(this->Logger, fileDefinitionsFilename,
+ cmWIXFilesSourceWriter fileDefinitions(this->WixVersion, this->Logger,
+ fileDefinitionsFilename,
this->ComponentGuidType);
InjectXmlNamespaces(fileDefinitions);
@@ -492,8 +561,9 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
this->WixSources.push_back(featureDefinitionsFilename);
- cmWIXFeaturesSourceWriter featureDefinitions(
- this->Logger, featureDefinitionsFilename, this->ComponentGuidType);
+ cmWIXFeaturesSourceWriter featureDefinitions(this->WixVersion, this->Logger,
+ featureDefinitionsFilename,
+ this->ComponentGuidType);
InjectXmlNamespaces(featureDefinitions);
featureDefinitions.BeginElement("Fragment");
@@ -501,7 +571,11 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.BeginElement("Feature");
featureDefinitions.AddAttribute("Id", "ProductFeature");
featureDefinitions.AddAttribute("Display", "expand");
- featureDefinitions.AddAttribute("Absent", "disallow");
+ if (this->WixVersion >= 4) {
+ featureDefinitions.AddAttribute("AllowAbsent", "no");
+ } else {
+ featureDefinitions.AddAttribute("Absent", "disallow");
+ }
featureDefinitions.AddAttribute("ConfigurableDirectory", "INSTALL_ROOT");
std::string cpackPackageName;
@@ -583,7 +657,8 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.EndElement("Fragment");
fileDefinitions.EndElement("Fragment");
- directoryDefinitions.EndInstallationPrefixDirectory(installRootSize);
+ directoryDefinitions.EndInstallationPrefixDirectory(
+ installationPrefixDirectory);
if (emittedShortcutTypes.find(cmWIXShortcuts::START_MENU) !=
emittedShortcutTypes.end()) {
@@ -601,7 +676,9 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.EmitStartupFolder();
}
- directoryDefinitions.EndElement("Directory");
+ if (this->WixVersion == 3) {
+ directoryDefinitions.EndElement("Directory");
+ }
directoryDefinitions.EndElement("Fragment");
if (!GenerateMainSourceFileFromTemplate()) {
@@ -613,15 +690,19 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
std::string cmCPackWIXGenerator::GetRootFolderId() const
{
- if (cmIsOn(GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER"))) {
- return "";
- }
+ std::string result;
- std::string result = "ProgramFiles<64>Folder";
+ if (GetOption("CPACK_WIX_SKIP_PROGRAM_FOLDER").IsOn()) {
+ return result;
+ }
cmValue rootFolderId = GetOption("CPACK_WIX_ROOT_FOLDER_ID");
if (rootFolderId) {
result = *rootFolderId;
+ } else if (this->WixVersion >= 4) {
+ result = "ProgramFiles6432Folder";
+ } else {
+ result = "ProgramFiles<64>Folder";
}
if (GetArchitecture() == "x86"_s) {
@@ -635,9 +716,15 @@ std::string cmCPackWIXGenerator::GetRootFolderId() const
bool cmCPackWIXGenerator::GenerateMainSourceFileFromTemplate()
{
- std::string wixTemplate = FindTemplate("WIX.template.in");
+ std::string wixTemplate;
if (cmValue wixtpl = GetOption("CPACK_WIX_TEMPLATE")) {
wixTemplate = *wixtpl;
+ } else {
+ cm::optional<cm::string_view> alt;
+ if (this->WixVersion == 3) {
+ alt = "WIX-v3/"_s;
+ }
+ wixTemplate = FindTemplate("WIX.template.in"_s, alt);
}
if (wixTemplate.empty()) {
@@ -764,21 +851,31 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
cmWIXFeaturesSourceWriter& featureDefinitions)
{
std::string directoryId;
+ std::string directoryRef = "DirectoryRef";
switch (type) {
case cmWIXShortcuts::START_MENU: {
cmValue cpackWixProgramMenuFolder =
GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
if (cpackWixProgramMenuFolder && cpackWixProgramMenuFolder == "."_s) {
directoryId = "ProgramMenuFolder";
+ if (this->WixVersion >= 4) {
+ directoryRef = "StandardDirectory";
+ }
} else {
directoryId = "PROGRAM_MENU_FOLDER";
}
} break;
case cmWIXShortcuts::DESKTOP:
directoryId = "DesktopFolder";
+ if (this->WixVersion >= 4) {
+ directoryRef = "StandardDirectory";
+ }
break;
case cmWIXShortcuts::STARTUP:
directoryId = "StartupFolder";
+ if (this->WixVersion >= 4) {
+ directoryRef = "StandardDirectory";
+ }
break;
default:
return false;
@@ -810,7 +907,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
componentId += idSuffix;
- fileDefinitions.BeginElement("DirectoryRef");
+ fileDefinitions.BeginElement(directoryRef);
fileDefinitions.AddAttribute("Id", directoryId);
fileDefinitions.BeginElement("Component");
@@ -840,7 +937,7 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
}
fileDefinitions.EndElement("Component");
- fileDefinitions.EndElement("DirectoryRef");
+ fileDefinitions.EndElement(directoryRef);
featureDefinitions.EmitComponentRef(componentId);
featureDefinitions.EndElement("FeatureRef");
@@ -1180,12 +1277,7 @@ void cmCPackWIXGenerator::CollectExtensions(std::string const& variableName,
void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
xmlns_map_t& namespaces)
{
- cmValue variableContent = GetOption(variableName);
- if (!variableContent) {
- return;
- }
-
- cmList list{ variableContent };
+ cmList list{ GetOption(variableName) };
for (std::string const& str : list) {
auto pos = str.find('=');
if (pos != std::string::npos) {
@@ -1199,12 +1291,18 @@ void cmCPackWIXGenerator::CollectXmlNamespaces(std::string const& variableName,
<< str << '"' << std::endl);
}
}
- std::ostringstream oss;
+ std::string xmlns;
+ if (this->WixVersion >= 4 &&
+ cm::contains(this->WixExtensions, "WixToolset.UI.wixext") &&
+ !cm::contains(namespaces, "ui")) {
+ xmlns = cmStrCat(
+ xmlns, "\n xmlns:ui=\"http://wixtoolset.org/schemas/v4/wxs/ui\"");
+ }
for (auto& ns : namespaces) {
- oss << " xmlns:" << ns.first << "=\""
- << cmWIXSourceWriter::EscapeAttributeValue(ns.second) << '"';
+ xmlns = cmStrCat(xmlns, "\n xmlns:", ns.first, "=\"",
+ cmWIXSourceWriter::EscapeAttributeValue(ns.second), '"');
}
- SetOption("CPACK_WIX_CUSTOM_XMLNS_EXPANDED", oss.str());
+ SetOption("CPACK_WIX_CUSTOM_XMLNS_EXPANDED", xmlns);
}
void cmCPackWIXGenerator::AddCustomFlags(std::string const& variableName,
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 8609cf3..63530d4 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -59,6 +59,8 @@ private:
bool InitializeWiXConfiguration();
bool PackageFilesImpl();
+ bool PackageWithWix();
+ bool PackageWithWix3();
void CreateWiXVariablesIncludeFile();
@@ -160,6 +162,7 @@ private:
id_map_t PathToIdMap;
ambiguity_map_t IdAmbiguityCounter;
+ extension_set_t WixExtensions;
extension_set_t CandleExtensions;
extension_set_t LightExtensions;
xmlns_map_t CustomXmlNamespaces;
@@ -168,5 +171,7 @@ private:
std::unique_ptr<cmWIXPatch> Patch;
+ unsigned long WixVersion = 3;
+
cmWIXSourceWriter::GuidType ComponentGuidType;
};
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
index a655d86..b1e7bd2 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
@@ -5,15 +5,16 @@
#include <cmext/string_view>
cmWIXDirectoriesSourceWriter::cmWIXDirectoriesSourceWriter(
- cmCPackLog* logger, std::string const& filename, GuidType componentGuidType)
- : cmWIXSourceWriter(logger, filename, componentGuidType)
+ unsigned long wixVersion, cmCPackLog* logger, std::string const& filename,
+ GuidType componentGuidType)
+ : cmWIXSourceWriter(wixVersion, logger, filename, componentGuidType)
{
}
void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder(
std::string const& startMenuFolder)
{
- BeginElement("Directory");
+ BeginElement_StandardDirectory();
AddAttribute("Id", "ProgramMenuFolder");
if (startMenuFolder != "."_s) {
@@ -23,34 +24,39 @@ void cmWIXDirectoriesSourceWriter::EmitStartMenuFolder(
EndElement("Directory");
}
- EndElement("Directory");
+ EndElement_StandardDirectory();
}
void cmWIXDirectoriesSourceWriter::EmitDesktopFolder()
{
- BeginElement("Directory");
+ BeginElement_StandardDirectory();
AddAttribute("Id", "DesktopFolder");
- AddAttribute("Name", "Desktop");
- EndElement("Directory");
+ if (this->WixVersion == 3) {
+ AddAttribute("Name", "Desktop");
+ }
+ EndElement_StandardDirectory();
}
void cmWIXDirectoriesSourceWriter::EmitStartupFolder()
{
- BeginElement("Directory");
+ BeginElement_StandardDirectory();
AddAttribute("Id", "StartupFolder");
- AddAttribute("Name", "Startup");
- EndElement("Directory");
+ if (this->WixVersion == 3) {
+ AddAttribute("Name", "Startup");
+ }
+ EndElement_StandardDirectory();
}
-size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
+cmWIXDirectoriesSourceWriter::InstallationPrefixDirectory
+cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString)
{
- size_t offset = 1;
+ InstallationPrefixDirectory installationPrefixDirectory;
if (!programFilesFolderId.empty()) {
- BeginElement("Directory");
+ installationPrefixDirectory.HasStandardDirectory = true;
+ this->BeginElement_StandardDirectory();
AddAttribute("Id", programFilesFolderId);
- offset = 0;
}
std::vector<std::string> installRoot;
@@ -62,6 +68,7 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
}
for (size_t i = 1; i < installRoot.size(); ++i) {
+ ++installationPrefixDirectory.Depth;
BeginElement("Directory");
if (i == installRoot.size() - 1) {
@@ -75,12 +82,16 @@ size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
AddAttribute("Name", installRoot[i]);
}
- return installRoot.size() - offset;
+ return installationPrefixDirectory;
}
-void cmWIXDirectoriesSourceWriter::EndInstallationPrefixDirectory(size_t size)
+void cmWIXDirectoriesSourceWriter::EndInstallationPrefixDirectory(
+ InstallationPrefixDirectory installationPrefixDirectory)
{
- for (size_t i = 0; i < size; ++i) {
+ for (size_t i = 0; i < installationPrefixDirectory.Depth; ++i) {
EndElement("Directory");
}
+ if (installationPrefixDirectory.HasStandardDirectory) {
+ this->EndElement_StandardDirectory();
+ }
}
diff --git a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
index 0af3094..b0aa1e2 100644
--- a/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXDirectoriesSourceWriter.h
@@ -13,7 +13,8 @@
class cmWIXDirectoriesSourceWriter : public cmWIXSourceWriter
{
public:
- cmWIXDirectoriesSourceWriter(cmCPackLog* logger, std::string const& filename,
+ cmWIXDirectoriesSourceWriter(unsigned long wixVersion, cmCPackLog* logger,
+ std::string const& filename,
GuidType componentGuidType);
void EmitStartMenuFolder(std::string const& startMenuFolder);
@@ -22,9 +23,16 @@ public:
void EmitStartupFolder();
- size_t BeginInstallationPrefixDirectory(
+ struct InstallationPrefixDirectory
+ {
+ bool HasStandardDirectory = false;
+ size_t Depth = 0;
+ };
+
+ InstallationPrefixDirectory BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString);
- void EndInstallationPrefixDirectory(size_t size);
+ void EndInstallationPrefixDirectory(
+ InstallationPrefixDirectory installationPrefixDirectory);
};
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
index 78c2208..0d2e6e8 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx
@@ -5,8 +5,9 @@
#include "cmStringAlgorithms.h"
cmWIXFeaturesSourceWriter::cmWIXFeaturesSourceWriter(
- cmCPackLog* logger, std::string const& filename, GuidType componentGuidType)
- : cmWIXSourceWriter(logger, filename, componentGuidType)
+ unsigned long wixVersion, cmCPackLog* logger, std::string const& filename,
+ GuidType componentGuidType)
+ : cmWIXSourceWriter(wixVersion, logger, filename, componentGuidType)
{
}
@@ -69,7 +70,11 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent(
AddAttributeUnlessEmpty("Description", component.Description);
if (component.IsRequired) {
- AddAttribute("Absent", "disallow");
+ if (this->WixVersion >= 4) {
+ AddAttribute("AllowAbsent", "no");
+ } else {
+ AddAttribute("Absent", "disallow");
+ }
}
if (component.IsHidden) {
diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
index 0facf97..95de8fe 100644
--- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h
@@ -12,7 +12,8 @@
class cmWIXFeaturesSourceWriter : public cmWIXSourceWriter
{
public:
- cmWIXFeaturesSourceWriter(cmCPackLog* logger, std::string const& filename,
+ cmWIXFeaturesSourceWriter(unsigned long wixVersion, cmCPackLog* logger,
+ std::string const& filename,
GuidType componentGuidType);
void CreateCMakePackageRegistryEntry(std::string const& package,
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index b4085d5..87ac6ac 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -15,10 +15,11 @@
#include "cmUuid.h"
#include "cmWIXAccessControlList.h"
-cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(cmCPackLog* logger,
+cmWIXFilesSourceWriter::cmWIXFilesSourceWriter(unsigned long wixVersion,
+ cmCPackLog* logger,
std::string const& filename,
GuidType componentGuidType)
- : cmWIXSourceWriter(logger, filename, componentGuidType)
+ : cmWIXSourceWriter(wixVersion, logger, filename, componentGuidType)
{
}
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index 60dddd4..f560304 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -13,7 +13,8 @@
class cmWIXFilesSourceWriter : public cmWIXSourceWriter
{
public:
- cmWIXFilesSourceWriter(cmCPackLog* logger, std::string const& filename,
+ cmWIXFilesSourceWriter(unsigned long wixVersion, cmCPackLog* logger,
+ std::string const& filename,
GuidType componentGuidType);
void EmitShortcut(std::string const& id, cmWIXShortcut const& shortcut,
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.cxx b/Source/CPack/WiX/cmWIXSourceWriter.cxx
index ef6712a..33e8a70 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXSourceWriter.cxx
@@ -8,11 +8,13 @@
#include "cmCryptoHash.h"
#include "cmUuid.h"
-cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
+cmWIXSourceWriter::cmWIXSourceWriter(unsigned long wixVersion,
+ cmCPackLog* logger,
std::string const& filename,
GuidType componentGuidType,
RootElementType rootElementType)
- : Logger(logger)
+ : WixVersion(wixVersion)
+ , Logger(logger)
, File(filename.c_str())
, State(DEFAULT)
, SourceFilename(filename)
@@ -26,7 +28,11 @@ cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
BeginElement("Wix");
}
- AddAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi");
+ if (this->WixVersion >= 4) {
+ AddAttribute("xmlns", "http://wixtoolset.org/schemas/v4/wxs");
+ } else {
+ AddAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi");
+ }
}
cmWIXSourceWriter::~cmWIXSourceWriter()
@@ -42,6 +48,24 @@ cmWIXSourceWriter::~cmWIXSourceWriter()
EndElement(Elements.back());
}
+void cmWIXSourceWriter::BeginElement_StandardDirectory()
+{
+ if (this->WixVersion >= 4) {
+ BeginElement("StandardDirectory");
+ } else {
+ BeginElement("Directory");
+ }
+}
+
+void cmWIXSourceWriter::EndElement_StandardDirectory()
+{
+ if (this->WixVersion >= 4) {
+ EndElement("StandardDirectory");
+ } else {
+ EndElement("Directory");
+ }
+}
+
void cmWIXSourceWriter::BeginElement(std::string const& name)
{
if (State == BEGIN) {
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index f643acd..1089cf5 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -27,12 +27,15 @@ public:
INCLUDE_ELEMENT_ROOT
};
- cmWIXSourceWriter(cmCPackLog* logger, std::string const& filename,
- GuidType componentGuidType,
+ cmWIXSourceWriter(unsigned long wixVersion, cmCPackLog* logger,
+ std::string const& filename, GuidType componentGuidType,
RootElementType rootElementType = WIX_ELEMENT_ROOT);
~cmWIXSourceWriter();
+ void BeginElement_StandardDirectory();
+ void EndElement_StandardDirectory();
+
void BeginElement(std::string const& name);
void EndElement(std::string const& name);
@@ -52,6 +55,7 @@ public:
static std::string EscapeAttributeValue(std::string const& value);
protected:
+ unsigned long WixVersion;
cmCPackLog* Logger;
private:
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 8d16428..7693891 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -225,7 +225,7 @@ bool DebGenerator::generateDataTar() const
// XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application
// should not add XXX/application
orderedFiles.insert(currentPath);
- currentPath = cmSystemTools::CollapseFullPath("..", currentPath);
+ currentPath = cmSystemTools::GetFilenamePath(currentPath);
}
}
@@ -527,7 +527,7 @@ cmCPackDebGenerator::~cmCPackDebGenerator() = default;
int cmCPackDebGenerator::InitializeInternal()
{
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");
- if (cmIsOff(this->GetOption("CPACK_SET_DESTDIR"))) {
+ if (this->GetOption("CPACK_SET_DESTDIR").IsOff()) {
this->SetOption("CPACK_SET_DESTDIR", "I_ON");
}
return this->Superclass::InitializeInternal();
diff --git a/Source/CPack/cmCPackExternalGenerator.cxx b/Source/CPack/cmCPackExternalGenerator.cxx
index 8ba015c..52eacaa 100644
--- a/Source/CPack/cmCPackExternalGenerator.cxx
+++ b/Source/CPack/cmCPackExternalGenerator.cxx
@@ -156,7 +156,7 @@ int cmCPackExternalGenerator::InstallCMakeProject(
bool cmCPackExternalGenerator::StagingEnabled() const
{
- return !cmIsOff(this->GetOption("CPACK_EXTERNAL_ENABLE_STAGING"));
+ return !this->GetOption("CPACK_EXTERNAL_ENABLE_STAGING").IsOff();
}
cmCPackExternalGenerator::cmCPackExternalVersionGenerator::
@@ -221,7 +221,7 @@ int cmCPackExternalGenerator::cmCPackExternalVersionGenerator::WriteToJSON(
root["setDestdir"] = false;
}
- root["stripFiles"] = !cmIsOff(this->Parent->GetOption("CPACK_STRIP_FILES"));
+ root["stripFiles"] = !this->Parent->GetOption("CPACK_STRIP_FILES").IsOff();
root["warnOnAbsoluteInstallDestination"] =
this->Parent->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION");
root["errorOnAbsoluteInstallDestination"] =
diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx
index 0840e33..6beb644 100644
--- a/Source/CPack/cmCPackFreeBSDGenerator.cxx
+++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx
@@ -405,8 +405,7 @@ int cmCPackFreeBSDGenerator::PackageFiles()
return 0;
}
- const std::string output_dir =
- cmSystemTools::CollapseFullPath("../", toplevel);
+ const std::string output_dir = cmSystemTools::GetFilenamePath(toplevel);
PkgCreate package(output_dir, toplevel, manifestname);
if (package.isValid()) {
if (!package.Create()) {
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 11d90c0..4a5580c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -7,6 +7,8 @@
#include <memory>
#include <utility>
+#include <cmext/string_view>
+
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
@@ -77,51 +79,60 @@ int cmCPackGenerator::PrepareNames()
}
}
- std::string tempDirectory =
- cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/_CPack_Packages/");
- cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
- if (toplevelTag) {
- tempDirectory += *toplevelTag;
- tempDirectory += "/";
+ // Determine package-directory.
+ cmValue pkgDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
+ if (!pkgDirectory) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
+ return 0;
}
- tempDirectory += *this->GetOption("CPACK_GENERATOR");
- std::string topDirectory = tempDirectory;
- cmValue pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME");
- if (!pfname) {
+ // Determine base-filename of the package.
+ cmValue pkgBaseFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
+ if (!pkgBaseFileName) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"CPACK_PACKAGE_FILE_NAME not specified" << std::endl);
return 0;
}
- std::string outName = *pfname;
- tempDirectory += "/" + outName;
+ // Determine filename of the package.
if (!this->GetOutputExtension()) {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"No output extension specified" << std::endl);
return 0;
}
- outName += this->GetOutputExtension();
- cmValue pdir = this->GetOption("CPACK_PACKAGE_DIRECTORY");
- if (!pdir) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "CPACK_PACKAGE_DIRECTORY not specified" << std::endl);
- return 0;
+ std::string pkgFileName =
+ cmStrCat(pkgBaseFileName, this->GetOutputExtension());
+ // Determine path to the package.
+ std::string pkgFilePath = cmStrCat(pkgDirectory, "/", pkgFileName);
+ // Determine top-level directory for packaging.
+ std::string topDirectory = cmStrCat(pkgDirectory, "/_CPack_Packages/");
+ {
+ cmValue toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
+ if (toplevelTag) {
+ topDirectory += cmStrCat(toplevelTag, "/");
+ }
}
+ topDirectory += *this->GetOption("CPACK_GENERATOR");
+ // Determine temporary packaging-directory.
+ std::string tmpDirectory = cmStrCat(topDirectory, "/", pkgBaseFileName);
+ // Determine path to temporary package file.
+ std::string tmpPkgFilePath = topDirectory + "/" + pkgFileName;
- std::string destFile = *pdir;
- this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", destFile);
- destFile += "/" + outName;
- std::string outFile = topDirectory + "/" + outName;
+ // Set CPack variables which are not set already.
+ this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
this->SetOptionIfNotSet("CPACK_TOPLEVEL_DIRECTORY", topDirectory);
- this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tempDirectory);
- this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", outName);
- this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", destFile);
- this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", outFile);
+ this->SetOptionIfNotSet("CPACK_TEMPORARY_DIRECTORY", tmpDirectory);
+ this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tmpDirectory);
+ this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PREFIX", pkgDirectory);
+ this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_NAME", pkgFileName);
+ this->SetOptionIfNotSet("CPACK_OUTPUT_FILE_PATH", pkgFilePath);
+ this->SetOptionIfNotSet("CPACK_TEMPORARY_PACKAGE_FILE_NAME", tmpPkgFilePath);
this->SetOptionIfNotSet("CPACK_INSTALL_DIRECTORY", this->GetInstallPath());
this->SetOptionIfNotSet(
"CPACK_NATIVE_INSTALL_DIRECTORY",
cmsys::SystemTools::ConvertToOutputPath(this->GetInstallPath()));
- this->SetOptionIfNotSet("CPACK_TEMPORARY_INSTALL_DIRECTORY", tempDirectory);
+ // Determine description of the package and set as CPack variable,
+ // if not already set.
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Look for: CPACK_PACKAGE_DESCRIPTION_FILE" << std::endl);
cmValue descFileName = this->GetOption("CPACK_PACKAGE_DESCRIPTION_FILE");
@@ -141,14 +152,14 @@ int cmCPackGenerator::PrepareNames()
<< std::endl);
return 0;
}
- std::ostringstream ostr;
- std::string line;
-
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Read description file: " << *descFileName << std::endl);
+ std::ostringstream ostr;
+ std::string line;
while (ifs && cmSystemTools::GetLineFromStream(ifs, line)) {
ostr << cmXMLSafe(line) << std::endl;
}
+
this->SetOption("CPACK_PACKAGE_DESCRIPTION", ostr.str());
cmValue defFileName =
this->GetOption("CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE");
@@ -164,6 +175,8 @@ int cmCPackGenerator::PrepareNames()
<< std::endl);
return 0;
}
+
+ // Check algorithm for calculating the checksum of the package.
cmValue algoSignature = this->GetOption("CPACK_PACKAGE_CHECKSUM");
if (algoSignature) {
if (!cmCryptoHash::New(*algoSignature)) {
@@ -174,8 +187,6 @@ int cmCPackGenerator::PrepareNames()
}
}
- this->SetOptionIfNotSet("CPACK_REMOVE_TOPLEVEL_DIRECTORY", "1");
-
return 1;
}
@@ -185,21 +196,21 @@ int cmCPackGenerator::InstallProject()
this->CleanTemporaryDirectory();
std::string bareTempInstallDirectory =
- this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
- std::string tempInstallDirectoryStr = bareTempInstallDirectory;
- bool setDestDir = cmIsOn(this->GetOption("CPACK_SET_DESTDIR")) ||
+ this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ std::string tempInstallDirectory = bareTempInstallDirectory;
+ bool setDestDir = this->GetOption("CPACK_SET_DESTDIR").IsOn() ||
cmIsInternallyOn(this->GetOption("CPACK_SET_DESTDIR"));
if (!setDestDir) {
- tempInstallDirectoryStr += this->GetPackagingInstallPrefix();
+ tempInstallDirectory += this->GetPackagingInstallPrefix();
}
- const char* tempInstallDirectory = tempInstallDirectoryStr.c_str();
int res = 1;
if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Problem creating temporary directory: "
- << (tempInstallDirectory ? tempInstallDirectory : "(NULL)")
- << std::endl);
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR,
+ "Problem creating temporary directory: "
+ << (!tempInstallDirectory.empty() ? tempInstallDirectory : "(NULL)")
+ << std::endl);
return 0;
}
@@ -360,7 +371,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string top = *it;
- it++;
+ ++it;
std::string subdir = *it;
std::string findExpr = cmStrCat(top, "/*");
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
@@ -855,7 +866,7 @@ int cmCPackGenerator::InstallCMakeProject(
// strip on TRUE, ON, 1, one or several file names, but not on
// FALSE, OFF, 0 and an empty string
- if (!cmIsOff(this->GetOption("CPACK_STRIP_FILES"))) {
+ if (!this->GetOption("CPACK_STRIP_FILES").IsOff()) {
mf.AddDefinition("CMAKE_INSTALL_DO_STRIP", "1");
}
// Remember the list of files before installation
@@ -879,7 +890,7 @@ int cmCPackGenerator::InstallCMakeProject(
if (this->IsOn("CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION")) {
mf.AddDefinition("CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION", "1");
}
- // If current CPack generator does support
+ // If current CPack generator does not support
// ABSOLUTE INSTALL DESTINATION or CPack has been asked for
// then ask cmake_install.cmake script to error out
// as soon as it occurs (before installing file)
@@ -972,6 +983,48 @@ int cmCPackGenerator::InstallCMakeProject(
return 1;
}
+bool cmCPackGenerator::GenerateChecksumFile(cmCryptoHash& crypto,
+ cm::string_view filename) const
+{
+ std::string packageFileName =
+ cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename);
+ std::string hashFile = cmStrCat(
+ packageFileName, "." + cmSystemTools::LowerCase(crypto.GetHashAlgoName()));
+ cmsys::ofstream outF(hashFile.c_str());
+ if (!outF) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot create checksum file: " << hashFile << std::endl);
+ return false;
+ }
+ outF << crypto.HashFile(packageFileName) << " " << filename << "\n";
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- checksum file: " << hashFile << " generated." << std::endl);
+ return true;
+}
+
+bool cmCPackGenerator::CopyPackageFile(const std::string& srcFilePath,
+ cm::string_view filename) const
+{
+ std::string destFilePath =
+ cmStrCat(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"), "/", filename);
+ cmCPackLogger(cmCPackLog::LOG_DEBUG,
+ "Copy final package(s): "
+ << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to "
+ << (!destFilePath.empty() ? destFilePath : "(NULL)")
+ << std::endl);
+ if (!cmSystemTools::CopyFileIfDifferent(srcFilePath, destFilePath)) {
+ cmCPackLogger(
+ cmCPackLog::LOG_ERROR,
+ "Problem copying the package: "
+ << (!srcFilePath.empty() ? srcFilePath : "(NULL)") << " to "
+ << (!destFilePath.empty() ? destFilePath : "(NULL)") << std::endl);
+ return false;
+ }
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+ "- package: " << destFilePath << " generated." << std::endl);
+ return true;
+}
+
bool cmCPackGenerator::ReadListFile(const char* moduleName)
{
bool retval;
@@ -1041,7 +1094,8 @@ int cmCPackGenerator::DoPackage()
return 0;
}
- if (cmIsOn(this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY"))) {
+ // Possibly remove the top-level packaging-directory.
+ if (this->GetOption("CPACK_REMOVE_TOPLEVEL_DIRECTORY").IsOn()) {
cmValue toplevelDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
if (toplevelDirectory && cmSystemTools::FileExists(*toplevelDirectory)) {
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@@ -1055,55 +1109,68 @@ int cmCPackGenerator::DoPackage()
}
}
}
+
+ // Install the project (to the temporary install-directory).
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"About to install project " << std::endl);
-
if (!this->InstallProject()) {
return 0;
}
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Done install project " << std::endl);
- cmValue tempPackageFileName =
- this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME");
+ // Determine the temporary directory whose content shall be packaged.
cmValue tempDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ // Determine and store internally the list of files to be installed.
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
- cmsys::Glob gl;
- std::string findExpr = cmStrCat(tempDirectory, "/*");
- gl.RecurseOn();
- gl.SetRecurseListDirs(true);
- gl.SetRecurseThroughSymlinks(false);
- if (!gl.FindFiles(findExpr)) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot find any files in the packaging tree" << std::endl);
- return 0;
+ {
+ cmsys::Glob gl;
+ std::string findExpr = cmStrCat(tempDirectory, "/*");
+ gl.RecurseOn();
+ gl.SetRecurseListDirs(true);
+ gl.SetRecurseThroughSymlinks(false);
+ if (!gl.FindFiles(findExpr)) {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Cannot find any files in the packaging tree"
+ << std::endl);
+ return 0;
+ }
+ this->files = gl.GetFiles();
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Package files to: "
- << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
- << std::endl);
- if (tempPackageFileName && cmSystemTools::FileExists(*tempPackageFileName)) {
- cmCPackLogger(cmCPackLog::LOG_VERBOSE,
- "Remove old package file" << std::endl);
- cmSystemTools::RemoveFile(*tempPackageFileName);
- }
- if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
+ // Determine and store internally the directory that shall be packaged.
+ if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
tempDirectory = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
}
+ this->toplevel = *tempDirectory;
- // The files to be installed
- this->files = gl.GetFiles();
+ cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Create package" << std::endl);
- this->packageFileNames.clear();
- /* Put at least one file name into the list of
- * wanted packageFileNames. The specific generator
- * may update this during PackageFiles.
- * (either putting several names or updating the provided one)
- */
- this->packageFileNames.emplace_back(tempPackageFileName);
- this->toplevel = *tempDirectory;
+ // Determine and store internally the list of packages to create.
+ // Note: Initially, this only contains a single package.
+ {
+ cmValue tempPackageFileName =
+ this->GetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME");
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Package files to: "
+ << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
+ << std::endl);
+ if (tempPackageFileName &&
+ cmSystemTools::FileExists(*tempPackageFileName)) {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "Remove old package file" << std::endl);
+ cmSystemTools::RemoveFile(*tempPackageFileName);
+ }
+ this->packageFileNames.clear();
+ /* Put at least one file name into the list of
+ * wanted packageFileNames. The specific generator
+ * may update this during PackageFiles.
+ * (either putting several names or updating the provided one)
+ */
+ this->packageFileNames.emplace_back(tempPackageFileName);
+ }
+
+ // Do package the files (using the derived CPack generators.
{ // scope that enables package generators to run internal scripts with
// latest CMake policies enabled
cmMakefile::ScopePushPop pp{ this->MakefileMap };
@@ -1116,6 +1183,7 @@ int cmCPackGenerator::DoPackage()
return 0;
}
}
+
// Run post-build actions
cmValue postBuildScripts = this->GetOption("CPACK_POST_BUILD_SCRIPTS");
if (postBuildScripts) {
@@ -1151,44 +1219,15 @@ int cmCPackGenerator::DoPackage()
<< "]:" << std::endl);
/* now copy package one by one */
for (std::string const& pkgFileName : this->packageFileNames) {
- std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
std::string filename(cmSystemTools::GetFilenameName(pkgFileName));
- tempPackageFileName = cmValue(pkgFileName);
- tmpPF += "/" + filename;
- const char* packageFileName = tmpPF.c_str();
- cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Copy final package(s): "
- << (tempPackageFileName ? *tempPackageFileName : "(NULL)")
- << " to " << (packageFileName ? packageFileName : "(NULL)")
- << std::endl);
- if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) {
- cmCPackLogger(
- cmCPackLog::LOG_ERROR,
- "Problem copying the package: "
- << (tempPackageFileName ? *tempPackageFileName : "(NULL)") << " to "
- << (packageFileName ? packageFileName : "(NULL)") << std::endl);
+ if (!this->CopyPackageFile(pkgFileName, filename)) {
return 0;
}
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- package: " << packageFileName << " generated."
- << std::endl);
-
/* Generate checksum file */
if (crypto) {
- std::string hashFile(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
- hashFile += "/" + filename;
- hashFile += "." + cmSystemTools::LowerCase(algo);
- cmsys::ofstream outF(hashFile.c_str());
- if (!outF) {
- cmCPackLogger(cmCPackLog::LOG_ERROR,
- "Cannot create checksum file: " << hashFile
- << std::endl);
+ if (!this->GenerateChecksumFile(*crypto, filename)) {
return 0;
}
- outF << crypto->HashFile(packageFileName) << " " << filename << "\n";
- cmCPackLogger(cmCPackLog::LOG_OUTPUT,
- "- checksum file: " << hashFile << " generated."
- << std::endl);
}
}
@@ -1216,6 +1255,60 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf)
// it, the default value should be:
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/");
+ // Special handling for CPACK_TEMPORARY[_INSTALL]_DIRECTORY.
+ // Note: Make sure that if only one of these variables is already set, the
+ // other will be set to the same value. If they are set to different
+ // values, however, we cannot proceed.
+ cmValue val1 =
+ this->MakefileMap->GetDefinition("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ cmValue val2 = this->MakefileMap->GetDefinition("CPACK_TEMPORARY_DIRECTORY");
+ if (val1 != val2) {
+ // One variable is set but not the other?
+ // Then set the other variable to the same value (even if it is invalid).
+ if (val1.Get() != nullptr && val2.Get() == nullptr) {
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "Variable CPACK_TEMPORARY_INSTALL_DIRECTORY is set, which "
+ "is not recommended. For backwards-compatibility we will "
+ "also set CPACK_TEMPORARY_DIRECTORY to the same value and "
+ "proceed. However, better set neither of them!"
+ << std::endl);
+ this->MakefileMap->AddDefinition("CPACK_TEMPORARY_DIRECTORY", val1);
+ } else if (val1.Get() == nullptr && val2.Get() != nullptr) {
+ cmCPackLogger(
+ cmCPackLog::LOG_WARNING,
+ "Variable CPACK_TEMPORARY_DIRECTORY is set, which is not recommended."
+ << std::endl);
+ cmCPackLogger(
+ cmCPackLog::LOG_DEBUG,
+ "For backwards-compatibility we will set "
+ "CPACK_TEMPORARY_INSTALL_DIRECTORY to the same value as "
+ "CPACK_TEMPORARY_DIRECTORY. However, better set neither of them!"
+ << std::endl);
+ this->MakefileMap->AddDefinition("CPACK_TEMPORARY_INSTALL_DIRECTORY",
+ val2);
+ } else {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+ "CPACK_TEMPORARY_INSTALL_DIRECTORY is already set to: "
+ << val1 << std::endl);
+ cmCPackLogger(
+ cmCPackLog::LOG_VERBOSE,
+ "CPACK_TEMPORARY_DIRECTORY is already set to: " << val2 << std::endl);
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Variables CPACK_TEMPORARY_DIRECTORY and "
+ "CPACK_TEMPORARY_INSTALL_DIRECTORY are both set but to "
+ "different values. This is not supported!"
+ << std::endl);
+ return 0;
+ }
+ } else if (val1.Get() != nullptr && val2.Get() != nullptr) {
+ cmCPackLogger(cmCPackLog::LOG_WARNING,
+ "Variables CPACK_TEMPORARY_DIRECTORY and "
+ "CPACK_TEMPORARY_INSTALL_DIRECTORY are both set. Because "
+ "they are set to the same value we can still proceed. "
+ "However, better set neither of them!"
+ << std::endl);
+ }
+
return result;
}
@@ -1231,14 +1324,14 @@ bool cmCPackGenerator::IsSet(const std::string& name) const
bool cmCPackGenerator::IsOn(const std::string& name) const
{
- return cmIsOn(this->GetOption(name));
+ return this->GetOption(name).IsOn();
}
bool cmCPackGenerator::IsSetToOff(const std::string& op) const
{
cmValue ret = this->MakefileMap->GetDefinition(op);
if (cmNonempty(ret)) {
- return cmIsOff(*ret);
+ return ret.IsOff();
}
return false;
}
@@ -1315,17 +1408,17 @@ const char* cmCPackGenerator::GetPackagingInstallPrefix()
return this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX")->c_str();
}
-std::string cmCPackGenerator::FindTemplate(const char* name)
+std::string cmCPackGenerator::FindTemplate(cm::string_view name,
+ cm::optional<cm::string_view> alt)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG,
- "Look for template: " << (name ? name : "(NULL)")
- << std::endl);
+ "Look for template: " << name << std::endl);
// Search CMAKE_MODULE_PATH for a custom template.
std::string ffile = this->MakefileMap->GetModulesFile(name);
if (ffile.empty()) {
// Fall back to our internal builtin default.
ffile = cmStrCat(cmSystemTools::GetCMakeRoot(), "/Modules/Internal/CPack/",
- name);
+ alt ? *alt : ""_s, name);
cmSystemTools::ConvertToUnixSlashes(ffile);
if (!cmSystemTools::FileExists(ffile)) {
ffile.clear();
@@ -1354,7 +1447,7 @@ bool cmCPackGenerator::ConfigureFile(const std::string& inName,
int cmCPackGenerator::CleanTemporaryDirectory()
{
std::string tempInstallDirectory =
- this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+ this->GetOption("CPACK_TEMPORARY_DIRECTORY");
if (cmsys::SystemTools::FileExists(tempInstallDirectory)) {
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Clean temporary : " << tempInstallDirectory << std::endl);
@@ -1439,8 +1532,8 @@ int cmCPackGenerator::PrepareGroupingKind()
this->componentPackageMethod = method;
}
- const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE_GROUPS",
- "ONE_PER_GROUP" };
+ const char* method_names[] = { "ALL_COMPONENTS_IN_ONE", "IGNORE",
+ "ONE_PER_GROUP", "UNKNOWN" };
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"[" << this->Name << "]"
@@ -1560,7 +1653,7 @@ cmCPackComponent* cmCPackGenerator::GetComponent(
component->IsRequired = this->IsOn(macroPrefix + "_REQUIRED");
component->IsDisabledByDefault = this->IsOn(macroPrefix + "_DISABLED");
component->IsDownloaded = this->IsOn(macroPrefix + "_DOWNLOADED") ||
- cmIsOn(this->GetOption("CPACK_DOWNLOAD_ALL"));
+ this->GetOption("CPACK_DOWNLOAD_ALL").IsOn();
cmValue archiveFile = this->GetOption(macroPrefix + "_ARCHIVE_FILE");
if (cmNonempty(archiveFile)) {
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 8078d9f..c9af776 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -9,6 +9,9 @@
#include <string>
#include <vector>
+#include <cm/optional>
+#include <cm/string_view>
+
#include "cm_sys_stat.h"
#include "cmCPackComponentGroup.h"
@@ -16,6 +19,7 @@
#include "cmValue.h"
class cmCPackLog;
+class cmCryptoHash;
class cmGlobalGenerator;
class cmInstalledFile;
class cmMakefile;
@@ -179,7 +183,13 @@ protected:
virtual const char* GetInstallPath();
virtual const char* GetPackagingInstallPrefix();
- virtual std::string FindTemplate(const char* name);
+ bool GenerateChecksumFile(cmCryptoHash& crypto,
+ cm::string_view filename) const;
+ bool CopyPackageFile(const std::string& srcFilePath,
+ cm::string_view filename) const;
+
+ std::string FindTemplate(cm::string_view name,
+ cm::optional<cm::string_view> alt = cm::nullopt);
virtual bool ConfigureFile(const std::string& inName,
const std::string& outName,
bool copyOnly = false);
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.cxx b/Source/CPack/cmCPackInnoSetupGenerator.cxx
index bf90b06..17ea89f 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.cxx
+++ b/Source/CPack/cmCPackInnoSetupGenerator.cxx
@@ -7,7 +7,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */
#include <cctype>
#include <cstdlib>
#include <ostream>
-#include <stack>
#include <utility>
#include "cmsys/RegularExpression.hxx"
@@ -25,17 +24,12 @@ cmCPackInnoSetupGenerator::~cmCPackInnoSetupGenerator() = default;
bool cmCPackInnoSetupGenerator::CanGenerate()
{
- // Inno Setup is only available for Windows
-#ifdef _WIN32
return true;
-#else
- return false;
-#endif
}
int cmCPackInnoSetupGenerator::InitializeInternal()
{
- if (cmIsOn(GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
+ if (GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
cmCPackLogger(cmCPackLog::LOG_WARNING,
"Inno Setup Generator cannot work with "
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
@@ -64,7 +58,8 @@ int cmCPackInnoSetupGenerator::InitializeInternal()
return 0;
}
- const std::string isccCmd = cmStrCat(QuotePath(isccPath), "/?");
+ const std::string isccCmd =
+ cmStrCat(QuotePath(isccPath, PathType::Native), "/?");
cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"Test Inno Setup version: " << isccCmd << std::endl);
std::string output;
@@ -613,7 +608,6 @@ bool cmCPackInnoSetupGenerator::ProcessComponents()
// Components
std::vector<cmCPackComponent*> downloadedComponents;
- std::stack<cmCPackComponentGroup*> groups;
for (auto& i : Components) {
cmCPackInnoSetupKeyValuePairs params;
cmCPackComponent* component = &i.second;
@@ -871,8 +865,8 @@ bool cmCPackInnoSetupGenerator::Compile()
}
const std::string& isccCmd =
- cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM")), ' ',
- cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
+ cmStrCat(QuotePath(GetOption("CPACK_INSTALLER_PROGRAM"), PathType::Native),
+ ' ', cmJoin(isccArgs, " "), ' ', QuotePath(isScriptFile));
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << isccCmd << std::endl);
@@ -940,7 +934,7 @@ bool cmCPackInnoSetupGenerator::BuildDownloadedComponentArchive(
// Build the list of files to go into this archive
const std::string& zipListFileName =
cmStrCat(GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
- const bool needQuotesInFile = cmIsOn(GetOption("CPACK_ZIP_NEED_QUOTES"));
+ const bool needQuotesInFile = GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);
for (const std::string& i : component->Files) {
@@ -1138,8 +1132,16 @@ std::string cmCPackInnoSetupGenerator::Quote(const std::string& string)
return cmStrCat('"', nString, '"');
}
-std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path)
+std::string cmCPackInnoSetupGenerator::QuotePath(const std::string& path,
+ PathType type)
{
+#ifdef _WIN32
+ static_cast<void>(type);
+#else
+ if (type == PathType::Native) {
+ return Quote(cmSystemTools::ConvertToUnixOutputPath(path));
+ }
+#endif
return Quote(cmSystemTools::ConvertToWindowsOutputPath(path));
}
diff --git a/Source/CPack/cmCPackInnoSetupGenerator.h b/Source/CPack/cmCPackInnoSetupGenerator.h
index 342f227..e057e6c 100644
--- a/Source/CPack/cmCPackInnoSetupGenerator.h
+++ b/Source/CPack/cmCPackInnoSetupGenerator.h
@@ -49,6 +49,12 @@ protected:
inline bool SupportsComponentInstallation() const override { return true; }
private:
+ enum class PathType
+ {
+ Windows,
+ Native,
+ };
+
bool ProcessSetupSection();
bool ProcessFiles();
bool ProcessComponents();
@@ -92,7 +98,8 @@ private:
* Paths are converted into the format used by Windows before.
*/
std::string Quote(const std::string& string);
- std::string QuotePath(const std::string& path);
+ std::string QuotePath(const std::string& path,
+ PathType type = PathType::Windows);
/**
* This function replaces the following 5 characters with their %-encoding:
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 7749b29..43b1d76 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -365,7 +365,7 @@ int cmCPackNSISGenerator::PackageFiles()
if (anyDownloadedComponents) {
defines += "!define CPACK_USES_DOWNLOAD\n";
- if (cmIsOn(this->GetOption("CPACK_ADD_REMOVE"))) {
+ if (this->GetOption("CPACK_ADD_REMOVE").IsOn()) {
defines += "!define CPACK_NSIS_ADD_REMOVE\n";
}
}
@@ -412,7 +412,7 @@ int cmCPackNSISGenerator::PackageFiles()
int cmCPackNSISGenerator::InitializeInternal()
{
- if (cmIsOn(this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY"))) {
+ if (this->GetOption("CPACK_INCLUDE_TOPLEVEL_DIRECTORY").IsOn()) {
cmCPackLogger(
cmCPackLog::LOG_WARNING,
"NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY set. "
@@ -801,7 +801,7 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
// size of the installed component.
std::string zipListFileName = cmStrCat(
this->GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
- bool needQuotesInFile = cmIsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES"));
+ bool needQuotesInFile = this->GetOption("CPACK_ZIP_NEED_QUOTES").IsOn();
unsigned long totalSize = 0;
{ // the scope is needed for cmGeneratedFileStream
cmGeneratedFileStream out(zipListFileName);
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 1248d17..2673fee 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -3,7 +3,6 @@
#include "cmCPackSTGZGenerator.h"
#include <cstdio>
-#include <sstream>
#include <string>
#include <vector>
@@ -71,7 +70,6 @@ int cmCPackSTGZGenerator::PackageFiles()
int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
{
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Writing header" << std::endl);
- std::ostringstream str;
int counter = 0;
std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 00c8fa2..39a8e85 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -404,7 +404,9 @@ int main(int argc, char const* const* argv)
"Read CPack config file: " << cpackConfigFile << '\n');
bool cpackConfigFileSpecified = true;
- if (cpackConfigFile.empty()) {
+ if (!cpackConfigFile.empty()) {
+ cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile);
+ } else {
cpackConfigFile = cmStrCat(cmSystemTools::GetCurrentWorkingDirectory(),
"/CPackConfig.cmake");
cpackConfigFileSpecified = false;
@@ -446,7 +448,6 @@ int main(int argc, char const* const* argv)
}
if (cmSystemTools::FileExists(cpackConfigFile)) {
- cpackConfigFile = cmSystemTools::CollapseFullPath(cpackConfigFile);
cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE,
"Read CPack configuration file: " << cpackConfigFile
<< '\n');
@@ -475,32 +476,26 @@ int main(int argc, char const* const* argv)
if (!cpackProjectVendor.empty()) {
globalMF.AddDefinition("CPACK_PACKAGE_VENDOR", cpackProjectVendor);
}
- // if this is not empty it has been set on the command line
- // go for it. Command line override values set in config file.
if (!cpackProjectDirectory.empty()) {
- globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
- }
- // The value has not been set on the command line
- else {
- // get a default value (current working directory)
- cpackProjectDirectory = cmSystemTools::GetCurrentWorkingDirectory();
- // use default value if no value has been provided by the config file
- if (!globalMF.IsSet("CPACK_PACKAGE_DIRECTORY")) {
- globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY",
- cpackProjectDirectory);
+ // The value has been set on the command line. Ensure it is absolute.
+ cpackProjectDirectory =
+ cmSystemTools::CollapseFullPath(cpackProjectDirectory);
+ } else {
+ // The value has not been set on the command line. Check config file.
+ if (cmValue pd = globalMF.GetDefinition("CPACK_PACKAGE_DIRECTORY")) {
+ // The value has been set in the config file. Ensure it is absolute.
+ cpackProjectDirectory = cmSystemTools::CollapseFullPath(*pd);
+ } else {
+ // Default to the current working directory.
+ cpackProjectDirectory = cmSystemTools::GetCurrentWorkingDirectory();
}
}
+ globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
+
for (auto const& cd : definitions) {
globalMF.AddDefinition(cd.first, cd.second);
}
- // Force CPACK_PACKAGE_DIRECTORY as absolute path
- cpackProjectDirectory =
- globalMF.GetSafeDefinition("CPACK_PACKAGE_DIRECTORY");
- cpackProjectDirectory =
- cmSystemTools::CollapseFullPath(cpackProjectDirectory);
- globalMF.AddDefinition("CPACK_PACKAGE_DIRECTORY", cpackProjectDirectory);
-
cmValue cpackModulesPath = globalMF.GetDefinition("CPACK_MODULE_PATH");
if (cpackModulesPath) {
globalMF.AddDefinition("CMAKE_MODULE_PATH", *cpackModulesPath);
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index bb6ccc3..9faabf7 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -365,8 +365,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
const std::string& currentArg, size_t& idx,
- const std::vector<std::string>& allArgs)
+ const std::vector<std::string>& allArgs, bool& validArg)
{
+ bool buildAndTestArg = true;
// --build-and-test options
if (cmHasLiteralPrefix(currentArg, "--build-and-test") &&
idx < allArgs.size() - 1) {
@@ -385,78 +386,68 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments(
<< std::endl);
return 0;
}
- }
- if (cmHasLiteralPrefix(currentArg, "--build-target") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-target") &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildTargets.push_back(allArgs[idx]);
- }
- if (cmHasLiteralPrefix(currentArg, "--build-nocmake")) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-nocmake")) {
this->BuildNoCMake = true;
- }
- if (cmHasLiteralPrefix(currentArg, "--build-run-dir") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-run-dir") &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildRunDir = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--build-two-config")) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-two-config")) {
this->BuildTwoConfig = true;
- }
- if (cmHasLiteralPrefix(currentArg, "--build-exe-dir") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-exe-dir") &&
+ idx < allArgs.size() - 1) {
idx++;
this->ExecutableDirectory = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--test-timeout") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--test-timeout") &&
+ idx < allArgs.size() - 1) {
idx++;
this->Timeout = cmDuration(atof(allArgs[idx].c_str()));
- }
- if (currentArg == "--build-generator" && idx < allArgs.size() - 1) {
+ } else if (currentArg == "--build-generator" && idx < allArgs.size() - 1) {
idx++;
this->BuildGenerator = allArgs[idx];
- }
- if (currentArg == "--build-generator-platform" && idx < allArgs.size() - 1) {
+ } else if (currentArg == "--build-generator-platform" &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildGeneratorPlatform = allArgs[idx];
- }
- if (currentArg == "--build-generator-toolset" && idx < allArgs.size() - 1) {
+ } else if (currentArg == "--build-generator-toolset" &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildGeneratorToolset = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--build-project") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-project") &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildProject = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--build-makeprogram") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-makeprogram") &&
+ idx < allArgs.size() - 1) {
idx++;
this->BuildMakeProgram = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--build-config-sample") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-config-sample") &&
+ idx < allArgs.size() - 1) {
idx++;
this->ConfigSample = allArgs[idx];
- }
- if (cmHasLiteralPrefix(currentArg, "--build-noclean")) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-noclean")) {
this->BuildNoClean = true;
- }
- if (cmHasLiteralPrefix(currentArg, "--build-options")) {
+ } else if (cmHasLiteralPrefix(currentArg, "--build-options")) {
while (idx + 1 < allArgs.size() && allArgs[idx + 1] != "--build-target" &&
allArgs[idx + 1] != "--test-command") {
++idx;
this->BuildOptions.push_back(allArgs[idx]);
}
- }
- if (cmHasLiteralPrefix(currentArg, "--test-command") &&
- idx < allArgs.size() - 1) {
+ } else if (cmHasLiteralPrefix(currentArg, "--test-command") &&
+ idx < allArgs.size() - 1) {
++idx;
this->TestCommand = allArgs[idx];
while (idx + 1 < allArgs.size()) {
++idx;
this->TestCommandArgs.push_back(allArgs[idx]);
}
+ } else {
+ buildAndTestArg = false;
}
+ validArg = validArg || buildAndTestArg;
return 1;
}
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index e022e68..60b3a11 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -29,9 +29,9 @@ public:
int ProcessHandler() override;
//! Set all the build and test arguments
- int ProcessCommandLineArguments(
- const std::string& currentArg, size_t& idx,
- const std::vector<std::string>& allArgs) override;
+ int ProcessCommandLineArguments(const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs,
+ bool& validArg) override;
/*
* Get the output variable
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index 8f7d581..3a5806b 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -9,21 +9,18 @@
#include "cmCTest.h"
#include "cmCurl.h"
+#include "cmList.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmValue.h"
cmCTestCurl::cmCTestCurl(cmCTest* ctest)
+ : CTest(ctest)
+ , CurlOpts(ctest)
{
- this->CTest = ctest;
this->SetProxyType();
- this->UseHttp10 = false;
// In windows, this will init the winsock stuff
::curl_global_init(CURL_GLOBAL_ALL);
- // default is to verify https
- this->VerifyPeerOff = false;
- this->VerifyHostOff = false;
- this->Quiet = false;
- this->TimeOutSeconds = 0;
this->Curl = curl_easy_init();
}
@@ -59,14 +56,23 @@ size_t curlDebugCallback(CURL* /*unused*/, curl_infotype /*unused*/,
}
}
-void cmCTestCurl::SetCurlOptions(std::vector<std::string> const& args)
+cmCTestCurlOpts::cmCTestCurlOpts(cmCTest* ctest)
{
- for (std::string const& arg : args) {
- if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") {
- this->VerifyPeerOff = true;
- }
- if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") {
- this->VerifyHostOff = true;
+ this->TLSVersionOpt =
+ cmCurlParseTLSVersion(ctest->GetCTestConfiguration("TLSVersion"));
+
+ std::string tlsVerify = ctest->GetCTestConfiguration("TLSVerify");
+ if (!tlsVerify.empty()) {
+ this->TLSVerifyOpt = cmIsOn(tlsVerify);
+ } else {
+ cmList args{ ctest->GetCTestConfiguration("CurlOptions") };
+ for (std::string const& arg : args) {
+ if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") {
+ this->TLSVerifyOpt = false;
+ }
+ if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") {
+ this->VerifyHostOff = true;
+ }
}
}
}
@@ -77,10 +83,15 @@ bool cmCTestCurl::InitCurl()
return false;
}
cmCurlSetCAInfo(this->Curl);
- if (this->VerifyPeerOff) {
- curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYPEER, 0);
+ if (this->CurlOpts.TLSVersionOpt) {
+ curl_easy_setopt(this->Curl, CURLOPT_SSLVERSION,
+ *this->CurlOpts.TLSVersionOpt);
+ }
+ if (this->CurlOpts.TLSVerifyOpt) {
+ curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYPEER,
+ *this->CurlOpts.TLSVerifyOpt ? 1 : 0);
}
- if (this->VerifyHostOff) {
+ if (this->CurlOpts.VerifyHostOff) {
curl_easy_setopt(this->Curl, CURLOPT_SSL_VERIFYHOST, 0);
}
if (!this->HTTPProxy.empty()) {
diff --git a/Source/CTest/cmCTestCurl.h b/Source/CTest/cmCTestCurl.h
index d9aa916..7836f4b 100644
--- a/Source/CTest/cmCTestCurl.h
+++ b/Source/CTest/cmCTestCurl.h
@@ -7,10 +7,20 @@
#include <string>
#include <vector>
+#include <cm/optional>
+
#include <cm3p/curl/curl.h>
class cmCTest;
+struct cmCTestCurlOpts
+{
+ cmCTestCurlOpts(cmCTest* ctest);
+ cm::optional<int> TLSVersionOpt;
+ cm::optional<bool> TLSVerifyOpt;
+ bool VerifyHostOff = false;
+};
+
class cmCTestCurl
{
public:
@@ -22,9 +32,6 @@ public:
std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields,
std::string& response);
- // currently only supports CURLOPT_SSL_VERIFYPEER_OFF
- // and CURLOPT_SSL_VERIFYHOST_OFF
- void SetCurlOptions(std::vector<std::string> const& args);
void SetHttpHeaders(std::vector<std::string> const& v)
{
this->HttpHeaders = v;
@@ -40,14 +47,13 @@ protected:
private:
cmCTest* CTest;
- CURL* Curl;
+ cmCTestCurlOpts CurlOpts;
+ CURL* Curl = nullptr;
std::vector<std::string> HttpHeaders;
std::string HTTPProxyAuth;
std::string HTTPProxy;
curl_proxytype HTTPProxyType;
- bool VerifyHostOff;
- bool VerifyPeerOff;
- bool UseHttp10;
- bool Quiet;
- int TimeOutSeconds;
+ bool UseHttp10 = false;
+ bool Quiet = false;
+ int TimeOutSeconds = 0;
};
diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h
index a0197d6..a189d60 100644
--- a/Source/CTest/cmCTestGenericHandler.h
+++ b/Source/CTest/cmCTestGenericHandler.h
@@ -48,7 +48,7 @@ public:
*/
virtual int ProcessCommandLineArguments(
const std::string& /*currentArg*/, size_t& /*idx*/,
- const std::vector<std::string>& /*allArgs*/)
+ const std::vector<std::string>& /*allArgs*/, bool& /*valid*/)
{
return 1;
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 773a305..84ea32b 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -90,7 +90,7 @@ cmCTestMultiProcessHandler::cmCTestMultiProcessHandler(
cmCTestMultiProcessHandler::~cmCTestMultiProcessHandler() = default;
// Set the tests
-void cmCTestMultiProcessHandler::SetTests(TestMap tests,
+bool cmCTestMultiProcessHandler::SetTests(TestMap tests,
PropertiesMap properties)
{
this->PendingTests = std::move(tests);
@@ -102,10 +102,11 @@ void cmCTestMultiProcessHandler::SetTests(TestMap tests,
this->HasInvalidGeneratedResourceSpec =
!this->CheckGeneratedResourceSpec();
if (this->HasCycles || this->HasInvalidGeneratedResourceSpec) {
- return;
+ return false;
}
this->CreateTestCostList();
}
+ return true;
}
// Set the max number of tests that can be run at the same time.
@@ -1215,6 +1216,11 @@ static Json::Value DumpCTestProperties(
properties.append(
DumpCTestProperty("WORKING_DIRECTORY", testProperties.Directory));
}
+ if (!testProperties.CustomProperties.empty()) {
+ for (auto const& it : testProperties.CustomProperties) {
+ properties.append(DumpCTestProperty(it.first, it.second));
+ }
+ }
return properties;
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index f491815..fd6c17f 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -61,7 +61,7 @@ public:
cmCTestMultiProcessHandler(cmCTest* ctest, cmCTestTestHandler* handler);
virtual ~cmCTestMultiProcessHandler();
// Set the tests
- void SetTests(TestMap tests, PropertiesMap properties);
+ bool SetTests(TestMap tests, PropertiesMap properties);
// Set the max number of tests that can be run at the same time.
void SetParallelLevel(cm::optional<size_t> level);
void SetTestLoad(unsigned long load);
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 0beee67..2003ce6 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -563,10 +563,8 @@ int cmCTestScriptHandler::RunCurrentScript()
int cmCTestScriptHandler::CheckOutSourceDir()
{
- std::string command;
std::string output;
int retVal;
- bool res;
if (!cmSystemTools::FileExists(this->SourceDir) &&
!this->CVSCheckOut.empty()) {
@@ -574,7 +572,7 @@ int cmCTestScriptHandler::CheckOutSourceDir()
output.clear();
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Run cvs: " << this->CVSCheckOut << std::endl);
- res = cmSystemTools::RunSingleCommand(
+ bool res = cmSystemTools::RunSingleCommand(
this->CVSCheckOut, &output, &output, &retVal, this->CTestRoot.c_str(),
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
if (!res || retVal != 0) {
@@ -587,8 +585,6 @@ int cmCTestScriptHandler::CheckOutSourceDir()
int cmCTestScriptHandler::BackupDirectories()
{
- int retVal;
-
// compute the backup names
this->BackupSourceDir = cmStrCat(this->SourceDir, "_CMakeBackup");
this->BackupBinaryDir = cmStrCat(this->BinaryDir, "_CMakeBackup");
@@ -608,7 +604,7 @@ int cmCTestScriptHandler::BackupDirectories()
rename(this->BinaryDir.c_str(), this->BackupBinaryDir.c_str());
// we must now checkout the src dir
- retVal = this->CheckOutSourceDir();
+ int retVal = this->CheckOutSourceDir();
if (retVal) {
this->RestoreBackupDirectories();
return retVal;
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index a92f9f2..029f81f 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -55,6 +55,50 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
this->Makefile, "DropLocation", "CTEST_DROP_LOCATION", this->Quiet);
}
+ if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
+ this->Makefile, "TLSVersion", "CTEST_TLS_VERSION", this->Quiet)) {
+ if (cmValue tlsVersionVar =
+ this->Makefile->GetDefinition("CMAKE_TLS_VERSION")) {
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "SetCTestConfiguration from CMAKE_TLS_VERSION:TLSVersion:"
+ << *tlsVersionVar << std::endl,
+ this->Quiet);
+ this->CTest->SetCTestConfiguration("TLSVersion", *tlsVersionVar,
+ this->Quiet);
+ } else if (cm::optional<std::string> tlsVersionEnv =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERSION")) {
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "SetCTestConfiguration from ENV{CMAKE_TLS_VERSION}:TLSVersion:"
+ << *tlsVersionEnv << std::endl,
+ this->Quiet);
+ this->CTest->SetCTestConfiguration("TLSVersion", *tlsVersionEnv,
+ this->Quiet);
+ }
+ }
+ if (!this->CTest->SetCTestConfigurationFromCMakeVariable(
+ this->Makefile, "TLSVerify", "CTEST_TLS_VERIFY", this->Quiet)) {
+ if (cmValue tlsVerifyVar =
+ this->Makefile->GetDefinition("CMAKE_TLS_VERIFY")) {
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:"
+ << *tlsVerifyVar << std::endl,
+ this->Quiet);
+ this->CTest->SetCTestConfiguration("TLSVerify", *tlsVerifyVar,
+ this->Quiet);
+ } else if (cm::optional<std::string> tlsVerifyEnv =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERIFY")) {
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
+ "SetCTestConfiguration from ENV{CMAKE_TLS_VERIFY}:TLSVerify:"
+ << *tlsVerifyEnv << std::endl,
+ this->Quiet);
+ this->CTest->SetCTestConfiguration("TLSVerify", *tlsVerifyEnv,
+ this->Quiet);
+ }
+ }
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CurlOptions", "CTEST_CURL_OPTIONS", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index db8a054..e69a7fe 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -8,6 +8,7 @@
#include <sstream>
#include <cm/iomanip>
+#include <cm/optional>
#include <cmext/algorithm>
#include <cm3p/curl/curl.h>
@@ -22,7 +23,6 @@
#include "cmCurl.h"
#include "cmDuration.h"
#include "cmGeneratedFileStream.h"
-#include "cmList.h"
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
@@ -140,13 +140,14 @@ void cmCTestSubmitHandler::Initialize()
int cmCTestSubmitHandler::ProcessCommandLineArguments(
const std::string& currentArg, size_t& idx,
- const std::vector<std::string>& allArgs)
+ const std::vector<std::string>& allArgs, bool& validArg)
{
if (cmHasLiteralPrefix(currentArg, "--http-header") &&
idx < allArgs.size() - 1) {
++idx;
this->HttpHeaders.push_back(allArgs[idx]);
this->CommandLineHttpHeaders.push_back(allArgs[idx]);
+ validArg = true;
}
return 1;
}
@@ -172,30 +173,32 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
/* In windows, this will init the winsock stuff */
::curl_global_init(CURL_GLOBAL_ALL);
- std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
- cmList args{ curlopt };
- bool verifyPeerOff = false;
- bool verifyHostOff = false;
- for (std::string const& arg : args) {
- if (arg == "CURLOPT_SSL_VERIFYPEER_OFF") {
- verifyPeerOff = true;
- }
- if (arg == "CURLOPT_SSL_VERIFYHOST_OFF") {
- verifyHostOff = true;
- }
- }
+ cmCTestCurlOpts curlOpts(this->CTest);
for (std::string const& file : files) {
/* get a curl handle */
curl = curl_easy_init();
if (curl) {
cmCurlSetCAInfo(curl);
- if (verifyPeerOff) {
+ if (curlOpts.TLSVersionOpt) {
+ cm::optional<std::string> tlsVersionStr =
+ cmCurlPrintTLSVersion(*curlOpts.TLSVersionOpt);
+ cmCTestOptionalLog(
+ this->CTest, HANDLER_VERBOSE_OUTPUT,
+ " Set CURLOPT_SSLVERSION to "
+ << (tlsVersionStr ? *tlsVersionStr : "unknown value") << "\n",
+ this->Quiet);
+ curl_easy_setopt(curl, CURLOPT_SSLVERSION, *curlOpts.TLSVersionOpt);
+ }
+ if (curlOpts.TLSVerifyOpt) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
- " Set CURLOPT_SSL_VERIFYPEER to off\n",
+ " Set CURLOPT_SSL_VERIFYPEER to "
+ << (*curlOpts.TLSVerifyOpt ? "on" : "off")
+ << "\n",
this->Quiet);
- curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,
+ *curlOpts.TLSVerifyOpt ? 1 : 0);
}
- if (verifyHostOff) {
+ if (curlOpts.VerifyHostOff) {
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Set CURLOPT_SSL_VERIFYHOST to off\n",
this->Quiet);
@@ -295,7 +298,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(
upload_as += "&MD5=";
- if (cmIsOn(this->GetOption("InternalTest"))) {
+ if (this->GetOption("InternalTest").IsOn()) {
upload_as += "ffffffffffffffffffffffffffffffff";
} else {
cmCryptoHash hasher(cmCryptoHash::AlgoMD5);
@@ -518,9 +521,6 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
}
cmCTestCurl curl(this->CTest);
curl.SetQuiet(this->Quiet);
- std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions"));
- cmList args{ curlopt };
- curl.SetCurlOptions(args);
auto submitInactivityTimeout = this->GetSubmitInactivityTimeout();
if (submitInactivityTimeout != 0) {
curl.SetTimeOutSeconds(submitInactivityTimeout);
@@ -540,7 +540,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
fields = url.substr(pos + 1);
url.erase(pos);
}
- bool internalTest = cmIsOn(this->GetOption("InternalTest"));
+ bool internalTest = this->GetOption("InternalTest").IsOn();
// Get RETRY_COUNT and RETRY_DELAY values if they were set.
std::string retryDelayString = *this->GetOption("RetryDelay");
diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h
index e8eb38a..d152b71 100644
--- a/Source/CTest/cmCTestSubmitHandler.h
+++ b/Source/CTest/cmCTestSubmitHandler.h
@@ -35,9 +35,9 @@ public:
void Initialize() override;
//! Set all the submit arguments
- int ProcessCommandLineArguments(
- const std::string& currentArg, size_t& idx,
- const std::vector<std::string>& allArgs) override;
+ int ProcessCommandLineArguments(const std::string& currentArg, size_t& idx,
+ const std::vector<std::string>& allArgs,
+ bool& validArg) override;
/** Specify a set of parts (by name) to submit. */
void SelectParts(std::set<cmCTest::Part> const& parts);
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 9184c4a..2018b73 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -522,8 +522,8 @@ bool cmCTestTestHandler::ProcessOptions()
{
// Update internal data structure from generic one
this->SetTestsToRunInformation(this->GetOption("TestsToRunInformation"));
- this->SetUseUnion(cmIsOn(this->GetOption("UseUnion")));
- if (cmIsOn(this->GetOption("ScheduleRandom"))) {
+ this->SetUseUnion(this->GetOption("UseUnion").IsOn());
+ if (this->GetOption("ScheduleRandom").IsOn()) {
this->CTest->SetScheduleType("Random");
}
if (cmValue repeat = this->GetOption("Repeat")) {
@@ -609,7 +609,7 @@ bool cmCTestTestHandler::ProcessOptions()
if (val) {
this->ExcludeTestListFile = val;
}
- this->SetRerunFailed(cmIsOn(this->GetOption("RerunFailed")));
+ this->SetRerunFailed(this->GetOption("RerunFailed").IsOn());
return true;
}
@@ -934,7 +934,6 @@ bool cmCTestTestHandler::ComputeTestList()
// Now create a final list of tests to run
int cnt = 0;
inREcnt = 0;
- std::string last_directory;
ListOfTests finalList;
for (cmCTestTestProperties& tp : this->TestList) {
cnt++;
@@ -1423,7 +1422,9 @@ bool cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
properties[p.Index] = &p;
}
parallel->SetResourceSpecFile(this->ResourceSpecFile);
- parallel->SetTests(std::move(tests), std::move(properties));
+ if (!parallel->SetTests(std::move(tests), std::move(properties))) {
+ return false;
+ }
parallel->SetPassFailVectors(&passed, &failed);
this->TestResults.clear();
parallel->SetTestResults(&this->TestResults);
@@ -2448,6 +2449,8 @@ bool cmCTestTestHandler::SetTestsProperties(
rt.TimeoutRegularExpressions.emplace_back(cr, cr);
}
}
+ } else {
+ rt.CustomProperties[key] = val;
}
}
}
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 6932800..dd1bc59 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -145,6 +145,7 @@ public:
std::vector<std::pair<cmsys::RegularExpression, std::string>>
TimeoutRegularExpressions;
std::map<std::string, std::string> Measurements;
+ std::map<std::string, std::string> CustomProperties;
bool IsInBasedOnREOptions = true;
bool WillFail = false;
bool Disabled = false;
diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx
index 9d92aad..59e2b88 100644
--- a/Source/CTest/cmCTestUploadHandler.cxx
+++ b/Source/CTest/cmCTestUploadHandler.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestUploadHandler.h"
+#include <chrono>
#include <ostream>
#include <string>
@@ -54,6 +55,7 @@ int cmCTestUploadHandler::ProcessHandler()
std::string("ctest-") + cmVersion::GetCMakeVersion());
this->CTest->AddSiteProperties(xml);
xml.StartElement("Upload");
+ xml.Element("Time", std::chrono::system_clock::now());
for (std::string const& file : this->Files) {
cmCTestOptionalLog(this->CTest, OUTPUT,
diff --git a/Source/Checks/Curses/CMakeLists.txt b/Source/Checks/Curses/CMakeLists.txt
index 6f5f145..5d0e240 100644
--- a/Source/Checks/Curses/CMakeLists.txt
+++ b/Source/Checks/Curses/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...3.28 FATAL_ERROR)
project(CheckCurses C)
set(CURSES_NEED_NCURSES TRUE)
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake
index 0262746..02ebaa6 100644
--- a/Source/Checks/cm_cxx_features.cmake
+++ b/Source/Checks/cm_cxx_features.cmake
@@ -43,7 +43,7 @@ function(cm_check_cxx_feature name)
# Filter out MSVC output that looks like a command-line warning.
string(REGEX REPLACE "[^\n]*warning D[0-9][0-9][0-9][0-9][^\n]*" "" check_output "${check_output}")
# Filter out warnings caused by user flags.
- string(REGEX REPLACE "[^\n]*warning:[^\n]*-Winvalid-command-line-argument[^\n]*" "" check_output "${check_output}")
+ string(REGEX REPLACE "[^\n]*warning:[^\n]*-W(invalid|unused)-command-line-argument[^\n]*" "" check_output "${check_output}")
# Filter out warnings caused by local configuration.
string(REGEX REPLACE "[^\n]*warning:[^\n]*directory not found for option[^\n]*" "" check_output "${check_output}")
string(REGEX REPLACE "[^\n]*warning:[^\n]*object file compiled with -mlong-branch which is no longer needed[^\n]*" "" check_output "${check_output}")
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index 0b104ea..3a47485 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -54,7 +54,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
switch (state->GetCacheEntryType(key)) {
case cmStateEnums::BOOL: {
auto bw = cm::make_unique<cmCursesBoolWidget>(this->EntryWidth, 1, 1, 1);
- bw->SetValueAsBool(cmIsOn(*value));
+ bw->SetValueAsBool(value.IsOn());
this->Entry = std::move(bw);
break;
}
diff --git a/Source/LexerParser/cmGccDepfileLexer.cxx b/Source/LexerParser/cmGccDepfileLexer.cxx
index ca5577e..d926c8b 100644
--- a/Source/LexerParser/cmGccDepfileLexer.cxx
+++ b/Source/LexerParser/cmGccDepfileLexer.cxx
@@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 12
-#define YY_END_OF_BUFFER 13
+#define YY_NUM_RULES 13
+#define YY_END_OF_BUFFER 14
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -557,11 +557,12 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static const flex_int16_t yy_accept[31] =
+static const flex_int16_t yy_accept[32] =
{ 0,
- 0, 0, 13, 11, 9, 6, 11, 10, 11, 11,
- 11, 9, 0, 6, 10, 1, 8, 7, 0, 0,
- 5, 0, 3, 2, 0, 8, 0, 4, 0, 0
+ 0, 0, 14, 12, 10, 7, 12, 11, 12, 12,
+ 12, 10, 0, 7, 11, 1, 9, 8, 0, 0,
+ 6, 0, 4, 2, 3, 0, 9, 0, 5, 0,
+ 0
} ;
static const YY_CHAR yy_ec[256] =
@@ -601,40 +602,40 @@ static const YY_CHAR yy_meta[11] =
1, 2, 1, 1, 2, 1, 1, 1, 1, 3
} ;
-static const flex_int16_t yy_base[33] =
+static const flex_int16_t yy_base[34] =
{ 0,
- 0, 0, 36, 46, 25, 46, 31, 27, 18, 9,
+ 0, 0, 39, 46, 26, 46, 32, 28, 25, 9,
17, 15, 25, 46, 17, 46, 0, 46, 15, 27,
- 46, 14, 46, 46, 27, 46, 13, 46, 33, 46,
- 42, 13
+ 46, 14, 46, 46, 46, 27, 46, 13, 46, 33,
+ 46, 42, 13
} ;
-static const flex_int16_t yy_def[33] =
+static const flex_int16_t yy_def[34] =
{ 0,
- 30, 1, 30, 30, 31, 30, 30, 30, 30, 30,
- 30, 31, 30, 30, 30, 30, 32, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 0,
- 30, 30
+ 31, 1, 31, 31, 32, 31, 31, 31, 31, 31,
+ 31, 32, 31, 31, 31, 31, 33, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+ 0, 31, 31
} ;
static const flex_int16_t yy_nxt[57] =
{ 0,
4, 5, 6, 7, 5, 8, 4, 9, 10, 11,
- 17, 18, 19, 17, 17, 26, 21, 18, 20, 21,
- 22, 23, 15, 24, 13, 16, 25, 21, 22, 26,
- 27, 28, 15, 14, 13, 30, 29, 23, 30, 30,
- 30, 30, 25, 12, 12, 3, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30
+ 17, 18, 19, 17, 17, 27, 21, 18, 20, 21,
+ 22, 23, 15, 24, 13, 25, 26, 21, 22, 27,
+ 28, 29, 16, 15, 14, 13, 30, 23, 31, 31,
+ 31, 31, 26, 12, 12, 3, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31
} ;
static const flex_int16_t yy_chk[57] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 10, 10, 10, 10, 32, 27, 22, 19, 10, 11,
- 11, 11, 15, 11, 12, 9, 11, 13, 13, 20,
- 20, 25, 8, 7, 5, 3, 25, 29, 0, 0,
- 0, 0, 29, 31, 31, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30
+ 10, 10, 10, 10, 33, 28, 22, 19, 10, 11,
+ 11, 11, 15, 11, 12, 11, 11, 13, 13, 20,
+ 20, 26, 9, 8, 7, 5, 26, 30, 3, 0,
+ 0, 0, 30, 32, 32, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31
} ;
/* The intent behind this definition is that it'll catch
@@ -930,7 +931,7 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 31 )
+ if ( yy_current_state >= 32 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -977,6 +978,13 @@ YY_RULE_SETUP
case 3:
YY_RULE_SETUP
{
+ // Unescape the colon.
+ yyextra->addToCurrentPath(":");
+ }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+{
// 2N+1 backslashes plus space -> N backslashes plus space.
size_t c = (strlen(yytext) - 1) / 2;
std::string s(c, '\\');
@@ -984,7 +992,7 @@ YY_RULE_SETUP
yyextra->addToCurrentPath(s.c_str());
}
YY_BREAK
-case 4:
+case 5:
YY_RULE_SETUP
{
// 2N backslashes plus space -> 2N backslashes, end of filename.
@@ -993,24 +1001,24 @@ YY_RULE_SETUP
yyextra->newDependency();
}
YY_BREAK
-case 5:
-/* rule 5 can match eol */
+case 6:
+/* rule 6 can match eol */
YY_RULE_SETUP
{
// A line continuation ends the current file name.
yyextra->newRuleOrDependency();
}
YY_BREAK
-case 6:
-/* rule 6 can match eol */
+case 7:
+/* rule 7 can match eol */
YY_RULE_SETUP
{
// A newline ends the current file name and the current rule.
yyextra->newEntry();
}
YY_BREAK
-case 7:
-/* rule 7 can match eol */
+case 8:
+/* rule 8 can match eol */
YY_RULE_SETUP
{
// A colon ends the rules
@@ -1019,8 +1027,8 @@ YY_RULE_SETUP
yyextra->newEntry();
}
YY_BREAK
-case 8:
-/* rule 8 can match eol */
+case 9:
+/* rule 9 can match eol */
YY_RULE_SETUP
{
// A colon followed by space or line continuation ends the rules
@@ -1028,28 +1036,28 @@ YY_RULE_SETUP
yyextra->newDependency();
}
YY_BREAK
-case 9:
+case 10:
YY_RULE_SETUP
{
// Rules and dependencies are separated by blocks of whitespace.
yyextra->newRuleOrDependency();
}
YY_BREAK
-case 10:
+case 11:
YY_RULE_SETUP
{
// Got a span of plain text.
yyextra->addToCurrentPath(yytext);
}
YY_BREAK
-case 11:
+case 12:
YY_RULE_SETUP
{
// Got an otherwise unmatched character.
yyextra->addToCurrentPath(yytext);
}
YY_BREAK
-case 12:
+case 13:
YY_RULE_SETUP
ECHO;
YY_BREAK
@@ -1351,7 +1359,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 31 )
+ if ( yy_current_state >= 32 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1380,11 +1388,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 31 )
+ if ( yy_current_state >= 32 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 30);
+ yy_is_jam = (yy_current_state == 31);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
diff --git a/Source/LexerParser/cmGccDepfileLexer.in.l b/Source/LexerParser/cmGccDepfileLexer.in.l
index 6336b5f..a0a0f22 100644
--- a/Source/LexerParser/cmGccDepfileLexer.in.l
+++ b/Source/LexerParser/cmGccDepfileLexer.in.l
@@ -27,6 +27,10 @@ NEWLINE \r?\n
// Unescape the hash.
yyextra->addToCurrentPath("#");
}
+\\: {
+ // Unescape the colon.
+ yyextra->addToCurrentPath(":");
+ }
(\\\\)*\\[ ] {
// 2N+1 backslashes plus space -> N backslashes plus space.
size_t c = (strlen(yytext) - 1) / 2;
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index 29fc09b..9113dfd 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -11,6 +11,7 @@
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
+#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmValue.h"
@@ -26,7 +27,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
- if (cmIsOff(mf.GetDefinition("BUILD_SHARED_LIBS"))) {
+ if (mf.GetDefinition("BUILD_SHARED_LIBS").IsOff()) {
type = cmStateEnums::STATIC_LIBRARY;
}
bool excludeFromAll = false;
@@ -226,14 +227,35 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
if ((type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) &&
!mf.GetState()->GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) {
- mf.IssueMessage(
- MessageType::AUTHOR_WARNING,
- cmStrCat(
- "ADD_LIBRARY called with ",
- (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE"),
- " option but the target platform does not support dynamic linking. ",
- "Building a STATIC library instead. This may lead to problems."));
- type = cmStateEnums::STATIC_LIBRARY;
+ switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0164)) {
+ case cmPolicies::WARN:
+ mf.IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ cmStrCat(
+ "ADD_LIBRARY called with ",
+ (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE"),
+ " option but the target platform does not support dynamic "
+ "linking. ",
+ "Building a STATIC library instead. This may lead to problems."));
+ CM_FALLTHROUGH;
+ case cmPolicies::OLD:
+ type = cmStateEnums::STATIC_LIBRARY;
+ break;
+ case cmPolicies::NEW:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "ADD_LIBRARY called with ",
+ (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE"),
+ " option but the target platform does not support dynamic "
+ "linking."));
+ cmSystemTools::SetFatalErrorOccurred();
+ return false;
+ default:
+ break;
+ }
}
// Handle imported target creation.
diff --git a/Source/cmArgumentParserTypes.h b/Source/cmArgumentParserTypes.h
index 7daae09..3e0fae4 100644
--- a/Source/cmArgumentParserTypes.h
+++ b/Source/cmArgumentParserTypes.h
@@ -4,7 +4,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
-#if defined(__SUNPRO_CC)
+#if defined(__SUNPRO_CC) || defined(__EDG__)
# include <string>
# include <vector>
diff --git a/Source/cmBinUtilsMacOSMachOLinker.cxx b/Source/cmBinUtilsMacOSMachOLinker.cxx
index 90e0891..7db7cb0 100644
--- a/Source/cmBinUtilsMacOSMachOLinker.cxx
+++ b/Source/cmBinUtilsMacOSMachOLinker.cxx
@@ -126,10 +126,16 @@ bool cmBinUtilsMacOSMachOLinker::GetFileDependencies(
this->Archive->AddResolvedPath(filename, path, unique,
dep_file_info->rpaths);
- if (unique &&
- !this->ScanDependencies(path, dep_file_info->libs,
- dep_file_info->rpaths, executablePath)) {
- return false;
+ if (unique) {
+ std::vector<std::string> combinedParentRpaths =
+ dep_file_info->rpaths;
+ combinedParentRpaths.insert(combinedParentRpaths.end(),
+ rpaths.begin(), rpaths.end());
+ if (!this->ScanDependencies(path, dep_file_info->libs,
+ combinedParentRpaths,
+ executablePath)) {
+ return false;
+ }
}
}
} else {
diff --git a/Source/cmCMakeLanguageCommand.cxx b/Source/cmCMakeLanguageCommand.cxx
index 9ffc363..fe9257e 100644
--- a/Source/cmCMakeLanguageCommand.cxx
+++ b/Source/cmCMakeLanguageCommand.cxx
@@ -345,27 +345,18 @@ bool cmCMakeLanguageCommandGET_EXPERIMENTAL_FEATURE_ENABLED(
auto const& featureName = expandedArgs[1];
auto const& variableName = expandedArgs[2];
- auto feature = cmExperimental::Feature::Sentinel;
- for (std::size_t i = 0;
- i < static_cast<std::size_t>(cmExperimental::Feature::Sentinel); i++) {
- if (cmExperimental::DataForFeature(static_cast<cmExperimental::Feature>(i))
- .Name == featureName) {
- feature = static_cast<cmExperimental::Feature>(i);
- break;
+ if (auto feature = cmExperimental::FeatureByName(featureName)) {
+ if (cmExperimental::HasSupportEnabled(makefile, *feature)) {
+ makefile.AddDefinition(variableName, "TRUE");
+ } else {
+ makefile.AddDefinition(variableName, "FALSE");
}
- }
- if (feature == cmExperimental::Feature::Sentinel) {
+ } else {
return FatalError(status,
cmStrCat("Experimental feature name \"", featureName,
"\" does not exist."));
}
- if (cmExperimental::HasSupportEnabled(makefile, feature)) {
- makefile.AddDefinition(variableName, "TRUE");
- } else {
- makefile.AddDefinition(variableName, "FALSE");
- }
-
return true;
}
}
diff --git a/Source/cmCMakePresetsGraph.cxx b/Source/cmCMakePresetsGraph.cxx
index d37c8a4..008f2dd 100644
--- a/Source/cmCMakePresetsGraph.cxx
+++ b/Source/cmCMakePresetsGraph.cxx
@@ -10,6 +10,7 @@
#include <iterator>
#include <utility>
+#include <cm/memory>
#include <cm/string_view>
#include "cmsys/RegularExpression.hxx"
@@ -49,6 +50,11 @@ template <typename T>
using PresetPair = cmCMakePresetsGraph::PresetPair<T>;
using ExpandMacroResult = cmCMakePresetsGraphInternal::ExpandMacroResult;
using MacroExpander = cmCMakePresetsGraphInternal::MacroExpander;
+using MacroExpanderVector = cmCMakePresetsGraphInternal::MacroExpanderVector;
+using BaseMacroExpander = cmCMakePresetsGraphInternal::BaseMacroExpander;
+template <typename T>
+using PresetMacroExpander =
+ cmCMakePresetsGraphInternal::PresetMacroExpander<T>;
using cmCMakePresetsGraphInternal::ExpandMacros;
void InheritString(std::string& child, const std::string& parent)
@@ -203,13 +209,61 @@ bool IsValidMacroNamespace(const std::string& str)
}
ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status,
- const std::vector<MacroExpander>& macroExpanders,
+ MacroExpanderVector const& macroExpanders,
int version);
+template <class T>
+class EnvironmentMacroExpander : public MacroExpander
+{
+ std::map<std::string, CycleStatus>& EnvCycles;
+ cm::optional<T>& Out;
+ MacroExpanderVector& MacroExpanders;
+
+public:
+ EnvironmentMacroExpander(MacroExpanderVector& macroExpanders,
+ cm::optional<T>& out,
+ std::map<std::string, CycleStatus>& envCycles)
+ : EnvCycles(envCycles)
+ , Out(out)
+ , MacroExpanders(macroExpanders)
+ {
+ }
+ ExpandMacroResult operator()(const std::string& macroNamespace,
+ const std::string& macroName,
+ std::string& macroOut,
+ int version) const override
+ {
+ if (macroNamespace == "env" && !macroName.empty() && Out) {
+ auto v = Out->Environment.find(macroName);
+ if (v != Out->Environment.end() && v->second) {
+ auto e =
+ VisitEnv(*v->second, EnvCycles[macroName], MacroExpanders, version);
+ if (e != ExpandMacroResult::Ok) {
+ return e;
+ }
+ macroOut += *v->second;
+ return ExpandMacroResult::Ok;
+ }
+ }
+
+ if (macroNamespace == "env" || macroNamespace == "penv") {
+ if (macroName.empty()) {
+ return ExpandMacroResult::Error;
+ }
+ if (cm::optional<std::string> value =
+ cmSystemTools::GetEnvVar(macroName)) {
+ macroOut += *value;
+ }
+ return ExpandMacroResult::Ok;
+ }
+
+ return ExpandMacroResult::Ignore;
+ }
+};
bool ExpandMacros(const cmCMakePresetsGraph& graph,
const ConfigurePreset& preset,
cm::optional<ConfigurePreset>& out,
- const std::vector<MacroExpander>& macroExpanders)
+ MacroExpanderVector const& macroExpanders)
{
std::string binaryDir = preset.BinaryDir;
CHECK_EXPAND(out, binaryDir, macroExpanders, graph.GetVersion(preset));
@@ -251,7 +305,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph,
bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset,
cm::optional<BuildPreset>& out,
- const std::vector<MacroExpander>& macroExpanders)
+ MacroExpanderVector const& macroExpanders)
{
for (auto& target : out->Targets) {
CHECK_EXPAND(out, target, macroExpanders, graph.GetVersion(preset));
@@ -267,7 +321,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const BuildPreset& preset,
bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset,
cm::optional<TestPreset>& out,
- const std::vector<MacroExpander>& macroExpanders)
+ MacroExpanderVector const& macroExpanders)
{
for (auto& overwrite : out->OverwriteConfigurationFile) {
CHECK_EXPAND(out, overwrite, macroExpanders, graph.GetVersion(preset));
@@ -321,7 +375,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph, const TestPreset& preset,
bool ExpandMacros(const cmCMakePresetsGraph& graph,
const PackagePreset& preset,
cm::optional<PackagePreset>& out,
- const std::vector<MacroExpander>& macroExpanders)
+ MacroExpanderVector const& macroExpanders)
{
for (auto& variable : out->Variables) {
CHECK_EXPAND(out, variable.second, macroExpanders,
@@ -343,7 +397,7 @@ bool ExpandMacros(const cmCMakePresetsGraph& graph,
bool ExpandMacros(const cmCMakePresetsGraph& /*graph*/,
const WorkflowPreset& /*preset*/,
cm::optional<WorkflowPreset>& /*out*/,
- const std::vector<MacroExpander>& /*macroExpanders*/)
+ MacroExpanderVector const& /*macroExpanders*/)
{
return true;
}
@@ -359,100 +413,13 @@ bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset,
envCycles[v.first] = CycleStatus::Unvisited;
}
- std::vector<MacroExpander> macroExpanders;
+ MacroExpanderVector macroExpanders{};
- MacroExpander defaultMacroExpander =
- [&graph, &preset](const std::string& macroNamespace,
- const std::string& macroName, std::string& macroOut,
- int version) -> ExpandMacroResult {
- if (macroNamespace.empty()) {
- if (macroName == "sourceDir") {
- macroOut += graph.SourceDir;
- return ExpandMacroResult::Ok;
- }
- if (macroName == "sourceParentDir") {
- macroOut += cmSystemTools::GetParentDirectory(graph.SourceDir);
- return ExpandMacroResult::Ok;
- }
- if (macroName == "sourceDirName") {
- macroOut += cmSystemTools::GetFilenameName(graph.SourceDir);
- return ExpandMacroResult::Ok;
- }
- if (macroName == "presetName") {
- macroOut += preset.Name;
- return ExpandMacroResult::Ok;
- }
- if (macroName == "generator") {
- // Generator only makes sense if preset is not hidden.
- if (!preset.Hidden) {
- macroOut += graph.GetGeneratorForPreset(preset.Name);
- }
- return ExpandMacroResult::Ok;
- }
- if (macroName == "dollar") {
- macroOut += '$';
- return ExpandMacroResult::Ok;
- }
- if (macroName == "hostSystemName") {
- if (version < 3) {
- return ExpandMacroResult::Error;
- }
- macroOut += cmSystemTools::GetSystemName();
- return ExpandMacroResult::Ok;
- }
- if (macroName == "fileDir") {
- if (version < 4) {
- return ExpandMacroResult::Error;
- }
- macroOut +=
- cmSystemTools::GetParentDirectory(preset.OriginFile->Filename);
- return ExpandMacroResult::Ok;
- }
- if (macroName == "pathListSep") {
- if (version < 5) {
- return ExpandMacroResult::Error;
- }
- macroOut += cmSystemTools::GetSystemPathlistSeparator();
- return ExpandMacroResult::Ok;
- }
- }
-
- return ExpandMacroResult::Ignore;
- };
-
- MacroExpander environmentMacroExpander =
- [&macroExpanders, &out, &envCycles](
- const std::string& macroNamespace, const std::string& macroName,
- std::string& result, int version) -> ExpandMacroResult {
- if (macroNamespace == "env" && !macroName.empty() && out) {
- auto v = out->Environment.find(macroName);
- if (v != out->Environment.end() && v->second) {
- auto e =
- VisitEnv(*v->second, envCycles[macroName], macroExpanders, version);
- if (e != ExpandMacroResult::Ok) {
- return e;
- }
- result += *v->second;
- return ExpandMacroResult::Ok;
- }
- }
-
- if (macroNamespace == "env" || macroNamespace == "penv") {
- if (macroName.empty()) {
- return ExpandMacroResult::Error;
- }
- if (cm::optional<std::string> value =
- cmSystemTools::GetEnvVar(macroName)) {
- result += *value;
- }
- return ExpandMacroResult::Ok;
- }
-
- return ExpandMacroResult::Ignore;
- };
-
- macroExpanders.push_back(defaultMacroExpander);
- macroExpanders.push_back(environmentMacroExpander);
+ macroExpanders.push_back(cm::make_unique<BaseMacroExpander>(graph));
+ macroExpanders.push_back(
+ cm::make_unique<PresetMacroExpander<T>>(graph, preset));
+ macroExpanders.push_back(cm::make_unique<EnvironmentMacroExpander<T>>(
+ macroExpanders, out, envCycles));
for (auto& v : out->Environment) {
if (v.second) {
@@ -490,7 +457,7 @@ bool ExpandMacros(cmCMakePresetsGraph& graph, const T& preset,
}
ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status,
- const std::vector<MacroExpander>& macroExpanders,
+ MacroExpanderVector const& macroExpanders,
int version)
{
if (status == CycleStatus::Verified) {
@@ -511,8 +478,7 @@ ExpandMacroResult VisitEnv(std::string& value, CycleStatus& status,
}
ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacros(
- std::string& out, const std::vector<MacroExpander>& macroExpanders,
- int version)
+ std::string& out, MacroExpanderVector const& macroExpanders, int version)
{
std::string result;
std::string macroNamespace;
@@ -591,11 +557,11 @@ ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacros(
ExpandMacroResult cmCMakePresetsGraphInternal::ExpandMacro(
std::string& out, const std::string& macroNamespace,
- const std::string& macroName,
- const std::vector<MacroExpander>& macroExpanders, int version)
+ const std::string& macroName, MacroExpanderVector const& macroExpanders,
+ int version)
{
for (auto const& macroExpander : macroExpanders) {
- auto result = macroExpander(macroNamespace, macroName, out, version);
+ auto result = (*macroExpander)(macroNamespace, macroName, out, version);
if (result != ExpandMacroResult::Ignore) {
return result;
}
@@ -651,8 +617,56 @@ bool TryReachPresetFromWorkflow(
}
}
+ExpandMacroResult BaseMacroExpander::operator()(
+ const std::string& macroNamespace, const std::string& macroName,
+ std::string& macroOut, int version) const
+{
+ if (macroNamespace.empty()) {
+ if (macroName == "sourceDir") {
+ macroOut += Graph.SourceDir;
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "sourceParentDir") {
+ macroOut += cmSystemTools::GetParentDirectory(Graph.SourceDir);
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "sourceDirName") {
+ macroOut += cmSystemTools::GetFilenameName(Graph.SourceDir);
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "dollar") {
+ macroOut += '$';
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "hostSystemName") {
+ if (version < 3) {
+ return ExpandMacroResult::Error;
+ }
+ macroOut += cmSystemTools::GetSystemName();
+ return ExpandMacroResult::Ok;
+ }
+ // Enable fileDir macro expansion for non-preset expanders
+ if (macroName == "fileDir" && File) {
+ if (version < 4) {
+ return ExpandMacroResult::Error;
+ }
+ macroOut += cmSystemTools::GetParentDirectory(File.value());
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "pathListSep") {
+ if (version < 5) {
+ return ExpandMacroResult::Error;
+ }
+ macroOut += cmSystemTools::GetSystemPathlistSeparator();
+ return ExpandMacroResult::Ok;
+ }
+ }
+
+ return ExpandMacroResult::Ignore;
+}
+
bool cmCMakePresetsGraphInternal::EqualsCondition::Evaluate(
- const std::vector<MacroExpander>& expanders, int version,
+ MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const
{
std::string lhs = this->Lhs;
@@ -666,7 +680,7 @@ bool cmCMakePresetsGraphInternal::EqualsCondition::Evaluate(
}
bool cmCMakePresetsGraphInternal::InListCondition::Evaluate(
- const std::vector<MacroExpander>& expanders, int version,
+ MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const
{
std::string str = this->String;
@@ -685,7 +699,7 @@ bool cmCMakePresetsGraphInternal::InListCondition::Evaluate(
}
bool cmCMakePresetsGraphInternal::MatchesCondition::Evaluate(
- const std::vector<MacroExpander>& expanders, int version,
+ MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const
{
std::string str = this->String;
@@ -703,7 +717,7 @@ bool cmCMakePresetsGraphInternal::MatchesCondition::Evaluate(
}
bool cmCMakePresetsGraphInternal::AnyAllOfCondition::Evaluate(
- const std::vector<MacroExpander>& expanders, int version,
+ MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const
{
for (auto const& condition : this->Conditions) {
@@ -729,7 +743,7 @@ bool cmCMakePresetsGraphInternal::AnyAllOfCondition::Evaluate(
}
bool cmCMakePresetsGraphInternal::NotCondition::Evaluate(
- const std::vector<MacroExpander>& expanders, int version,
+ MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const
{
out.reset();
diff --git a/Source/cmCMakePresetsGraphInternal.h b/Source/cmCMakePresetsGraphInternal.h
index 5c76e0e..a67be21 100644
--- a/Source/cmCMakePresetsGraphInternal.h
+++ b/Source/cmCMakePresetsGraphInternal.h
@@ -11,6 +11,7 @@
#include "cmCMakePresetsGraph.h"
#include "cmJSONHelpers.h"
+#include "cmSystemTools.h"
#define CHECK_OK(expr) \
do { \
@@ -27,17 +28,25 @@ enum class ExpandMacroResult
Error,
};
-using MacroExpander = std::function<ExpandMacroResult(
- const std::string&, const std::string&, std::string&, int version)>;
+class MacroExpander
+{
+public:
+ virtual ExpandMacroResult operator()(const std::string& macroNamespace,
+ const std::string& macroName,
+ std::string& macroOut,
+ int version) const = 0;
+ virtual ~MacroExpander() = default;
+};
+using MacroExpanderVector = std::vector<std::unique_ptr<MacroExpander>>;
-ExpandMacroResult ExpandMacros(
- std::string& out, const std::vector<MacroExpander>& macroExpanders,
- int version);
+ExpandMacroResult ExpandMacros(std::string& out,
+ MacroExpanderVector const& macroExpanders,
+ int version);
ExpandMacroResult ExpandMacro(std::string& out,
const std::string& macroNamespace,
const std::string& macroName,
- const std::vector<MacroExpander>& macroExpanders,
+ MacroExpanderVector const& macroExpanders,
int version);
}
@@ -47,17 +56,79 @@ public:
virtual ~Condition() = default;
virtual bool Evaluate(
- const std::vector<cmCMakePresetsGraphInternal::MacroExpander>& expanders,
+ const cmCMakePresetsGraphInternal::MacroExpanderVector& expanders,
int version, cm::optional<bool>& out) const = 0;
virtual bool IsNull() const { return false; }
};
namespace cmCMakePresetsGraphInternal {
+class BaseMacroExpander : public MacroExpander
+{
+ cmCMakePresetsGraph const& Graph;
+ cm::optional<std::string> File;
+
+public:
+ BaseMacroExpander(const cmCMakePresetsGraph& graph)
+ : Graph(graph)
+ {
+ }
+ BaseMacroExpander(const cmCMakePresetsGraph& graph, const std::string& file)
+ : Graph(graph)
+ , File(file)
+ {
+ }
+ ExpandMacroResult operator()(const std::string& macroNamespace,
+ const std::string& macroName,
+ std::string& macroOut,
+ int version) const override;
+};
+
+template <class T>
+class PresetMacroExpander : public MacroExpander
+{
+ cmCMakePresetsGraph const& Graph;
+ T const& Preset;
+
+public:
+ PresetMacroExpander(const cmCMakePresetsGraph& graph, const T& preset)
+ : Graph(graph)
+ , Preset(preset)
+ {
+ }
+ ExpandMacroResult operator()(const std::string& macroNamespace,
+ const std::string& macroName,
+ std::string& macroOut,
+ int version) const override
+ {
+ if (macroNamespace.empty()) {
+ if (macroName == "presetName") {
+ macroOut += Preset.Name;
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "generator") {
+ // Generator only makes sense if preset is not hidden.
+ if (!Preset.Hidden) {
+ macroOut += Graph.GetGeneratorForPreset(Preset.Name);
+ }
+ return ExpandMacroResult::Ok;
+ }
+ if (macroName == "fileDir") {
+ if (version < 4) {
+ return ExpandMacroResult::Error;
+ }
+ macroOut +=
+ cmSystemTools::GetParentDirectory(Preset.OriginFile->Filename);
+ return ExpandMacroResult::Ok;
+ }
+ }
+ return ExpandMacroResult::Ignore;
+ }
+};
class NullCondition : public cmCMakePresetsGraph::Condition
{
- bool Evaluate(const std::vector<MacroExpander>& /*expanders*/,
- int /*version*/, cm::optional<bool>& out) const override
+ bool Evaluate(MacroExpanderVector const& /*expanders*/, int /*version*/,
+ cm::optional<bool>& out) const override
{
out = true;
return true;
@@ -69,8 +140,8 @@ class NullCondition : public cmCMakePresetsGraph::Condition
class ConstCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& /*expanders*/,
- int /*version*/, cm::optional<bool>& out) const override
+ bool Evaluate(MacroExpanderVector const& /*expanders*/, int /*version*/,
+ cm::optional<bool>& out) const override
{
out = this->Value;
return true;
@@ -82,7 +153,7 @@ public:
class EqualsCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& expanders, int version,
+ bool Evaluate(MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const override;
std::string Lhs;
@@ -92,7 +163,7 @@ public:
class InListCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& expanders, int version,
+ bool Evaluate(MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const override;
std::string String;
@@ -102,7 +173,7 @@ public:
class MatchesCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& expanders, int version,
+ bool Evaluate(MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const override;
std::string String;
@@ -112,7 +183,7 @@ public:
class AnyAllOfCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& expanders, int version,
+ bool Evaluate(MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const override;
std::vector<std::unique_ptr<Condition>> Conditions;
@@ -122,7 +193,7 @@ public:
class NotCondition : public cmCMakePresetsGraph::Condition
{
public:
- bool Evaluate(const std::vector<MacroExpander>& expanders, int version,
+ bool Evaluate(MacroExpanderVector const& expanders, int version,
cm::optional<bool>& out) const override;
std::unique_ptr<Condition> SubCondition;
diff --git a/Source/cmCMakePresetsGraphReadJSON.cxx b/Source/cmCMakePresetsGraphReadJSON.cxx
index 0d8ec63..1cf9500 100644
--- a/Source/cmCMakePresetsGraphReadJSON.cxx
+++ b/Source/cmCMakePresetsGraphReadJSON.cxx
@@ -35,10 +35,12 @@ using ArchToolsetStrategy = cmCMakePresetsGraph::ArchToolsetStrategy;
using JSONHelperBuilder = cmJSONHelperBuilder;
using ExpandMacroResult = cmCMakePresetsGraphInternal::ExpandMacroResult;
using MacroExpander = cmCMakePresetsGraphInternal::MacroExpander;
+using MacroExpanderVector = cmCMakePresetsGraphInternal::MacroExpanderVector;
+using cmCMakePresetsGraphInternal::BaseMacroExpander;
using cmCMakePresetsGraphInternal::ExpandMacros;
constexpr int MIN_VERSION = 1;
-constexpr int MAX_VERSION = 8;
+constexpr int MAX_VERSION = 9;
struct CMakeVersion
{
@@ -297,6 +299,29 @@ auto const RootPresetsHelper =
false)
.Bind<std::nullptr_t>("$schema"_s, nullptr,
cmCMakePresetsGraphInternal::SchemaHelper(), false);
+
+class EnvironmentMacroExpander : public MacroExpander
+{
+public:
+ ExpandMacroResult operator()(const std::string& macroNamespace,
+ const std::string& macroName,
+ std::string& macroOut,
+ int /*version*/) const override
+ {
+ if (macroNamespace == "penv") {
+ if (macroName.empty()) {
+ return ExpandMacroResult::Error;
+ }
+ if (cm::optional<std::string> value =
+ cmSystemTools::GetEnvVar(macroName)) {
+ macroOut += *value;
+ }
+ return ExpandMacroResult::Ok;
+ }
+
+ return ExpandMacroResult::Ignore;
+ }
+};
}
namespace cmCMakePresetsGraphInternal {
@@ -706,26 +731,13 @@ bool cmCMakePresetsGraph::ReadJSONFile(const std::string& filename,
return true;
};
- std::vector<MacroExpander> macroExpanders;
+ MacroExpanderVector macroExpanders{};
- MacroExpander environmentMacroExpander =
- [](const std::string& macroNamespace, const std::string& macroName,
- std::string& expanded, int /*version*/) -> ExpandMacroResult {
- if (macroNamespace == "penv") {
- if (macroName.empty()) {
- return ExpandMacroResult::Error;
- }
- if (cm::optional<std::string> value =
- cmSystemTools::GetEnvVar(macroName)) {
- expanded += *value;
- }
- return ExpandMacroResult::Ok;
- }
-
- return ExpandMacroResult::Ignore;
- };
-
- macroExpanders.push_back(environmentMacroExpander);
+ if (v >= 9) {
+ macroExpanders.push_back(
+ cm::make_unique<BaseMacroExpander>(*this, filename));
+ }
+ macroExpanders.push_back(cm::make_unique<EnvironmentMacroExpander>());
for (Json::ArrayIndex i = 0; i < presets.Include.size(); ++i) {
auto include = presets.Include[i];
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 1ae3cb5..e1aefd9 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -760,7 +760,9 @@ bool cmCTest::UpdateCTestConfiguration()
}
if (!this->GetCTestConfiguration("BuildDirectory").empty()) {
this->Impl->BinaryDir = this->GetCTestConfiguration("BuildDirectory");
- cmSystemTools::ChangeDirectory(this->Impl->BinaryDir);
+ if (this->Impl->TestDir.empty()) {
+ cmSystemTools::ChangeDirectory(this->Impl->BinaryDir);
+ }
}
this->Impl->TimeOut =
std::chrono::seconds(atoi(this->GetCTestConfiguration("TimeOut").c_str()));
@@ -1890,6 +1892,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
std::string& errormsg)
{
std::string arg = args[i];
+ cm::string_view noTestsPrefix = "--no-tests=";
if (this->CheckArgument(arg, "-F"_s)) {
this->Impl->Failover = true;
} else if (this->CheckArgument(arg, "-j"_s, "--parallel")) {
@@ -2151,8 +2154,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
this->SetOutputJUnitFileName(std::string(args[i]));
}
- cm::string_view noTestsPrefix = "--no-tests=";
- if (cmHasPrefix(arg, noTestsPrefix)) {
+ else if (cmHasPrefix(arg, noTestsPrefix)) {
cm::string_view noTestsMode =
cm::string_view(arg).substr(noTestsPrefix.length());
if (noTestsMode == "error") {
@@ -2260,6 +2262,8 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
else if (this->CheckArgument(arg, "--rerun-failed"_s)) {
this->GetTestHandler()->SetPersistentOption("RerunFailed", "true");
this->GetMemCheckHandler()->SetPersistentOption("RerunFailed", "true");
+ } else {
+ return false;
}
return true;
}
@@ -2309,7 +2313,7 @@ bool cmCTest::ColoredOutputSupportedByConsole()
}
// handle the -S -SR and -SP arguments
-void cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
+bool cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
bool& SRArgumentSpecified)
{
std::string arg = args[i];
@@ -2324,8 +2328,8 @@ void cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
}
}
- if (this->CheckArgument(arg, "-SR"_s, "--script-run") &&
- i < args.size() - 1) {
+ else if (this->CheckArgument(arg, "-SR"_s, "--script-run") &&
+ i < args.size() - 1) {
SRArgumentSpecified = true;
this->Impl->RunConfigurationScript = true;
i++;
@@ -2333,7 +2337,8 @@ void cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
ch->AddConfigurationScript(args[i], true);
}
- if (this->CheckArgument(arg, "-S"_s, "--script") && i < args.size() - 1) {
+ else if (this->CheckArgument(arg, "-S"_s, "--script") &&
+ i < args.size() - 1) {
this->Impl->RunConfigurationScript = true;
i++;
cmCTestScriptHandler* ch = this->GetScriptHandler();
@@ -2341,7 +2346,10 @@ void cmCTest::HandleScriptArguments(size_t& i, std::vector<std::string>& args,
if (!SRArgumentSpecified) {
ch->AddConfigurationScript(args[i], true);
}
+ } else {
+ return false;
}
+ return true;
}
bool cmCTest::AddVariableDefinition(const std::string& arg)
@@ -2734,16 +2742,18 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
for (size_t i = 1; i < args.size(); ++i) {
// handle the simple commandline arguments
std::string errormsg;
- if (!this->HandleCommandLineArguments(i, args, errormsg)) {
+ bool validArg = this->HandleCommandLineArguments(i, args, errormsg);
+ if (!validArg && !errormsg.empty()) {
cmSystemTools::Error(errormsg);
return 1;
}
+ std::string arg = args[i];
// handle the script arguments -S -SR -SP
- this->HandleScriptArguments(i, args, SRArgumentSpecified);
+ validArg =
+ validArg || this->HandleScriptArguments(i, args, SRArgumentSpecified);
// --dashboard: handle a request for a dashboard
- std::string arg = args[i];
if (this->CheckArgument(arg, "-D"_s, "--dashboard") &&
i < args.size() - 1) {
this->Impl->ProduceXML = true;
@@ -2757,6 +2767,7 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
executeTests = false;
}
}
+ validArg = true;
}
// If it's not exactly -D, but it starts with -D, then try to parse out
@@ -2767,16 +2778,17 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
if (arg != "-D" && cmHasLiteralPrefix(arg, "-D")) {
std::string input = arg.substr(2);
this->AddVariableDefinition(input);
+ validArg = true;
}
// --test-action: calls SetTest(<stage>, /*report=*/ false) to enable
// the corresponding stage
- if (!this->HandleTestActionArgument(ctestExec, i, args)) {
+ if (!this->HandleTestActionArgument(ctestExec, i, args, validArg)) {
executeTests = false;
}
// --test-model: what type of test model
- if (!this->HandleTestModelArgument(ctestExec, i, args)) {
+ if (!this->HandleTestModelArgument(ctestExec, i, args, validArg)) {
executeTests = false;
}
@@ -2788,30 +2800,40 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
if (!this->SubmitExtraFiles(args[i])) {
return 0;
}
+ validArg = true;
}
// --build-and-test options
if (this->CheckArgument(arg, "--build-and-test"_s) &&
i < args.size() - 1) {
cmakeAndTest = true;
+ validArg = true;
}
// --schedule-random
if (this->CheckArgument(arg, "--schedule-random"_s)) {
this->Impl->ScheduleType = "Random";
+ validArg = true;
}
// pass the argument to all the handlers as well, but it may no longer be
// set to what it was originally so I'm not sure this is working as
// intended
for (auto& handler : this->Impl->GetTestingHandlers()) {
- if (!handler->ProcessCommandLineArguments(arg, i, args)) {
+ if (!handler->ProcessCommandLineArguments(arg, i, args, validArg)) {
cmCTestLog(
this, ERROR_MESSAGE,
"Problem parsing command line arguments within a handler\n");
return 0;
}
}
+
+ if (!validArg && cmHasLiteralPrefix(arg, "-") &&
+ !cmHasLiteralPrefix(arg, "--preset")) {
+ cmSystemTools::Error(cmStrCat("Unknown argument: ", arg));
+ cmSystemTools::Error("Run 'ctest --help' for all supported options.");
+ return 1;
+ }
} // the close of the for argument loop
// handle CTEST_PARALLEL_LEVEL environment variable
@@ -2877,12 +2899,14 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
}
bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
- const std::vector<std::string>& args)
+ const std::vector<std::string>& args,
+ bool& validArg)
{
bool success = true;
std::string const& arg = args[i];
if (this->CheckArgument(arg, "-T"_s, "--test-action") &&
(i < args.size() - 1)) {
+ validArg = true;
this->Impl->ProduceXML = true;
i++;
if (!this->SetTest(args[i], false)) {
@@ -2909,12 +2933,14 @@ bool cmCTest::HandleTestActionArgument(const char* ctestExec, size_t& i,
}
bool cmCTest::HandleTestModelArgument(const char* ctestExec, size_t& i,
- const std::vector<std::string>& args)
+ const std::vector<std::string>& args,
+ bool& validArg)
{
bool success = true;
std::string const& arg = args[i];
if (this->CheckArgument(arg, "-M"_s, "--test-model") &&
(i < args.size() - 1)) {
+ validArg = true;
i++;
std::string const& str = args[i];
if (cmSystemTools::LowerCase(str) == "nightly"_s) {
diff --git a/Source/cmCTest.h b/Source/cmCTest.h
index 2ab810c..ae2431c 100644
--- a/Source/cmCTest.h
+++ b/Source/cmCTest.h
@@ -512,7 +512,7 @@ private:
static bool ColoredOutputSupportedByConsole();
/** handle the -S -SP and -SR arguments */
- void HandleScriptArguments(size_t& i, std::vector<std::string>& args,
+ bool HandleScriptArguments(size_t& i, std::vector<std::string>& args,
bool& SRArgumentSpecified);
/** Reread the configuration file */
@@ -531,11 +531,13 @@ private:
/** Handle the --test-action command line argument */
bool HandleTestActionArgument(const char* ctestExec, size_t& i,
- const std::vector<std::string>& args);
+ const std::vector<std::string>& args,
+ bool& validArg);
/** Handle the --test-model command line argument */
bool HandleTestModelArgument(const char* ctestExec, size_t& i,
- const std::vector<std::string>& args);
+ const std::vector<std::string>& args,
+ bool& validArg);
int RunCMakeAndTest(std::string* output);
int ExecuteTests();
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 5c25cb9..51b2300 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -577,7 +577,7 @@ cmValue cmCacheManager::CacheEntry::GetProperty(const std::string& prop) const
bool cmCacheManager::CacheEntry::GetPropertyAsBool(
const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
void cmCacheManager::CacheEntry::SetProperty(const std::string& prop,
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 90f0d55..fbf39e2 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -295,7 +295,7 @@ std::string cmCommonTargetGenerator::GetAIXExports(std::string const&)
if (this->GeneratorTarget->IsAIX()) {
if (cmValue exportAll =
this->GeneratorTarget->GetProperty("AIX_EXPORT_ALL_SYMBOLS")) {
- if (cmIsOff(*exportAll)) {
+ if (exportAll.IsOff()) {
aixExports = "-n";
}
}
@@ -501,7 +501,8 @@ std::string cmCommonTargetGenerator::GetLinkerLauncher(
cmValue launcherProp = this->GeneratorTarget->GetProperty(propName);
if (cmNonempty(launcherProp)) {
cmGeneratorExpressionDAGChecker dagChecker(this->GeneratorTarget, propName,
- nullptr, nullptr);
+ nullptr, nullptr,
+ this->LocalCommonGenerator);
std::string evaluatedLinklauncher = cmGeneratorExpression::Evaluate(
*launcherProp, this->LocalCommonGenerator, config, this->GeneratorTarget,
&dagChecker, this->GeneratorTarget, lang);
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index f4b26f3..f6ff71a 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -451,10 +451,14 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
if (cmValue feature = this->Target->GetProperty(key)) {
if (!feature->empty() && key.length() > lloPrefix.length()) {
auto item = key.substr(lloPrefix.length());
- cmGeneratorExpressionDAGChecker dag{ this->Target->GetBacktrace(),
- this->Target,
- "LINK_LIBRARY_OVERRIDE",
- nullptr, nullptr };
+ cmGeneratorExpressionDAGChecker dag{
+ this->Target->GetBacktrace(),
+ this->Target,
+ "LINK_LIBRARY_OVERRIDE",
+ nullptr,
+ nullptr,
+ this->Target->GetLocalGenerator()
+ };
auto overrideFeature = cmGeneratorExpression::Evaluate(
*feature, this->Target->GetLocalGenerator(), config,
this->Target, &dag, this->Target, linkLanguage);
@@ -466,9 +470,12 @@ cmComputeLinkDepends::cmComputeLinkDepends(const cmGeneratorTarget* target,
// global override property
if (cmValue linkLibraryOverride =
this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
- cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
- "LINK_LIBRARY_OVERRIDE", nullptr,
- nullptr };
+ cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(),
+ target,
+ "LINK_LIBRARY_OVERRIDE",
+ nullptr,
+ nullptr,
+ target->GetLocalGenerator() };
auto overrideValue = cmGeneratorExpression::Evaluate(
*linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag,
target, linkLanguage);
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index c985767..b631610 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -646,7 +646,7 @@ bool cmComputeLinkInformation::Compute()
// Restore the target link type so the correct system runtime
// libraries are found.
cmValue lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC");
- if (cmIsOn(lss)) {
+ if (lss.IsOn()) {
this->SetCurrentLinkType(LinkStatic);
} else {
this->SetCurrentLinkType(this->StartLinkType);
@@ -1451,7 +1451,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
// Lookup the starting link type from the target (linked statically?).
cmValue lss = this->Target->GetProperty("LINK_SEARCH_START_STATIC");
- this->StartLinkType = cmIsOn(lss) ? LinkStatic : LinkShared;
+ this->StartLinkType = lss.IsOn() ? LinkStatic : LinkShared;
this->CurrentLinkType = this->StartLinkType;
}
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 6763225..0bcc7b9 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -473,7 +473,7 @@ void cmComputeTargetDepends::ComputeIntermediateGraph()
} else {
if (cmValue optimizeDependencies =
gt->GetProperty("OPTIMIZE_DEPENDENCIES")) {
- if (cmIsOn(optimizeDependencies)) {
+ if (optimizeDependencies.IsOn()) {
this->OptimizeLinkDependencies(gt, intermediateEdges, initialEdges);
} else {
intermediateEdges = initialEdges;
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index eba4c57..5a2b33a 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -399,7 +399,7 @@ bool cmConditionEvaluator::GetBooleanValue(
// Check definition.
cmValue def = this->GetDefinitionIfUnquoted(arg);
- return !cmIsOff(def);
+ return !def.IsOff();
}
//=========================================================================
@@ -416,14 +416,14 @@ bool cmConditionEvaluator::GetBooleanValueOld(
return true;
}
cmValue def = this->GetDefinitionIfUnquoted(arg);
- return !cmIsOff(def);
+ return !def.IsOff();
}
// Old GetVariableOrNumber behavior.
cmValue def = this->GetDefinitionIfUnquoted(arg);
if (!def && std::atoi(arg.GetValue().c_str())) {
def = cmValue(arg.GetValue());
}
- return !cmIsOff(def);
+ return !def.IsOff();
}
//=========================================================================
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 324c5ad..6d3e01c 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1151,6 +1151,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
vars.emplace("CMAKE_WATCOM_RUNTIME_LIBRARY"_s);
vars.emplace("CMAKE_MSVC_DEBUG_INFORMATION_FORMAT"_s);
vars.emplace("CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS"_s);
+ vars.emplace("CMAKE_VS_USE_DEBUG_LIBRARIES"_s);
if (cmValue varListStr = this->Makefile->GetDefinition(
kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES)) {
diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx
index ff9ab0f..55e3a5b 100644
--- a/Source/cmCryptoHash.cxx
+++ b/Source/cmCryptoHash.cxx
@@ -2,6 +2,8 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCryptoHash.h"
+#include <cassert>
+
#include <cm/memory>
#include <cm3p/kwiml/int.h>
@@ -80,6 +82,37 @@ std::unique_ptr<cmCryptoHash> cmCryptoHash::New(cm::string_view algo)
return std::unique_ptr<cmCryptoHash>(nullptr);
}
+std::string cmCryptoHash::GetHashAlgoName() const
+{
+#ifndef CMAKE_USE_SYSTEM_LIBRHASH
+ static_assert(RHASH_HASH_COUNT == 10, "Update switch statement!");
+#endif
+ switch (this->Id) {
+ case RHASH_MD5:
+ return "MD5";
+ case RHASH_SHA1:
+ return "SHA1";
+ case RHASH_SHA224:
+ return "SHA224";
+ case RHASH_SHA256:
+ return "SHA256";
+ case RHASH_SHA384:
+ return "SHA384";
+ case RHASH_SHA512:
+ return "SHA512";
+ case RHASH_SHA3_224:
+ return "SHA3_224";
+ case RHASH_SHA3_256:
+ return "SHA3_256";
+ case RHASH_SHA3_384:
+ return "SHA3_384";
+ case RHASH_SHA3_512:
+ return "SHA3_512";
+ }
+ assert(false);
+ return "UNKNOWN";
+}
+
bool cmCryptoHash::IntFromHexDigit(char input, char& output)
{
if (input >= '0' && input <= '9') {
diff --git a/Source/cmCryptoHash.h b/Source/cmCryptoHash.h
index a2d45e7..bb026a2 100644
--- a/Source/cmCryptoHash.h
+++ b/Source/cmCryptoHash.h
@@ -74,6 +74,10 @@ public:
/// An empty string otherwise.
std::string HashFile(const std::string& file);
+ /// @brief Returns the name of the hash type.
+ /// @return The name of the hash type associated with this hash generator.
+ std::string GetHashAlgoName() const;
+
void Initialize();
void Append(void const*, size_t);
void Append(cm::string_view input);
diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx
index 24ba368..ddd5f69 100644
--- a/Source/cmCurl.cxx
+++ b/Source/cmCurl.cxx
@@ -2,6 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCurl.h"
+#include <cm/string_view>
+#include <cmext/string_view>
+
#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) && \
!defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH)
# define CMAKE_FIND_CAFILE
@@ -31,6 +34,54 @@
} \
} while (false)
+// curl versions before 7.52.0 did not provide TLS 1.3 support
+#if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x073400
+# define CURL_SSLVERSION_TLSv1_3 CURL_SSLVERSION_LAST
+#endif
+
+// Make sure we keep up with new TLS versions supported by curl.
+// Do this only for our vendored curl to avoid breaking builds
+// against external future versions of curl.
+#if !defined(CMAKE_USE_SYSTEM_CURL)
+static_assert(CURL_SSLVERSION_LAST == 8,
+ "A new CURL_SSLVERSION_ may be available!");
+#endif
+
+cm::optional<int> cmCurlParseTLSVersion(cm::string_view tls_version)
+{
+ cm::optional<int> v;
+ if (tls_version == "1.0"_s) {
+ v = CURL_SSLVERSION_TLSv1_0;
+ } else if (tls_version == "1.1"_s) {
+ v = CURL_SSLVERSION_TLSv1_1;
+ } else if (tls_version == "1.2"_s) {
+ v = CURL_SSLVERSION_TLSv1_2;
+ } else if (tls_version == "1.3"_s) {
+ v = CURL_SSLVERSION_TLSv1_3;
+ }
+ return v;
+}
+
+cm::optional<std::string> cmCurlPrintTLSVersion(int curl_tls_version)
+{
+ cm::optional<std::string> s;
+ switch (curl_tls_version) {
+ case CURL_SSLVERSION_TLSv1_0:
+ s = "CURL_SSLVERSION_TLSv1_0"_s;
+ break;
+ case CURL_SSLVERSION_TLSv1_1:
+ s = "CURL_SSLVERSION_TLSv1_1"_s;
+ break;
+ case CURL_SSLVERSION_TLSv1_2:
+ s = "CURL_SSLVERSION_TLSv1_2"_s;
+ break;
+ case CURL_SSLVERSION_TLSv1_3:
+ s = "CURL_SSLVERSION_TLSv1_3"_s;
+ break;
+ }
+ return s;
+}
+
std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile)
{
std::string e;
diff --git a/Source/cmCurl.h b/Source/cmCurl.h
index b5134f4..8b8c88b 100644
--- a/Source/cmCurl.h
+++ b/Source/cmCurl.h
@@ -6,8 +6,13 @@
#include <string>
+#include <cm/optional>
+#include <cm/string_view>
+
#include <cm3p/curl/curl.h>
+cm::optional<int> cmCurlParseTLSVersion(cm::string_view tls_version);
+cm::optional<std::string> cmCurlPrintTLSVersion(int curl_tls_version);
std::string cmCurlSetCAInfo(::CURL* curl, const std::string& cafile = {});
std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level,
const std::string& netrc_file);
diff --git a/Source/cmDebugTools.h b/Source/cmDebugTools.h
index 99c0c6b..c3e05a6 100644
--- a/Source/cmDebugTools.h
+++ b/Source/cmDebugTools.h
@@ -4,6 +4,8 @@
#include <iostream>
+#include "cmSystemTools.h"
+
#define CM_DBG(expr) cm::dbg_impl(__FILE__, __LINE__, #expr, expr)
namespace cm {
@@ -13,8 +15,10 @@ namespace {
template <typename T>
T dbg_impl(const char* fname, int line, const char* expr, T value)
{
- std::cerr << fname << ':' << line << ": " << expr << " = " << value
- << std::endl;
+ if (!cmSystemTools::GetEnvVar("CMAKE_NO_DBG")) {
+ std::cerr << fname << ':' << line << ": " << expr << " = " << value
+ << std::endl;
+ }
return value;
}
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 8aea753..a71e5f1 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -212,7 +212,8 @@ public:
// Return the number of sections as specified by the ELF header.
unsigned int GetNumberOfSections() const override
{
- return static_cast<unsigned int>(this->ELFHeader.e_shnum);
+ return static_cast<unsigned int>(this->ELFHeader.e_shnum +
+ this->SectionHeaders[0].sh_size);
}
// Get the file position of a dynamic section entry.
@@ -367,7 +368,7 @@ private:
return !this->Stream->fail();
}
- bool LoadSectionHeader(ELF_Half i)
+ bool LoadSectionHeader(unsigned int i)
{
// Read the section header from the file.
this->Stream->seekg(this->ELFHeader.e_shoff +
@@ -378,7 +379,7 @@ private:
// Identify some important sections.
if (this->SectionHeaders[i].sh_type == SHT_DYNAMIC) {
- this->DynamicSectionIndex = i;
+ this->DynamicSectionIndex = static_cast<int>(i);
}
return true;
}
@@ -444,8 +445,11 @@ cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
this->Machine = this->ELFHeader.e_machine;
// Load the section headers.
- this->SectionHeaders.resize(this->ELFHeader.e_shnum);
- for (ELF_Half i = 0; i < this->ELFHeader.e_shnum; ++i) {
+ this->SectionHeaders.resize(
+ this->ELFHeader.e_shnum == 0 ? 1 : this->ELFHeader.e_shnum);
+ this->LoadSectionHeader(0);
+ this->SectionHeaders.resize(this->GetNumberOfSections());
+ for (unsigned int i = 1; i < this->GetNumberOfSections(); ++i) {
if (!this->LoadSectionHeader(i)) {
this->SetErrorMessage("Failed to load section headers.");
return;
@@ -617,7 +621,19 @@ cmELF::StringEntry const* cmELFInternalImpl<Types>::GetDynamicSectionString(
// Make sure the whole value was read.
if (!(*this->Stream)) {
- this->SetErrorMessage("Dynamic section specifies unreadable RPATH.");
+ if (tag == cmELF::TagRPath) {
+ this->SetErrorMessage(
+ "Dynamic section specifies unreadable DT_RPATH");
+ } else if (tag == cmELF::TagRunPath) {
+ this->SetErrorMessage(
+ "Dynamic section specifies unreadable DT_RUNPATH");
+ } else if (tag == cmELF::TagMipsRldMapRel) {
+ this->SetErrorMessage(
+ "Dynamic section specifies unreadable DT_MIPS_RLD_MAP_REL");
+ } else {
+ this->SetErrorMessage("Dynamic section specifies unreadable value"
+ " for unexpected attribute");
+ }
se.Value = "";
return nullptr;
}
diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx
index 59522c0..87fb077 100644
--- a/Source/cmEnableLanguageCommand.cxx
+++ b/Source/cmEnableLanguageCommand.cxx
@@ -4,6 +4,9 @@
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
+#include "cmPolicies.h"
+#include "cmSystemTools.h"
bool cmEnableLanguageCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -13,6 +16,27 @@ bool cmEnableLanguageCommand(std::vector<std::string> const& args,
return false;
}
+ cmMakefile& mf = status.GetMakefile();
+ if (!mf.IsNormalDefinitionSet("PROJECT_NAME")) {
+ switch (mf.GetPolicyStatus(cmPolicies::CMP0165)) {
+ case cmPolicies::WARN:
+ mf.IssueMessage(
+ MessageType::AUTHOR_WARNING,
+ "project() should be called prior to this enable_language() call.");
+ break;
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::NEW:
+ mf.IssueMessage(
+ MessageType::FATAL_ERROR,
+ "project() must be called prior to this enable_language() call.");
+ cmSystemTools::SetFatalErrorOccurred();
+ return false;
+ default:
+ break;
+ }
+ }
+
bool optional = false;
std::vector<std::string> languages;
for (std::string const& it : args) {
@@ -23,6 +47,6 @@ bool cmEnableLanguageCommand(std::vector<std::string> const& args,
}
}
- status.GetMakefile().EnableLanguage(languages, optional);
+ mf.EnableLanguage(languages, optional);
return true;
}
diff --git a/Source/cmExperimental.cxx b/Source/cmExperimental.cxx
index fb21f53..a2e6e70 100644
--- a/Source/cmExperimental.cxx
+++ b/Source/cmExperimental.cxx
@@ -37,6 +37,15 @@ cmExperimental::FeatureData LookupTable[] = {
{},
cmExperimental::TryCompileCondition::Always,
false },
+ // CxxImportStd
+ { "CxxImportStd",
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508",
+ "CMAKE_EXPERIMENTAL_CXX_IMPORT_STD",
+ "CMake's support for `import std;` in C++23 and newer is experimental. It "
+ "is meant only for experimentation and feedback to CMake developers.",
+ {},
+ cmExperimental::TryCompileCondition::Always,
+ false },
};
static_assert(sizeof(LookupTable) / sizeof(LookupTable[0]) ==
static_cast<size_t>(cmExperimental::Feature::Sentinel),
@@ -54,6 +63,20 @@ const cmExperimental::FeatureData& cmExperimental::DataForFeature(Feature f)
return ::DataForFeature(f);
}
+cm::optional<cmExperimental::Feature> cmExperimental::FeatureByName(
+ std::string const& name)
+{
+ size_t idx = 0;
+ for (auto const& feature : LookupTable) {
+ if (feature.Name == name) {
+ return static_cast<Feature>(idx);
+ }
+ ++idx;
+ }
+
+ return {};
+}
+
bool cmExperimental::HasSupportEnabled(cmMakefile const& mf, Feature f)
{
bool enabled = false;
diff --git a/Source/cmExperimental.h b/Source/cmExperimental.h
index 5593c85..05764f9 100644
--- a/Source/cmExperimental.h
+++ b/Source/cmExperimental.h
@@ -8,6 +8,8 @@
#include <string>
#include <vector>
+#include <cm/optional>
+
class cmMakefile;
class cmExperimental
@@ -17,6 +19,7 @@ public:
{
ExportPackageDependencies,
WindowsKernelModeDriver,
+ CxxImportStd,
Sentinel,
};
@@ -40,5 +43,6 @@ public:
};
static const FeatureData& DataForFeature(Feature f);
+ static cm::optional<Feature> FeatureByName(std::string const& name);
static bool HasSupportEnabled(cmMakefile const& mf, Feature f);
};
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index f60a17e..9bd7f49 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -986,8 +986,9 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
/* clang-format on */
// Isolate the file policy level.
- // Support CMake versions as far back as 2.6 but also support using NEW
- // policy settings for up to CMake 3.27 (this upper limit may be reviewed
+ // Support CMake versions as far back as the
+ // RequiredCMakeVersion{Major,Minor,Patch}, but also support using NEW
+ // policy settings for up to CMake 3.28 (this upper limit may be reviewed
// and increased from time to time). This reduces the opportunity for CMake
// warnings when an older export file is later used with newer CMake
// versions.
@@ -996,7 +997,7 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
<< "cmake_policy(VERSION "
<< this->RequiredCMakeVersionMajor << '.'
<< this->RequiredCMakeVersionMinor << '.'
- << this->RequiredCMakeVersionPatch << "...3.27)\n";
+ << this->RequiredCMakeVersionPatch << "...3.28)\n";
/* clang-format on */
}
@@ -1387,6 +1388,12 @@ void cmExportFileGenerator::GenerateImportedFileChecksCode(
os << ")\n\n";
}
+enum class ExportWhen
+{
+ Defined,
+ Always,
+};
+
enum class PropertyType
{
Strings,
@@ -1408,6 +1415,12 @@ bool PropertyTypeIsForPaths(PropertyType pt)
}
}
+struct ModuleTargetPropertyTable
+{
+ cm::static_string_view Name;
+ ExportWhen Cond;
+};
+
struct ModulePropertyTable
{
cm::static_string_view Name;
@@ -1423,18 +1436,29 @@ bool cmExportFileGenerator::PopulateCxxModuleExportProperties(
return true;
}
- const cm::static_string_view exportedDirectModuleProperties[] = {
- "CXX_EXTENSIONS"_s,
+ const ModuleTargetPropertyTable exportedDirectModuleProperties[] = {
+ { "CXX_EXTENSIONS"_s, ExportWhen::Defined },
+ // Always define this property as it is an intrinsic property of the target
+ // and should not be inherited from the in-scope `CMAKE_CXX_MODULE_STD`
+ // variable.
+ //
+ // TODO(cxxmodules): A future policy may make this "ON" based on the target
+ // policies if unset. Add a new `ExportWhen` condition to handle it when
+ // this happens.
+ { "CXX_MODULE_STD"_s, ExportWhen::Always },
};
- for (auto const& propName : exportedDirectModuleProperties) {
- auto const propNameStr = std::string(propName);
- cmValue prop = gte->Target->GetComputedProperty(
+ for (auto const& prop : exportedDirectModuleProperties) {
+ auto const propNameStr = std::string(prop.Name);
+ cmValue propValue = gte->Target->GetComputedProperty(
propNameStr, *gte->Target->GetMakefile());
- if (!prop) {
- prop = gte->Target->GetProperty(propNameStr);
+ if (!propValue) {
+ propValue = gte->Target->GetProperty(propNameStr);
}
- if (prop) {
- properties[propNameStr] = cmGeneratorExpression::Preprocess(*prop, ctx);
+ if (propValue) {
+ properties[propNameStr] =
+ cmGeneratorExpression::Preprocess(*propValue, ctx);
+ } else if (prop.Cond == ExportWhen::Always) {
+ properties[propNameStr] = "";
}
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 00c9173..4c41ff5 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -2,9 +2,11 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExportTryCompileFileGenerator.h"
+#include <map>
#include <utility>
#include <cm/memory>
+#include <cm/string_view>
#include "cmFileSet.h"
#include "cmGeneratorExpression.h"
@@ -44,12 +46,10 @@ bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
ImportPropertyMap properties;
for (std::string const& lang : this->Languages) {
-#define FIND_TARGETS(PROPERTY) \
- this->FindTargets("INTERFACE_" #PROPERTY, te, lang, emittedDeps);
-
- CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(FIND_TARGETS)
-
-#undef FIND_TARGETS
+ for (auto i : cmGeneratorTarget::BuiltinTransitiveProperties) {
+ this->FindTargets(std::string(i.second.InterfaceName), te, lang,
+ emittedDeps);
+ }
}
this->PopulateProperties(te, properties, emittedDeps);
@@ -76,10 +76,10 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
// To please constraint checks of DAGChecker, this property must have
// LINK_OPTIONS property as parent
parentDagChecker = cm::make_unique<cmGeneratorExpressionDAGChecker>(
- tgt, "LINK_OPTIONS", nullptr, nullptr);
+ tgt, "LINK_OPTIONS", nullptr, nullptr, tgt->GetLocalGenerator());
}
- cmGeneratorExpressionDAGChecker dagChecker(tgt, propName, nullptr,
- parentDagChecker.get());
+ cmGeneratorExpressionDAGChecker dagChecker(
+ tgt, propName, nullptr, parentDagChecker.get(), tgt->GetLocalGenerator());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
diff --git a/Source/cmFileAPI.cxx b/Source/cmFileAPI.cxx
index 4524ba6..d4a7175 100644
--- a/Source/cmFileAPI.cxx
+++ b/Source/cmFileAPI.cxx
@@ -830,7 +830,7 @@ Json::Value cmFileAPI::BuildCache(Object const& object)
// The "cmakeFiles" object kind.
-static unsigned int const CMakeFilesV1Minor = 0;
+static unsigned int const CMakeFilesV1Minor = 1;
void cmFileAPI::BuildClientRequestCMakeFiles(
ClientRequest& r, std::vector<RequestVersion> const& versions)
diff --git a/Source/cmFileAPICMakeFiles.cxx b/Source/cmFileAPICMakeFiles.cxx
index e208ca8..bc80319 100644
--- a/Source/cmFileAPICMakeFiles.cxx
+++ b/Source/cmFileAPICMakeFiles.cxx
@@ -4,11 +4,13 @@
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include <cm3p/json/value.h>
#include "cmFileAPI.h"
+#include "cmGlobCacheEntry.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -29,6 +31,8 @@ class CMakeFiles
Json::Value DumpPaths();
Json::Value DumpInputs();
Json::Value DumpInput(std::string const& file);
+ Json::Value DumpGlobsDependent();
+ Json::Value DumpGlobDependent(cmGlobCacheEntry const& entry);
public:
CMakeFiles(cmFileAPI& fileAPI, unsigned long version);
@@ -51,6 +55,10 @@ Json::Value CMakeFiles::Dump()
Json::Value cmakeFiles = Json::objectValue;
cmakeFiles["paths"] = this->DumpPaths();
cmakeFiles["inputs"] = this->DumpInputs();
+ Json::Value globsDependent = this->DumpGlobsDependent();
+ if (!globsDependent.empty()) {
+ cmakeFiles["globsDependent"] = std::move(globsDependent);
+ }
return cmakeFiles;
}
@@ -106,6 +114,40 @@ Json::Value CMakeFiles::DumpInput(std::string const& file)
return input;
}
+
+Json::Value CMakeFiles::DumpGlobsDependent()
+{
+ Json::Value globsDependent = Json::arrayValue;
+ for (cmGlobCacheEntry const& entry :
+ this->FileAPI.GetCMakeInstance()->GetGlobCacheEntries()) {
+ globsDependent.append(this->DumpGlobDependent(entry));
+ }
+ return globsDependent;
+}
+
+Json::Value CMakeFiles::DumpGlobDependent(cmGlobCacheEntry const& entry)
+{
+ Json::Value globDependent = Json::objectValue;
+ globDependent["expression"] = entry.Expression;
+ if (entry.Recurse) {
+ globDependent["recurse"] = true;
+ }
+ if (entry.ListDirectories) {
+ globDependent["listDirectories"] = true;
+ }
+ if (entry.FollowSymlinks) {
+ globDependent["followSymlinks"] = true;
+ }
+ if (!entry.Relative.empty()) {
+ globDependent["relative"] = entry.Relative;
+ }
+ Json::Value paths = Json::arrayValue;
+ for (std::string const& file : entry.Files) {
+ paths.append(file);
+ }
+ globDependent["paths"] = std::move(paths);
+ return globDependent;
+}
}
Json::Value cmFileAPICMakeFilesDump(cmFileAPI& fileAPI, unsigned long version)
diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx
index e9302da..b9daffb 100644
--- a/Source/cmFileAPICodemodel.cxx
+++ b/Source/cmFileAPICodemodel.cxx
@@ -685,6 +685,11 @@ Json::Value CodemodelConfig::DumpTargets()
continue;
}
+ // Ignore targets starting with `__cmake_` as they are internal.
+ if (cmHasLiteralPrefix(gt->GetName(), "__cmake_")) {
+ continue;
+ }
+
targets.append(this->DumpTarget(gt, targets.size()));
}
@@ -1379,14 +1384,11 @@ CompileData Target::BuildCompileData(cmSourceFile* sf)
}
// Add precompile headers compile options.
- std::vector<std::string> architectures =
- this->GT->GetAppleArchs(this->Config, fd.Language);
- if (architectures.empty()) {
- architectures.emplace_back();
- }
+ std::vector<std::string> pchArchs =
+ this->GT->GetPchArchs(this->Config, fd.Language);
std::unordered_map<std::string, std::string> pchSources;
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchSource =
this->GT->GetPchSource(this->Config, fd.Language, arch);
if (!pchSource.empty()) {
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index e3f5b96..0369051 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -41,6 +41,7 @@
#include "cmFileTimes.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorExpression.h"
+#include "cmGlobCacheEntry.h"
#include "cmGlobalGenerator.h"
#include "cmHexFileConverter.h"
#include "cmList.h"
@@ -810,11 +811,16 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
std::sort(foundFiles.begin(), foundFiles.end());
foundFiles.erase(std::unique(foundFiles.begin(), foundFiles.end()),
foundFiles.end());
- cm->AddGlobCacheEntry(
- recurse, (recurse ? g.GetRecurseListDirs() : g.GetListDirs()),
+ auto entry = cmGlobCacheEntry{
+ recurse,
+ (recurse ? g.GetRecurseListDirs() : g.GetListDirs()),
(recurse ? g.GetRecurseThroughSymlinks() : false),
- (g.GetRelative() ? g.GetRelative() : ""), expr, foundFiles, variable,
- status.GetMakefile().GetBacktrace());
+ (g.GetRelative() ? g.GetRelative() : ""),
+ expr,
+ foundFiles
+ };
+ cm->AddGlobCacheEntry(entry, variable,
+ status.GetMakefile().GetBacktrace());
} else {
warnConfigureLate = true;
}
@@ -1859,7 +1865,8 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
long inactivity_timeout = 0;
std::string logVar;
std::string statusVar;
- bool tls_verify = status.GetMakefile().IsOn("CMAKE_TLS_VERIFY");
+ cm::optional<std::string> tls_version;
+ cm::optional<bool> tls_verify;
cmValue cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
std::string netrc_level =
status.GetMakefile().GetSafeDefinition("CMAKE_NETRC");
@@ -1905,6 +1912,14 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
return false;
}
statusVar = *i;
+ } else if (*i == "TLS_VERSION") {
+ ++i;
+ if (i != args.end()) {
+ tls_version = *i;
+ } else {
+ status.SetError("DOWNLOAD missing value for TLS_VERSION.");
+ return false;
+ }
} else if (*i == "TLS_VERIFY") {
++i;
if (i != args.end()) {
@@ -2016,6 +2031,30 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
++i;
}
+ if (!tls_verify) {
+ if (cmValue v = status.GetMakefile().GetDefinition("CMAKE_TLS_VERIFY")) {
+ tls_verify = v.IsOn();
+ }
+ }
+ if (!tls_verify) {
+ if (cm::optional<std::string> v =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERIFY")) {
+ tls_verify = cmIsOn(*v);
+ }
+ }
+
+ if (!tls_version) {
+ if (cmValue v = status.GetMakefile().GetDefinition("CMAKE_TLS_VERSION")) {
+ tls_version = *v;
+ }
+ }
+ if (!tls_version) {
+ if (cm::optional<std::string> v =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERSION")) {
+ tls_version = std::move(v);
+ }
+ }
+
// Can't calculate hash if we don't save the file.
// TODO Incrementally calculate hash in the write callback as the file is
// being downloaded so this check can be relaxed.
@@ -2092,8 +2131,21 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
cmFileCommandCurlDebugCallback);
check_curl_result(res, "DOWNLOAD cannot set debug function: ");
+ if (tls_version) {
+ if (cm::optional<int> v = cmCurlParseTLSVersion(*tls_version)) {
+ res = ::curl_easy_setopt(curl, CURLOPT_SSLVERSION, *v);
+ check_curl_result(
+ res,
+ cmStrCat("DOWNLOAD cannot set TLS/SSL version ", *tls_version, ": "));
+ } else {
+ status.SetError(
+ cmStrCat("DOWNLOAD given unknown TLS/SSL version ", *tls_version));
+ return false;
+ }
+ }
+
// check to see if TLS verification is requested
- if (tls_verify) {
+ if (tls_verify && *tls_verify) {
res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
check_curl_result(res, "DOWNLOAD cannot set TLS/SSL Verify on: ");
} else {
@@ -2281,7 +2333,8 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
std::string logVar;
std::string statusVar;
bool showProgress = false;
- bool tls_verify = status.GetMakefile().IsOn("CMAKE_TLS_VERIFY");
+ cm::optional<std::string> tls_version;
+ cm::optional<bool> tls_verify;
cmValue cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
std::string userpwd;
std::string netrc_level =
@@ -2324,6 +2377,14 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
statusVar = *i;
} else if (*i == "SHOW_PROGRESS") {
showProgress = true;
+ } else if (*i == "TLS_VERSION") {
+ ++i;
+ if (i != args.end()) {
+ tls_version = *i;
+ } else {
+ status.SetError("UPLOAD missing value for TLS_VERSION.");
+ return false;
+ }
} else if (*i == "TLS_VERIFY") {
++i;
if (i != args.end()) {
@@ -2379,6 +2440,30 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
++i;
}
+ if (!tls_verify) {
+ if (cmValue v = status.GetMakefile().GetDefinition("CMAKE_TLS_VERIFY")) {
+ tls_verify = v.IsOn();
+ }
+ }
+ if (!tls_verify) {
+ if (cm::optional<std::string> v =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERIFY")) {
+ tls_verify = cmIsOn(*v);
+ }
+ }
+
+ if (!tls_version) {
+ if (cmValue v = status.GetMakefile().GetDefinition("CMAKE_TLS_VERSION")) {
+ tls_version = *v;
+ }
+ }
+ if (!tls_version) {
+ if (cm::optional<std::string> v =
+ cmSystemTools::GetEnvVar("CMAKE_TLS_VERSION")) {
+ tls_version = std::move(v);
+ }
+ }
+
// Open file for reading:
//
FILE* fin = cmsys::SystemTools::Fopen(filename, "rb");
@@ -2423,8 +2508,21 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
cmFileCommandCurlDebugCallback);
check_curl_result(res, "UPLOAD cannot set debug function: ");
+ if (tls_version) {
+ if (cm::optional<int> v = cmCurlParseTLSVersion(*tls_version)) {
+ res = ::curl_easy_setopt(curl, CURLOPT_SSLVERSION, *v);
+ check_curl_result(
+ res,
+ cmStrCat("UPLOAD cannot set TLS/SSL version ", *tls_version, ": "));
+ } else {
+ status.SetError(
+ cmStrCat("UPLOAD given unknown TLS/SSL version ", *tls_version));
+ return false;
+ }
+ }
+
// check to see if TLS verification is requested
- if (tls_verify) {
+ if (tls_verify && *tls_verify) {
res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
check_curl_result(res, "UPLOAD cannot set TLS/SSL Verify on: ");
} else {
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index bec6369..31cc14b 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -26,7 +26,7 @@ cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeEnvironment(
"CMAKE_ENVIRONMENT");
cmFindCommon::PathLabel cmFindCommon::PathLabel::Hints("HINTS");
cmFindCommon::PathLabel cmFindCommon::PathLabel::SystemEnvironment(
- "SYSTM_ENVIRONMENT");
+ "SYSTEM_ENVIRONMENT");
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeSystem("CMAKE_SYSTEM");
cmFindCommon::PathLabel cmFindCommon::PathLabel::Guess("GUESS");
@@ -207,7 +207,7 @@ void cmFindCommon::SelectDefaultSearchModes()
for (auto const& path : search_paths) {
cmValue def = this->Makefile->GetDefinition(path.second);
if (def) {
- path.first = !cmIsOn(*def);
+ path.first = !def.IsOn();
}
}
}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 9b51b1a..6349302 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -628,7 +628,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY
if (cmValue const def =
this->Makefile->GetDefinition("CMAKE_FIND_USE_PACKAGE_REGISTRY")) {
- this->NoUserRegistry = !cmIsOn(*def);
+ this->NoUserRegistry = !def.IsOn();
} else if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true;
}
@@ -638,7 +638,7 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
// priority over the deprecated CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY
if (cmValue const def = this->Makefile->GetDefinition(
"CMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY")) {
- this->NoSystemRegistry = !cmIsOn(*def);
+ this->NoSystemRegistry = !def.IsOn();
} else if (this->Makefile->IsOn(
"CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY")) {
this->NoSystemRegistry = true;
@@ -982,6 +982,36 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
return true;
}
+ // Restore PACKAGE_PREFIX_DIR to its pre-call value when we return. If our
+ // caller is a file generated by configure_package_config_file(), and if
+ // the package we are about to load also has a config file created by that
+ // command, it will overwrite PACKAGE_PREFIX_DIR. We need to restore it in
+ // case something still refers to it in our caller's scope after we return.
+ class RestoreVariableOnLeavingScope
+ {
+ cmMakefile* makefile_;
+ cm::optional<std::string> value_;
+
+ public:
+ RestoreVariableOnLeavingScope(cmMakefile* makefile)
+ : makefile_(makefile)
+ {
+ cmValue v = makefile->GetDefinition("PACKAGE_PREFIX_DIR");
+ if (v) {
+ value_ = *v;
+ }
+ }
+ ~RestoreVariableOnLeavingScope()
+ {
+ if (this->value_) {
+ makefile_->AddDefinition("PACKAGE_PREFIX_DIR", *value_);
+ } else {
+ makefile_->RemoveDefinition("PACKAGE_PREFIX_DIR");
+ }
+ }
+ };
+ RestoreVariableOnLeavingScope restorePackagePrefixDir(this->Makefile);
+
// Now choose what method(s) we will use to satisfy the request. Note that
// we still want all the above checking of arguments, etc. regardless of the
// method used. This will ensure ill-formed arguments are caught earlier,
@@ -1420,7 +1450,7 @@ bool cmFindPackageCommand::HandlePackageMode(
// Try to load the config file if the directory is known
bool fileFound = false;
if (this->UseConfigFiles) {
- if (!cmIsOff(def)) {
+ if (!def.IsOff()) {
// Get the directory from the variable value.
std::string dir = *def;
cmSystemTools::ConvertToUnixSlashes(dir);
@@ -1440,7 +1470,7 @@ bool cmFindPackageCommand::HandlePackageMode(
}
// Search for the config file if it is not already found.
- if (cmIsOff(def) || !fileFound) {
+ if (def.IsOff() || !fileFound) {
fileFound = this->FindConfig();
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 04decd2..0583fd5 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -70,13 +70,6 @@ const std::string& cmCompiledGeneratorExpression::Evaluate(
currentTarget ? currentTarget : headTarget, this->EvaluateForBuildsystem,
this->Backtrace, language);
- return this->EvaluateWithContext(context, dagChecker);
-}
-
-const std::string& cmCompiledGeneratorExpression::EvaluateWithContext(
- cmGeneratorExpressionContext& context,
- cmGeneratorExpressionDAGChecker* dagChecker) const
-{
if (!this->NeedsEvaluation) {
return this->Input;
}
@@ -432,7 +425,7 @@ const std::string& cmGeneratorExpressionInterpreter::Evaluate(
cmGeneratorExpressionDAGChecker dagChecker(
this->HeadTarget,
property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property, nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
return this->CompiledGeneratorExpression->Evaluate(
this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr,
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index e22b8ab..71855c9 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -17,7 +17,6 @@
class cmake;
class cmCompiledGeneratorExpression;
class cmGeneratorTarget;
-struct cmGeneratorExpressionContext;
struct cmGeneratorExpressionDAGChecker;
struct cmGeneratorExpressionEvaluator;
@@ -151,10 +150,6 @@ public:
std::map<std::string, std::string>& mapping);
private:
- const std::string& EvaluateWithContext(
- cmGeneratorExpressionContext& context,
- cmGeneratorExpressionDAGChecker* dagChecker) const;
-
cmCompiledGeneratorExpression(cmake& cmakeInstance,
cmListFileBacktrace backtrace,
std::string input);
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 4e46df7..bb1f4b4 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -2,10 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGeneratorExpressionDAGChecker.h"
-#include <cstring>
#include <sstream>
#include <utility>
+#include <cm/optional>
#include <cm/string_view>
#include <cmext/string_view>
@@ -18,47 +18,38 @@
#include "cmake.h"
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
- cmListFileBacktrace backtrace, cmGeneratorTarget const* target,
- std::string property, const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker* parent)
- : Parent(parent)
- , Target(target)
- , Property(std::move(property))
- , Content(content)
- , Backtrace(std::move(backtrace))
- , TransitivePropertiesOnly(false)
- , CMP0131(false)
+ cmGeneratorTarget const* target, std::string property,
+ const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG)
+ : cmGeneratorExpressionDAGChecker(cmListFileBacktrace(), target,
+ std::move(property), content, parent,
+ contextLG)
{
- this->Initialize();
}
cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
- cmGeneratorTarget const* target, std::string property,
- const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker* parent)
+ cmListFileBacktrace backtrace, cmGeneratorTarget const* target,
+ std::string property, const GeneratorExpressionContent* content,
+ cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG)
: Parent(parent)
+ , Top(parent ? parent->Top : this)
, Target(target)
, Property(std::move(property))
, Content(content)
- , Backtrace()
- , TransitivePropertiesOnly(false)
- , CMP0131(false)
+ , Backtrace(std::move(backtrace))
{
- this->Initialize();
-}
+ if (parent) {
+ this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
+ } else {
+ this->TopIsTransitiveProperty =
+ this->Target->IsTransitiveProperty(this->Property, contextLG)
+ .has_value();
+ }
-void cmGeneratorExpressionDAGChecker::Initialize()
-{
- const auto* top = this->Top();
this->CheckResult = this->CheckGraph();
-#define TEST_TRANSITIVE_PROPERTY_METHOD(METHOD) top->METHOD() ||
-
- if (this->CheckResult == DAG &&
- (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
- TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*)
-#undef TEST_TRANSITIVE_PROPERTY_METHOD
- {
+ if (this->CheckResult == DAG && this->EvaluatingTransitiveProperty()) {
+ const auto* top = this->Top;
auto it = top->Seen.find(this->Target);
if (it != top->Seen.end()) {
const std::set<std::string>& propSet = it->second;
@@ -142,37 +133,51 @@ cmGeneratorExpressionDAGChecker::CheckGraph() const
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly() const
{
- return this->Top()->TransitivePropertiesOnly;
+ return this->Top->TransitivePropertiesOnly;
}
bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnlyCMP0131()
const
{
- return this->Top()->CMP0131;
+ return this->Top->CMP0131;
+}
+
+bool cmGeneratorExpressionDAGChecker::EvaluatingTransitiveProperty() const
+{
+ return this->TopIsTransitiveProperty;
}
bool cmGeneratorExpressionDAGChecker::EvaluatingGenexExpression() const
{
+ // Corresponds to GenexEvaluator::EvaluateExpression.
return cmHasLiteralPrefix(this->Property, "TARGET_GENEX_EVAL:") ||
cmHasLiteralPrefix(this->Property, "GENEX_EVAL:");
}
bool cmGeneratorExpressionDAGChecker::EvaluatingPICExpression() const
{
- return this->Top()->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
+ // Corresponds to checkInterfacePropertyCompatibility's special case
+ // that evaluates the value of POSITION_INDEPENDENT_CODE as a genex.
+ return this->Top->Property == "INTERFACE_POSITION_INDEPENDENT_CODE";
}
bool cmGeneratorExpressionDAGChecker::EvaluatingCompileExpression() const
{
- cm::string_view property(this->Top()->Property);
+ cm::string_view property(this->Top->Property);
return property == "INCLUDE_DIRECTORIES"_s ||
property == "COMPILE_DEFINITIONS"_s || property == "COMPILE_OPTIONS"_s;
}
+bool cmGeneratorExpressionDAGChecker::EvaluatingSources() const
+{
+ return this->Property == "SOURCES"_s ||
+ this->Property == "INTERFACE_SOURCES"_s;
+}
+
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
{
- cm::string_view property(this->Top()->Property);
+ cm::string_view property(this->Top->Property);
return property == "LINK_DIRECTORIES"_s || property == "LINK_OPTIONS"_s ||
property == "LINK_DEPENDS"_s || property == "LINK_LIBRARY_OVERRIDE"_s ||
@@ -181,14 +186,14 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkExpression() const
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkOptionsExpression() const
{
- cm::string_view property(this->Top()->Property);
+ cm::string_view property(this->Top->Property);
return property == "LINK_OPTIONS"_s || property == "LINKER_TYPE"_s;
}
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
{
- cm::string_view property(this->Top()->Property);
+ cm::string_view property(this->Top->Property);
return property.length() > cmStrLen("_LINKER_LAUNCHER") &&
property.substr(property.length() - cmStrLen("_LINKER_LAUNCHER")) ==
@@ -198,7 +203,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkerLauncher() const
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
cmGeneratorTarget const* tgt, ForGenex genex) const
{
- const auto* top = this->Top();
+ const auto* top = this->Top;
cm::string_view prop(top->Property);
@@ -219,54 +224,7 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
: (result || prop == "INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE"_s);
}
-cmGeneratorExpressionDAGChecker const* cmGeneratorExpressionDAGChecker::Top()
- const
-{
- const cmGeneratorExpressionDAGChecker* top = this;
- const cmGeneratorExpressionDAGChecker* parent = this->Parent;
- while (parent) {
- top = parent;
- parent = parent->Parent;
- }
- return top;
-}
-
cmGeneratorTarget const* cmGeneratorExpressionDAGChecker::TopTarget() const
{
- return this->Top()->Target;
+ return this->Top->Target;
}
-
-enum TransitiveProperty
-{
-#define DEFINE_ENUM_ENTRY(NAME) NAME,
- CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(DEFINE_ENUM_ENTRY)
-#undef DEFINE_ENUM_ENTRY
- TransitivePropertyTerminal
-};
-
-template <TransitiveProperty>
-bool additionalTest(const char* const /*unused*/)
-{
- return false;
-}
-
-template <>
-bool additionalTest<COMPILE_DEFINITIONS>(const char* const prop)
-{
- return cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_");
-}
-
-#define DEFINE_TRANSITIVE_PROPERTY_METHOD(METHOD, PROPERTY) \
- bool cmGeneratorExpressionDAGChecker::METHOD() const \
- { \
- const char* const prop = this->Property.c_str(); \
- if (strcmp(prop, #PROPERTY) == 0 || \
- strcmp(prop, "INTERFACE_" #PROPERTY) == 0) { \
- return true; \
- } \
- return additionalTest<PROPERTY>(prop); \
- }
-
-CM_FOR_EACH_TRANSITIVE_PROPERTY(DEFINE_TRANSITIVE_PROPERTY_METHOD)
-
-#undef DEFINE_TRANSITIVE_PROPERTY_METHOD
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 782d6c8..b230188 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -13,33 +13,7 @@
struct GeneratorExpressionContent;
struct cmGeneratorExpressionContext;
class cmGeneratorTarget;
-
-#define CM_SELECT_BOTH(F, A1, A2) F(A1, A2)
-#define CM_SELECT_FIRST(F, A1, A2) F(A1)
-#define CM_SELECT_SECOND(F, A1, A2) F(A2)
-
-#define CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, SELECT) \
- SELECT(F, EvaluatingIncludeDirectories, INCLUDE_DIRECTORIES) \
- SELECT(F, EvaluatingSystemIncludeDirectories, SYSTEM_INCLUDE_DIRECTORIES) \
- SELECT(F, EvaluatingCompileDefinitions, COMPILE_DEFINITIONS) \
- SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS) \
- SELECT(F, EvaluatingAutoMocMacroNames, AUTOMOC_MACRO_NAMES) \
- SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS) \
- SELECT(F, EvaluatingSources, SOURCES) \
- SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES) \
- SELECT(F, EvaluatingLinkOptions, LINK_OPTIONS) \
- SELECT(F, EvaluatingLinkDirectories, LINK_DIRECTORIES) \
- SELECT(F, EvaluatingLinkDepends, LINK_DEPENDS) \
- SELECT(F, EvaluatingPrecompileHeaders, PRECOMPILE_HEADERS)
-
-#define CM_FOR_EACH_TRANSITIVE_PROPERTY(F) \
- CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_BOTH)
-
-#define CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(F) \
- CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_FIRST)
-
-#define CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(F) \
- CM_FOR_EACH_TRANSITIVE_PROPERTY_IMPL(F, CM_SELECT_SECOND)
+class cmLocalGenerator;
struct cmGeneratorExpressionDAGChecker
{
@@ -47,11 +21,13 @@ struct cmGeneratorExpressionDAGChecker
cmGeneratorTarget const* target,
std::string property,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker* parent);
+ cmGeneratorExpressionDAGChecker* parent,
+ cmLocalGenerator const* contextLG);
cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target,
std::string property,
const GeneratorExpressionContent* content,
- cmGeneratorExpressionDAGChecker* parent);
+ cmGeneratorExpressionDAGChecker* parent,
+ cmLocalGenerator const* contextLG);
enum Result
{
@@ -66,6 +42,7 @@ struct cmGeneratorExpressionDAGChecker
void ReportError(cmGeneratorExpressionContext* context,
const std::string& expr);
+ bool EvaluatingTransitiveProperty() const;
bool EvaluatingGenexExpression() const;
bool EvaluatingPICExpression() const;
bool EvaluatingCompileExpression() const;
@@ -82,11 +59,7 @@ struct cmGeneratorExpressionDAGChecker
bool EvaluatingLinkLibraries(cmGeneratorTarget const* tgt = nullptr,
ForGenex genex = ForGenex::ANY) const;
-#define DECLARE_TRANSITIVE_PROPERTY_METHOD(METHOD) bool METHOD() const;
-
- CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
-
-#undef DECLARE_TRANSITIVE_PROPERTY_METHOD
+ bool EvaluatingSources() const;
bool GetTransitivePropertiesOnly() const;
void SetTransitivePropertiesOnly() { this->TransitivePropertiesOnly = true; }
@@ -94,20 +67,20 @@ struct cmGeneratorExpressionDAGChecker
bool GetTransitivePropertiesOnlyCMP0131() const;
void SetTransitivePropertiesOnlyCMP0131() { this->CMP0131 = true; }
- cmGeneratorExpressionDAGChecker const* Top() const;
cmGeneratorTarget const* TopTarget() const;
private:
Result CheckGraph() const;
- void Initialize();
const cmGeneratorExpressionDAGChecker* const Parent;
+ const cmGeneratorExpressionDAGChecker* const Top;
cmGeneratorTarget const* Target;
const std::string Property;
mutable std::map<cmGeneratorTarget const*, std::set<std::string>> Seen;
const GeneratorExpressionContent* const Content;
const cmListFileBacktrace Backtrace;
Result CheckResult;
- bool TransitivePropertiesOnly;
- bool CMP0131;
+ bool TransitivePropertiesOnly = false;
+ bool CMP0131 = false;
+ bool TopIsTransitiveProperty = false;
};
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index c8147b2..b9feb87 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -487,7 +487,8 @@ protected:
if (context->HeadTarget) {
cmGeneratorExpressionDAGChecker dagChecker(
context->Backtrace, context->HeadTarget,
- genexOperator + ":" + expression, content, dagCheckerParent);
+ genexOperator + ":" + expression, content, dagCheckerParent,
+ context->LG);
switch (dagChecker.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: {
@@ -547,6 +548,7 @@ static const struct TargetGenexEvalNode : public GenexEvaluator
return expression;
}
+ // Replace the surrounding context with the named target.
cmGeneratorExpressionContext targetContext(
context->LG, context->Config, context->Quiet, target, target,
context->EvaluateForBuildsystem, context->Backtrace, context->Language);
@@ -1859,6 +1861,7 @@ struct CharacterNode : public cmGeneratorExpressionNode
static const CharacterNode<'>'> angle_rNode;
static const CharacterNode<','> commaNode;
static const CharacterNode<';'> semicolonNode;
+static const CharacterNode<'"'> quoteNode;
struct CompilerIdNode : public cmGeneratorExpressionNode
{
@@ -2698,7 +2701,8 @@ static const struct DeviceLinkNode : public cmGeneratorExpressionNode
static std::string getLinkedTargetsContent(
cmGeneratorTarget const* target, std::string const& prop,
cmGeneratorExpressionContext* context,
- cmGeneratorExpressionDAGChecker* dagChecker)
+ cmGeneratorExpressionDAGChecker* dagChecker,
+ cmGeneratorTarget::LinkInterfaceFor interfaceFor)
{
std::string result;
if (cmLinkImplementationLibraries const* impl =
@@ -2713,8 +2717,8 @@ static std::string getLinkedTargetsContent(
target->GetLocalGenerator(), context->Config, context->Quiet, target,
target, context->EvaluateForBuildsystem, lib.Backtrace,
context->Language);
- std::string libResult =
- lib.Target->EvaluateInterfaceProperty(prop, &libContext, dagChecker);
+ std::string libResult = lib.Target->EvaluateInterfaceProperty(
+ prop, &libContext, dagChecker, interfaceFor);
if (!libResult.empty()) {
if (result.empty()) {
result = std::move(libResult);
@@ -2872,29 +2876,22 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
std::string interfacePropertyName;
bool isInterfaceProperty = false;
+ cmGeneratorTarget::LinkInterfaceFor interfaceFor =
+ cmGeneratorTarget::LinkInterfaceFor::Usage;
-#define POPULATE_INTERFACE_PROPERTY_NAME(prop) \
- if (propertyName == #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- } else if (propertyName == "INTERFACE_" #prop) { \
- interfacePropertyName = "INTERFACE_" #prop; \
- isInterfaceProperty = true; \
- } else
-
- CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(POPULATE_INTERFACE_PROPERTY_NAME)
- // Note that the above macro terminates with an else
- /* else */ if (cmHasLiteralPrefix(propertyName, "COMPILE_DEFINITIONS_")) {
- cmPolicies::PolicyStatus polSt =
- context->LG->GetPolicyStatus(cmPolicies::CMP0043);
- if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
- interfacePropertyName = "INTERFACE_COMPILE_DEFINITIONS";
- }
+ if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
+ target->IsTransitiveProperty(propertyName, context->LG)) {
+ interfacePropertyName = std::string(transitiveProp->InterfaceName);
+ isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
+ interfaceFor = transitiveProp->InterfaceFor;
}
-#undef POPULATE_INTERFACE_PROPERTY_NAME
bool evaluatingLinkLibraries = false;
if (dagCheckerParent) {
+ // This $<TARGET_PROPERTY:...> node has been reached while evaluating
+ // another target property value. Check that the outermost evaluation
+ // expects such nested evaluations.
if (dagCheckerParent->EvaluatingGenexExpression() ||
dagCheckerParent->EvaluatingPICExpression() ||
dagCheckerParent->EvaluatingLinkerLauncher()) {
@@ -2910,21 +2907,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
}
} else {
-#define ASSERT_TRANSITIVE_PROPERTY_METHOD(METHOD) dagCheckerParent->METHOD() ||
- assert(CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(
- ASSERT_TRANSITIVE_PROPERTY_METHOD) false); // NOLINT(clang-tidy)
-#undef ASSERT_TRANSITIVE_PROPERTY_METHOD
+ assert(dagCheckerParent->EvaluatingTransitiveProperty());
}
}
if (isInterfaceProperty) {
return cmGeneratorExpression::StripEmptyListElements(
target->EvaluateInterfaceProperty(propertyName, context,
- dagCheckerParent));
+ dagCheckerParent, interfaceFor));
}
- cmGeneratorExpressionDAGChecker dagChecker(
- context->Backtrace, target, propertyName, content, dagCheckerParent);
+ cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, target,
+ propertyName, content,
+ dagCheckerParent, context->LG);
switch (dagChecker.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
@@ -2949,8 +2944,20 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
return std::string();
}
- if (!haveProp && !target->IsImported() &&
- target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
+ // Properties named by COMPATIBLE_INTERFACE_ properties combine over
+ // the transitive link closure as a single order-independent value.
+ // Imported targets do not themselves have a defined value for these
+ // properties, but they can contribute to the value of a non-imported
+ // dependent.
+ //
+ // For COMPATIBLE_INTERFACE_{BOOL,STRING}:
+ // * If set on this target, use the value directly. It is checked
+ // elsewhere for consistency over the transitive link closure.
+ // * If not set on this target, compute the value from the closure.
+ //
+ // For COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} we always compute the value
+ // from this target and the transitive link closure to get the max or min.
+ if (!haveProp && !target->IsImported()) {
if (target->IsLinkInterfaceDependentBoolProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
@@ -2967,26 +2974,8 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
context->Config);
return propContent ? propContent : "";
}
- if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
- context->Config)) {
- context->HadContextSensitiveCondition = true;
- const char* propContent =
- target->GetLinkInterfaceDependentNumberMinProperty(propertyName,
- context->Config);
- return propContent ? propContent : "";
- }
- if (target->IsLinkInterfaceDependentNumberMaxProperty(propertyName,
- context->Config)) {
- context->HadContextSensitiveCondition = true;
- const char* propContent =
- target->GetLinkInterfaceDependentNumberMaxProperty(propertyName,
- context->Config);
- return propContent ? propContent : "";
- }
}
-
- if (!target->IsImported() && dagCheckerParent &&
- !dagCheckerParent->EvaluatingLinkLibraries()) {
+ if (!evaluatingLinkLibraries && !target->IsImported()) {
if (target->IsLinkInterfaceDependentNumberMinProperty(propertyName,
context->Config)) {
context->HadContextSensitiveCondition = true;
@@ -3005,12 +2994,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
}
}
+ // Some properties, such as usage requirements, combine over the
+ // transitive link closure as an ordered list.
if (!interfacePropertyName.empty()) {
result = cmGeneratorExpression::StripEmptyListElements(
this->EvaluateDependentExpression(result, context->LG, context, target,
&dagChecker, target));
std::string linkedTargetsContent = getLinkedTargetsContent(
- target, interfacePropertyName, context, &dagChecker);
+ target, interfacePropertyName, context, &dagChecker, interfaceFor);
if (!linkedTargetsContent.empty()) {
result += (result.empty() ? "" : ";") + linkedTargetsContent;
}
@@ -4529,6 +4520,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
{ "ANGLE-R", &angle_rNode },
{ "COMMA", &commaNode },
{ "SEMICOLON", &semicolonNode },
+ { "QUOTE", &quoteNode },
{ "TARGET_PROPERTY", &targetPropertyNode },
{ "TARGET_NAME", &targetNameNode },
{ "TARGET_OBJECTS", &targetObjectsNode },
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0fe19de..75f3b6d 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -32,6 +32,7 @@
#include "cmCustomCommandGenerator.h"
#include "cmCxxModuleUsageEffects.h"
#include "cmEvaluatedTargetProperty.h"
+#include "cmExperimental.h"
#include "cmFileSet.h"
#include "cmFileTimes.h"
#include "cmGeneratedFileStream.h"
@@ -64,6 +65,7 @@
namespace {
using LinkInterfaceFor = cmGeneratorTarget::LinkInterfaceFor;
+using TransitiveProperty = cmGeneratorTarget::TransitiveProperty;
const std::string kINTERFACE_LINK_LIBRARIES = "INTERFACE_LINK_LIBRARIES";
const std::string kINTERFACE_LINK_LIBRARIES_DIRECT =
@@ -72,6 +74,33 @@ const std::string kINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE =
"INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE";
}
+const std::map<cm::string_view, TransitiveProperty>
+ cmGeneratorTarget::BuiltinTransitiveProperties = {
+ { "AUTOMOC_MACRO_NAMES"_s,
+ { "INTERFACE_AUTOMOC_MACRO_NAMES"_s, LinkInterfaceFor::Usage } },
+ { "AUTOUIC_OPTIONS"_s,
+ { "INTERFACE_AUTOUIC_OPTIONS"_s, LinkInterfaceFor::Usage } },
+ { "COMPILE_DEFINITIONS"_s,
+ { "INTERFACE_COMPILE_DEFINITIONS"_s, LinkInterfaceFor::Usage } },
+ { "COMPILE_FEATURES"_s,
+ { "INTERFACE_COMPILE_FEATURES"_s, LinkInterfaceFor::Usage } },
+ { "COMPILE_OPTIONS"_s,
+ { "INTERFACE_COMPILE_OPTIONS"_s, LinkInterfaceFor::Usage } },
+ { "INCLUDE_DIRECTORIES"_s,
+ { "INTERFACE_INCLUDE_DIRECTORIES"_s, LinkInterfaceFor::Usage } },
+ { "LINK_DEPENDS"_s,
+ { "INTERFACE_LINK_DEPENDS"_s, LinkInterfaceFor::Link } },
+ { "LINK_DIRECTORIES"_s,
+ { "INTERFACE_LINK_DIRECTORIES"_s, LinkInterfaceFor::Link } },
+ { "LINK_OPTIONS"_s,
+ { "INTERFACE_LINK_OPTIONS"_s, LinkInterfaceFor::Link } },
+ { "PRECOMPILE_HEADERS"_s,
+ { "INTERFACE_PRECOMPILE_HEADERS"_s, LinkInterfaceFor::Usage } },
+ { "SOURCES"_s, { "INTERFACE_SOURCES"_s, LinkInterfaceFor::Usage } },
+ { "SYSTEM_INCLUDE_DIRECTORIES"_s,
+ { "INTERFACE_SYSTEM_INCLUDE_DIRECTORIES"_s, LinkInterfaceFor::Usage } },
+ };
+
template <>
cmValue cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
cmGeneratorTarget const* tgt, cmMakefile const& /* mf */)
@@ -886,7 +915,7 @@ std::string cmGeneratorTarget::GetLinkerTypeProperty(
auto linkerType = this->GetProperty(propName);
if (!linkerType.IsEmpty()) {
cmGeneratorExpressionDAGChecker dagChecker(this, propName, nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
auto ltype =
cmGeneratorExpression::Evaluate(*linkerType, this->GetLocalGenerator(),
config, this, &dagChecker, this, lang);
@@ -928,7 +957,7 @@ bool cmGeneratorTarget::IsIPOEnabled(std::string const& lang,
{
cmValue feature = this->GetFeature("INTERPROCEDURAL_OPTIMIZATION", config);
- if (!cmIsOn(feature)) {
+ if (!feature.IsOn()) {
// 'INTERPROCEDURAL_OPTIMIZATION' is off, no need to check policies
return false;
}
@@ -1094,8 +1123,8 @@ cmValue cmGeneratorTarget::GetLanguageExtensions(std::string const& lang) const
bool cmGeneratorTarget::GetLanguageStandardRequired(
std::string const& lang) const
{
- return cmIsOn(
- this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED"));
+ return this->GetPropertyWithPairedLanguageSupport(lang, "_STANDARD_REQUIRED")
+ .IsOn();
}
void cmGeneratorTarget::GetModuleDefinitionSources(
@@ -1351,7 +1380,8 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
if (iter == this->SystemIncludesCache.end()) {
cmGeneratorExpressionDAGChecker dagChecker(
- this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr, nullptr);
+ this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr, nullptr,
+ this->LocalGenerator);
bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
@@ -1459,7 +1489,8 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
// a subset of TargetPropertyNode::Evaluate without stringify/parse steps
// but sufficient for transitive interface properties.
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace, this, prop,
- nullptr, dagCheckerParent);
+ nullptr, dagCheckerParent,
+ this->LocalGenerator);
switch (dagChecker.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
dagChecker.ReportError(
@@ -1524,6 +1555,38 @@ std::string cmGeneratorTarget::EvaluateInterfaceProperty(
return result;
}
+cm::optional<cmGeneratorTarget::TransitiveProperty>
+cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
+ cmLocalGenerator const* lg) const
+{
+ cm::optional<TransitiveProperty> result;
+ static const cm::string_view kINTERFACE_ = "INTERFACE_"_s;
+ if (cmHasPrefix(prop, kINTERFACE_)) {
+ prop = prop.substr(kINTERFACE_.length());
+ }
+ auto i = BuiltinTransitiveProperties.find(prop);
+ if (i != BuiltinTransitiveProperties.end()) {
+ result = i->second;
+ if (result->InterfaceFor != cmGeneratorTarget::LinkInterfaceFor::Usage) {
+ cmPolicies::PolicyStatus cmp0166 =
+ lg->GetPolicyStatus(cmPolicies::CMP0166);
+ if ((cmp0166 == cmPolicies::WARN || cmp0166 == cmPolicies::OLD) &&
+ (prop == "LINK_DIRECTORIES"_s || prop == "LINK_DEPENDS"_s ||
+ prop == "LINK_OPTIONS"_s)) {
+ result->InterfaceFor = cmGeneratorTarget::LinkInterfaceFor::Usage;
+ }
+ }
+ } else if (cmHasLiteralPrefix(prop, "COMPILE_DEFINITIONS_")) {
+ cmPolicies::PolicyStatus cmp0043 =
+ lg->GetPolicyStatus(cmPolicies::CMP0043);
+ if (cmp0043 == cmPolicies::WARN || cmp0043 == cmPolicies::OLD) {
+ result = TransitiveProperty{ "INTERFACE_COMPILE_DEFINITIONS"_s,
+ LinkInterfaceFor::Usage };
+ }
+ }
+ return result;
+}
+
namespace {
enum class IncludeDirectoryFallBack
@@ -1538,8 +1601,10 @@ std::string AddLangSpecificInterfaceIncludeDirectories(
const std::string& propertyName, IncludeDirectoryFallBack mode,
cmGeneratorExpressionDAGChecker* context)
{
- cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
- propertyName, nullptr, context };
+ cmGeneratorExpressionDAGChecker dag{
+ target->GetBacktrace(), target, propertyName, nullptr, context,
+ target->GetLocalGenerator()
+ };
switch (dag.Check()) {
case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
dag.ReportError(
@@ -1589,8 +1654,10 @@ void AddLangSpecificImplicitIncludeDirectories(
{
if (const auto* libraries = target->GetLinkImplementationLibraries(
config, LinkInterfaceFor::Usage)) {
- cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(), target,
- propertyName, nullptr, nullptr };
+ cmGeneratorExpressionDAGChecker dag{
+ target->GetBacktrace(), target, propertyName, nullptr, nullptr,
+ target->GetLocalGenerator()
+ };
for (const cmLinkImplItem& library : libraries->Libraries) {
if (const cmGeneratorTarget* dependency = library.Target) {
@@ -1842,8 +1909,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
this->DebugSourcesDone = true;
}
- cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr,
- nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr, nullptr,
+ this->LocalGenerator);
EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
this, config, std::string(), &dagChecker, this->SourceEntries);
@@ -2432,7 +2499,7 @@ bool cmGeneratorTarget::MacOSXUseInstallNameDir() const
cmValue build_with_install_name =
this->GetProperty("BUILD_WITH_INSTALL_NAME_DIR");
if (build_with_install_name) {
- return cmIsOn(*build_with_install_name);
+ return build_with_install_name.IsOn();
}
cmPolicies::PolicyStatus cmp0068 = this->GetPolicyStatusCMP0068();
@@ -3057,7 +3124,7 @@ void cmGeneratorTarget::GetAutoUicOptions(std::vector<std::string>& result,
}
cmGeneratorExpressionDAGChecker dagChecker(this, "AUTOUIC_OPTIONS", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator,
config, this, &dagChecker),
result);
@@ -3857,8 +3924,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetIncludeDirectories(
std::vector<BT<std::string>> includes;
std::unordered_set<std::string> uniqueIncludes;
- cmGeneratorExpressionDAGChecker dagChecker(this, "INCLUDE_DIRECTORIES",
- nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this, "INCLUDE_DIRECTORIES", nullptr, nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4122,7 +4189,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileOptions(
std::unordered_set<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(this, "COMPILE_OPTIONS", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4163,7 +4230,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileFeatures(
std::unordered_set<std::string> uniqueFeatures;
cmGeneratorExpressionDAGChecker dagChecker(this, "COMPILE_FEATURES", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4212,8 +4279,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetCompileDefinitions(
std::vector<BT<std::string>> list;
std::unordered_set<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this, "COMPILE_DEFINITIONS",
- nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this, "COMPILE_DEFINITIONS", nullptr, nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4276,8 +4343,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
}
std::unordered_set<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this, "PRECOMPILE_HEADERS",
- nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this, "PRECOMPILE_HEADERS", nullptr, nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4303,6 +4370,20 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetPrecompileHeaders(
return list;
}
+std::vector<std::string> cmGeneratorTarget::GetPchArchs(
+ std::string const& config, std::string const& lang) const
+{
+ std::vector<std::string> pchArchs;
+ if (!this->GetGlobalGenerator()->IsXcode()) {
+ pchArchs = this->GetAppleArchs(config, lang);
+ }
+ if (pchArchs.size() < 2) {
+ // We do not need per-arch PCH files when building for one architecture.
+ pchArchs = { {} };
+ }
+ return pchArchs;
+}
+
std::string cmGeneratorTarget::GetPchHeader(const std::string& config,
const std::string& language,
const std::string& arch) const
@@ -4666,7 +4747,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkOptions(
std::unordered_set<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_OPTIONS", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4834,8 +4915,8 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetStaticLibraryLinkOptions(
std::vector<BT<std::string>> result;
std::unordered_set<std::string> uniqueOptions;
- cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
- nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(
+ this, "STATIC_LIBRARY_OPTIONS", nullptr, nullptr, this->LocalGenerator);
EvaluatedTargetPropertyEntries entries;
if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
@@ -4948,7 +5029,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDirectories(
std::unordered_set<std::string> uniqueDirectories;
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_DIRECTORIES", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
cmList debugProperties{ this->Makefile->GetDefinition(
"CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -4992,7 +5073,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetLinkDepends(
std::vector<BT<std::string>> result;
std::unordered_set<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_DEPENDS", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
EvaluatedTargetPropertyEntries entries;
if (cmValue linkDepends = this->GetProperty("LINK_DEPENDS")) {
@@ -6385,6 +6466,7 @@ PropertyType checkInterfacePropertyCompatibility(cmGeneratorTarget const* tgt,
std::string interfaceProperty = "INTERFACE_" + p;
std::unique_ptr<cmGeneratorExpressionInterpreter> genexInterpreter;
if (p == "POSITION_INDEPENDENT_CODE") {
+ // Corresponds to EvaluatingPICExpression.
genexInterpreter = cm::make_unique<cmGeneratorExpressionInterpreter>(
tgt->GetLocalGenerator(), config, tgt);
}
@@ -6778,7 +6860,7 @@ bool cmGeneratorTarget::IsFortranBuildingInstrinsicModules() const
{
if (cmValue prop =
this->GetProperty("Fortran_BUILDING_INSTRINSIC_MODULES")) {
- return cmIsOn(*prop);
+ return prop.IsOn();
}
return false;
}
@@ -6977,7 +7059,8 @@ void cmGeneratorTarget::ExpandLinkItems(
return;
}
// Keep this logic in sync with ComputeLinkImplementationLibraries.
- cmGeneratorExpressionDAGChecker dagChecker(this, prop, nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(this, prop, nullptr, nullptr,
+ this->LocalGenerator);
// The $<LINK_ONLY> expression may be in a link interface to specify
// private link dependencies that are otherwise excluded from usage
// requirements.
@@ -7891,9 +7974,9 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = cmStrCat("IMPORTED_NO_SONAME", suffix);
if (cmValue config_no_soname = this->GetProperty(soProp)) {
- info.NoSOName = cmIsOn(*config_no_soname);
+ info.NoSOName = config_no_soname.IsOn();
} else if (cmValue no_soname = this->GetProperty("IMPORTED_NO_SONAME")) {
- info.NoSOName = cmIsOn(*no_soname);
+ info.NoSOName = no_soname.IsOn();
}
}
@@ -8421,9 +8504,119 @@ void ComputeLinkImplTransitive(cmGeneratorTarget const* self,
}
}
+bool cmGeneratorTarget::ApplyCXXStdTargets()
+{
+ cmStandardLevelResolver standardResolver(this->Makefile);
+ cmStandardLevel const cxxStd23 =
+ *standardResolver.LanguageStandardLevel("CXX", "23");
+ std::vector<std::string> const& configs =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+ auto std_prop = this->GetProperty("CXX_MODULE_STD");
+ if (!std_prop) {
+ // TODO(cxxmodules): Add a target policy to flip the default here. Set
+ // `std_prop` based on it.
+ return true;
+ }
+
+ std::string std_prop_value;
+ if (std_prop) {
+ // Evaluate generator expressions.
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
+ auto cge = ge.Parse(*std_prop);
+ if (!cge) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(R"(The "CXX_MODULE_STD" property on the target ")",
+ this->GetName(), "\" is not a valid generator expression."));
+ return false;
+ }
+ // But do not allow context-sensitive queries. Whether a target uses
+ // `import std` should not depend on configuration or properties of the
+ // consumer (head target). The link language also shouldn't matter, so ban
+ // it as well.
+ if (cge->GetHadHeadSensitiveCondition()) {
+ // Not reachable; all target-sensitive genexes actually fail to parse.
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(R"(The "CXX_MODULE_STD" property on the target ")",
+ this->GetName(),
+ "\" contains a condition that queries the "
+ "consuming target which is not supported."));
+ return false;
+ }
+ if (cge->GetHadLinkLanguageSensitiveCondition()) {
+ // Not reachable; all link language genexes actually fail to parse.
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(R"(The "CXX_MODULE_STD" property on the target ")",
+ this->GetName(),
+ "\" contains a condition that queries the "
+ "link language which is not supported."));
+ return false;
+ }
+ std_prop_value = cge->Evaluate(this->LocalGenerator, "");
+ if (cge->GetHadContextSensitiveCondition()) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(R"(The "CXX_MODULE_STD" property on the target ")",
+ this->GetName(),
+ "\" contains a context-sensitive condition "
+ "that is not supported."));
+ return false;
+ }
+ }
+ auto use_std = cmIsOn(std_prop_value);
+
+ // If we have a value and it is not true, there's nothing to do.
+ if (std_prop && !use_std) {
+ return true;
+ }
+
+ for (auto const& config : configs) {
+ if (this->HaveCxxModuleSupport(config) != Cxx20SupportLevel::Supported) {
+ continue;
+ }
+
+ cm::optional<cmStandardLevel> explicitLevel =
+ this->GetExplicitStandardLevel("CXX", config);
+ if (!explicitLevel || *explicitLevel < cxxStd23) {
+ continue;
+ }
+
+ auto const targetName = cmStrCat(
+ "__CMAKE::CXX", standardResolver.GetLevelString("CXX", *explicitLevel));
+ if (!this->Makefile->FindTargetToUse(targetName)) {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ R"(The "CXX_MODULE_STD" property on the target ")", this->GetName(),
+ "\" requires that the \"", targetName,
+ "\" target exist, but it was not provided by the toolchain."));
+ break;
+ }
+
+ // Check the experimental feature here as well. A toolchain may have
+ // provided the target and skipped the check in the toolchain preparation
+ // logic.
+ if (!cmExperimental::HasSupportEnabled(
+ *this->Makefile, cmExperimental::Feature::CxxImportStd)) {
+ break;
+ }
+
+ this->Target->AppendProperty(
+ "LINK_LIBRARIES",
+ cmStrCat("$<BUILD_LOCAL_INTERFACE:$<$<CONFIG:", config, ">:", targetName,
+ ">>"));
+ }
+
+ return true;
+}
+
bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
std::string const& config)
{
+ std::vector<std::string> allConfigs =
+ this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
cmOptionalLinkImplementation impl;
this->ComputeLinkImplementationLibraries(config, impl, this,
LinkInterfaceFor::Link);
@@ -8502,9 +8695,22 @@ bool cmGeneratorTarget::DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
// Create the generator target and attach it to the local generator.
auto gtp = cm::make_unique<cmGeneratorTarget>(tgt, lg);
+
synthDep = gtp.get();
cache.CxxModuleTargets[targetName] = synthDep;
+
+ // See `localGen->ComputeTargetCompileFeatures()` call in
+ // `cmGlobalGenerator::Compute` for where non-synthetic targets resolve
+ // this.
+ for (auto const& innerConfig : allConfigs) {
+ gtp->ComputeCompileFeatures(innerConfig);
+ }
+ // See `cmGlobalGenerator::ApplyCXXStdTargets` in
+ // `cmGlobalGenerator::Compute` for non-synthetic target resolutions.
+ gtp->ApplyCXXStdTargets();
+
gtp->DiscoverSyntheticTargets(cache, config);
+
lg->AddGeneratorTarget(std::move(gtp));
} else {
synthDep = cached->second;
@@ -8529,7 +8735,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
for (auto const& entry : entryRange) {
// Keep this logic in sync with ExpandLinkItems.
cmGeneratorExpressionDAGChecker dagChecker(this, "LINK_LIBRARIES", nullptr,
- nullptr);
+ nullptr, this->LocalGenerator);
// The $<LINK_ONLY> expression may be used to specify link dependencies
// that are otherwise excluded from usage requirements.
if (implFor == LinkInterfaceFor::Usage) {
@@ -9208,7 +9414,10 @@ std::string cmGeneratorTarget::GenerateHeaderSetVerificationFile(
// consider the headerFile as part of the entire language
// unit within include-what-you-use and as a result allows
// one to get IWYU advice for headers.
- fout << "#include <" << headerFilename << "> // IWYU pragma: associated\n";
+ // Also suppress clang-tidy include checks in generated code.
+ fout
+ << "/* NOLINTNEXTLINE(misc-header-include-cycle,misc-include-cleaner) */\n"
+ << "#include <" << headerFilename << "> /* IWYU pragma: associated */\n";
fout.close();
return filename;
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 71785b6..5c7201d 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -15,6 +15,7 @@
#include <vector>
#include <cm/optional>
+#include <cm/string_view>
#include "cmAlgorithms.h"
#include "cmComputeLinkInformation.h"
@@ -598,6 +599,8 @@ public:
std::vector<BT<std::string>> GetPrecompileHeaders(
const std::string& config, const std::string& language) const;
+ std::vector<std::string> GetPchArchs(std::string const& config,
+ std::string const& lang) const;
std::string GetPchHeader(const std::string& config,
const std::string& language,
const std::string& arch = std::string()) const;
@@ -884,7 +887,19 @@ public:
std::string EvaluateInterfaceProperty(
std::string const& prop, cmGeneratorExpressionContext* context,
cmGeneratorExpressionDAGChecker* dagCheckerParent,
- LinkInterfaceFor interfaceFor = LinkInterfaceFor::Usage) const;
+ LinkInterfaceFor interfaceFor) const;
+
+ struct TransitiveProperty
+ {
+ cm::string_view InterfaceName;
+ LinkInterfaceFor InterfaceFor;
+ };
+
+ static const std::map<cm::string_view, TransitiveProperty>
+ BuiltinTransitiveProperties;
+
+ cm::optional<TransitiveProperty> IsTransitiveProperty(
+ cm::string_view prop, cmLocalGenerator const* lg) const;
bool HaveInstallTreeRPATH(const std::string& config) const;
@@ -962,6 +977,7 @@ public:
std::string GetImportedXcFrameworkPath(const std::string& config) const;
+ bool ApplyCXXStdTargets();
bool DiscoverSyntheticTargets(cmSyntheticTargetCache& cache,
std::string const& config);
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 880756d..8e21da0 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -3,6 +3,10 @@
#include "cmGetPropertyCommand.h"
#include <cstddef>
+#include <functional>
+
+#include <cm/string_view>
+#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
@@ -267,6 +271,38 @@ bool cmGetPropertyCommand(std::vector<std::string> const& args,
return true;
}
+namespace GetPropertyCommand {
+bool GetSourceFilePropertyGENERATED(
+ const std::string& name, cmMakefile& mf,
+ const std::function<bool(bool)>& storeResult)
+{
+ // Globally set as generated?
+ // Note: If the given "name" only contains a filename or a relative path
+ // the file's location is ambiguous. In general, one would expect
+ // it in the source-directory, because that is where source files
+ // are located normally. However, generated files are normally
+ // generated in the build-directory. Therefore, we first check for
+ // a generated file in the build-directory before we check for a
+ // generated file in the source-directory.
+ {
+ auto file =
+ cmSystemTools::CollapseFullPath(name, mf.GetCurrentBinaryDirectory());
+ if (mf.GetGlobalGenerator()->IsGeneratedFile(file)) {
+ return storeResult(true);
+ }
+ }
+ {
+ auto file =
+ cmSystemTools::CollapseFullPath(name, mf.GetCurrentSourceDirectory());
+ if (mf.GetGlobalGenerator()->IsGeneratedFile(file)) {
+ return storeResult(true);
+ }
+ }
+ // Skip checking the traditional/local property.
+ return storeResult(false);
+}
+}
+
namespace {
// Implementation of result storage.
@@ -405,12 +441,32 @@ bool HandleSourceMode(cmExecutionStatus& status, const std::string& name,
return false;
}
+ // Special handling for GENERATED property.
+ // Note: Only, if CMP0163 is set to NEW!
+ if (propertyName == "GENERATED"_s) {
+ auto& mf = status.GetMakefile();
+ auto cmp0163 = directory_makefile.GetPolicyStatus(cmPolicies::CMP0163);
+ bool const cmp0163new =
+ cmp0163 != cmPolicies::OLD && cmp0163 != cmPolicies::WARN;
+ if (cmp0163new) {
+ return GetPropertyCommand::GetSourceFilePropertyGENERATED(
+ name, mf, [infoType, &variable, &mf](bool isGenerated) -> bool {
+ // Set the value on the original Makefile scope, not the scope of the
+ // requested directory.
+ return StoreResult(infoType, mf, variable,
+ (isGenerated) ? cmValue("1") : cmValue("0"));
+ });
+ }
+ }
+
// Get the source file.
const std::string source_file_absolute_path =
SetPropertyCommand::MakeSourceFilePathAbsoluteIfNeeded(
status, name, source_file_paths_should_be_absolute);
if (cmSourceFile* sf =
directory_makefile.GetOrCreateSource(source_file_absolute_path)) {
+ // Set the value on the original Makefile scope, not the scope of the
+ // requested directory.
return StoreResult(infoType, status.GetMakefile(), variable,
sf->GetPropertyForUser(propertyName));
}
diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx
index 40ae112..209030a 100644
--- a/Source/cmGetSourceFilePropertyCommand.cxx
+++ b/Source/cmGetSourceFilePropertyCommand.cxx
@@ -2,12 +2,24 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGetSourceFilePropertyCommand.h"
+#include <functional>
+
+#include <cm/string_view>
+#include <cmext/string_view>
+
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmPolicies.h"
#include "cmSetPropertyCommand.h"
#include "cmSourceFile.h"
#include "cmValue.h"
+namespace GetPropertyCommand {
+bool GetSourceFilePropertyGENERATED(
+ const std::string& name, cmMakefile& mf,
+ const std::function<bool(bool)>& storeResult);
+}
+
bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
@@ -23,11 +35,11 @@ bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
bool source_file_target_option_enabled = false;
int property_arg_index = 2;
- if (args[2] == "DIRECTORY" && args_size == 5) {
+ if (args[2] == "DIRECTORY"_s && args_size == 5) {
property_arg_index = 4;
source_file_directory_option_enabled = true;
source_file_directories.push_back(args[3]);
- } else if (args[2] == "TARGET_DIRECTORY" && args_size == 5) {
+ } else if (args[2] == "TARGET_DIRECTORY"_s && args_size == 5) {
property_arg_index = 4;
source_file_target_option_enabled = true;
source_file_target_directories.push_back(args[3]);
@@ -44,23 +56,44 @@ bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
}
std::string const& var = args[0];
+ std::string const& propName = args[property_arg_index];
bool source_file_paths_should_be_absolute =
source_file_directory_option_enabled || source_file_target_option_enabled;
+ cmMakefile& directory_makefile = *source_file_directory_makefiles[0];
+
+ // Special handling for GENERATED property.
+ // Note: Only, if CMP0163 is set to NEW!
+ if (propName == "GENERATED"_s) {
+ auto& mf = status.GetMakefile();
+ auto cmp0163 = directory_makefile.GetPolicyStatus(cmPolicies::CMP0163);
+ bool const cmp0163new =
+ cmp0163 != cmPolicies::OLD && cmp0163 != cmPolicies::WARN;
+ if (cmp0163new) {
+ return GetPropertyCommand::GetSourceFilePropertyGENERATED(
+ args[1], mf, [&var, &mf](bool isGenerated) -> bool {
+ // Set the value on the original Makefile scope, not the scope of the
+ // requested directory.
+ mf.AddDefinition(var, (isGenerated) ? cmValue("1") : cmValue("0"));
+ return true;
+ });
+ }
+ }
+
+ // Get the source file.
std::string const file =
SetPropertyCommand::MakeSourceFilePathAbsoluteIfNeeded(
status, args[1], source_file_paths_should_be_absolute);
- cmMakefile& mf = *source_file_directory_makefiles[0];
- cmSourceFile* sf = mf.GetSource(file);
+ cmSourceFile* sf = directory_makefile.GetSource(file);
// for the location we must create a source file first
- if (!sf && args[property_arg_index] == "LOCATION") {
- sf = mf.CreateSource(file);
+ if (!sf && propName == "LOCATION"_s) {
+ sf = directory_makefile.CreateSource(file);
}
if (sf) {
cmValue prop = nullptr;
- if (!args[property_arg_index].empty()) {
- prop = sf->GetPropertyForUser(args[property_arg_index]);
+ if (!propName.empty()) {
+ prop = sf->GetPropertyForUser(propName);
}
if (prop) {
// Set the value on the original Makefile scope, not the scope of the
@@ -70,6 +103,8 @@ bool cmGetSourceFilePropertyCommand(std::vector<std::string> const& args,
}
}
+ // Set the value on the original Makefile scope, not the scope of the
+ // requested directory.
status.GetMakefile().AddDefinition(var, "NOTFOUND");
return true;
}
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 940f49d..a92faef 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -593,7 +593,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
for (auto& sg : groupFilesList) {
std::ostream* fout;
bool useProjectFile =
- cmIsOn(this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE")) ||
+ this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE").IsOn() ||
this->Makefile->IsOn("CMAKE_GHS_NO_SOURCE_GROUP_FILE");
if (useProjectFile || sg.empty()) {
fout = &fout_proj;
@@ -764,7 +764,7 @@ std::string cmGhsMultiTargetGenerator::WriteObjectLangOverride(
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
{
if (cmValue p = this->GeneratorTarget->GetProperty("ghs_integrity_app")) {
- return cmIsOn(*p);
+ return p.IsOn();
}
std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
diff --git a/Source/cmGlobCacheEntry.h b/Source/cmGlobCacheEntry.h
new file mode 100644
index 0000000..acc410d
--- /dev/null
+++ b/Source/cmGlobCacheEntry.h
@@ -0,0 +1,30 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#pragma once
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#include <string>
+#include <vector>
+
+struct cmGlobCacheEntry
+{
+ const bool Recurse;
+ const bool ListDirectories;
+ const bool FollowSymlinks;
+ const std::string Relative;
+ const std::string Expression;
+ std::vector<std::string> Files;
+
+ cmGlobCacheEntry(bool recurse, bool listDirectories, bool followSymlinks,
+ std::string relative, std::string expression,
+ std::vector<std::string> files)
+ : Recurse(recurse)
+ , ListDirectories(listDirectories)
+ , FollowSymlinks(followSymlinks)
+ , Relative(std::move(relative))
+ , Expression(std::move(expression))
+ , Files(std::move(files))
+ {
+ }
+};
diff --git a/Source/cmGlobVerificationManager.cxx b/Source/cmGlobVerificationManager.cxx
index 89c5b01..73365d2 100644
--- a/Source/cmGlobVerificationManager.cxx
+++ b/Source/cmGlobVerificationManager.cxx
@@ -7,6 +7,7 @@
#include "cmsys/FStream.hxx"
#include "cmGeneratedFileStream.h"
+#include "cmGlobCacheEntry.h"
#include "cmListFileCache.h"
#include "cmMessageType.h"
#include "cmMessenger.h"
@@ -145,19 +146,18 @@ void cmGlobVerificationManager::CacheEntryKey::PrintGlobCommand(
}
void cmGlobVerificationManager::AddCacheEntry(
- const bool recurse, const bool listDirectories, const bool followSymlinks,
- const std::string& relative, const std::string& expression,
- const std::vector<std::string>& files, const std::string& variable,
+ const cmGlobCacheEntry& entry, const std::string& variable,
const cmListFileBacktrace& backtrace, cmMessenger* messenger)
{
- CacheEntryKey key = CacheEntryKey(recurse, listDirectories, followSymlinks,
- relative, expression);
+ CacheEntryKey key =
+ CacheEntryKey(entry.Recurse, entry.ListDirectories, entry.FollowSymlinks,
+ entry.Relative, entry.Expression);
CacheEntryValue& value = this->Cache[key];
if (!value.Initialized) {
- value.Files = files;
+ value.Files = entry.Files;
value.Initialized = true;
value.Backtraces.emplace_back(variable, backtrace);
- } else if (value.Initialized && value.Files != files) {
+ } else if (value.Initialized && value.Files != entry.Files) {
std::ostringstream message;
message << std::boolalpha;
message << "The glob expression\n ";
@@ -176,6 +176,21 @@ void cmGlobVerificationManager::AddCacheEntry(
}
}
+std::vector<cmGlobCacheEntry> cmGlobVerificationManager::GetCacheEntries()
+ const
+{
+ std::vector<cmGlobCacheEntry> entries;
+ for (auto const& i : this->Cache) {
+ CacheEntryKey k = std::get<0>(i);
+ CacheEntryValue v = std::get<1>(i);
+ if (v.Initialized) {
+ entries.emplace_back(k.Recurse, k.ListDirectories, k.FollowSymlinks,
+ k.Relative, k.Expression, v.Files);
+ }
+ }
+ return entries;
+}
+
void cmGlobVerificationManager::Reset()
{
this->Cache.clear();
diff --git a/Source/cmGlobVerificationManager.h b/Source/cmGlobVerificationManager.h
index 52d71aa..e9c519b 100644
--- a/Source/cmGlobVerificationManager.h
+++ b/Source/cmGlobVerificationManager.h
@@ -13,6 +13,7 @@
#include "cmListFileCache.h"
class cmMessenger;
+struct cmGlobCacheEntry;
/** \class cmGlobVerificationManager
* \brief Class for expressing build-time dependencies on glob expressions.
@@ -28,13 +29,13 @@ protected:
bool SaveVerificationScript(const std::string& path, cmMessenger* messenger);
//! Add an entry into the glob cache
- void AddCacheEntry(bool recurse, bool listDirectories, bool followSymlinks,
- const std::string& relative,
- const std::string& expression,
- const std::vector<std::string>& files,
+ void AddCacheEntry(const cmGlobCacheEntry& entry,
const std::string& variable,
const cmListFileBacktrace& bt, cmMessenger* messenger);
+ //! Get all cache entries
+ std::vector<cmGlobCacheEntry> GetCacheEntries() const;
+
//! Clear the glob cache for state reset.
void Reset();
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1606eec..e397fa2 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -224,7 +224,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
if (cmIsOff(makeProgram)) {
cmValue makeProgramCSTR =
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
- if (cmIsOff(makeProgramCSTR)) {
+ if (makeProgramCSTR.IsOff()) {
makeProgram = makeDefault;
} else {
makeProgram = *makeProgramCSTR;
@@ -334,7 +334,7 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
for (const auto& localGen : this->LocalGenerators) {
for (const auto& target : localGen->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
- cmIsOn(target->GetProperty("ghs_integrity_app"))) {
+ target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
}
@@ -406,7 +406,7 @@ bool cmGlobalGenerator::CheckTargetsForPchCompilePdb() const
for (const auto& generator : this->LocalGenerators) {
for (const auto& target : generator->GetGeneratorTargets()) {
if (!target->CanCompileSources() ||
- cmIsOn(target->GetProperty("ghs_integrity_app"))) {
+ target->GetProperty("ghs_integrity_app").IsOn()) {
continue;
}
@@ -450,13 +450,13 @@ bool cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
"all generators must specify this->FindMakeProgramFile");
return false;
}
- if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
+ if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::string setMakeProgram = mf->GetModulesFile(this->FindMakeProgramFile);
if (!setMakeProgram.empty()) {
mf->ReadListFile(setMakeProgram);
}
}
- if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
+ if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
std::ostringstream err;
err << "CMake was unable to find a build program corresponding to \""
<< this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
@@ -1581,6 +1581,29 @@ bool cmGlobalGenerator::Compute()
}
#endif
+ // Perform up-front computation in order to handle errors (such as unknown
+ // features) at this point. While processing the compile features we also
+ // calculate and cache the language standard required by the compile
+ // features.
+ //
+ // Synthetic targets performed this inside of
+ // `cmLocalGenerator::DiscoverSyntheticTargets`
+ for (const auto& localGen : this->LocalGenerators) {
+ if (!localGen->ComputeTargetCompileFeatures()) {
+ return false;
+ }
+ }
+
+ // We now have all targets set up and std levels constructed. Add
+ // `__CMAKE::CXX*` targets as link dependencies to all targets which need
+ // them.
+ //
+ // Synthetic targets performed this inside of
+ // `cmLocalGenerator::DiscoverSyntheticTargets`
+ if (!this->ApplyCXXStdTargets()) {
+ return false;
+ }
+
// Iterate through all targets and set up C++20 module targets.
// Create target templates for each imported target with C++20 modules.
// INTERFACE library with BMI-generating rules and a collation step?
@@ -1588,6 +1611,9 @@ bool cmGlobalGenerator::Compute()
// Make `add_dependencies(imported_target
// $<$<TARGET_NAME_IF_EXISTS:uses_imported>:synth1>
// $<$<TARGET_NAME_IF_EXISTS:other_uses_imported>:synth2>)`
+ //
+ // Note that synthetic target creation performs the above marked
+ // steps on the created targets.
if (!this->DiscoverSyntheticTargets()) {
return false;
}
@@ -1597,16 +1623,6 @@ bool cmGlobalGenerator::Compute()
localGen->AddHelperCommands();
}
- // Perform up-front computation in order to handle errors (such as unknown
- // features) at this point. While processing the compile features we also
- // calculate and cache the language standard required by the compile
- // features.
- for (const auto& localGen : this->LocalGenerators) {
- if (!localGen->ComputeTargetCompileFeatures()) {
- return false;
- }
- }
-
// Add automatically generated sources (e.g. unity build).
// Add unity sources after computing compile features. Unity sources do
// not change the set of languages or features, but we need to know them
@@ -1824,6 +1840,19 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
entry->second = index++;
}
+bool cmGlobalGenerator::ApplyCXXStdTargets()
+{
+ for (auto const& gen : this->LocalGenerators) {
+ for (auto const& tgt : gen->GetGeneratorTargets()) {
+ if (!tgt->ApplyCXXStdTargets()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
bool cmGlobalGenerator::DiscoverSyntheticTargets()
{
cmSyntheticTargetCache cache;
@@ -2821,7 +2850,7 @@ void cmGlobalGenerator::AddGlobalTarget_Package(
} else {
cmValue noPackageAll =
mf->GetDefinition("CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY");
- if (cmIsOff(noPackageAll)) {
+ if (noPackageAll.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -2889,7 +2918,7 @@ void cmGlobalGenerator::AddGlobalTarget_Test(
// by default. Enable it only if CMAKE_SKIP_TEST_ALL_DEPENDENCY is
// explicitly set to OFF.
if (cmValue noall = mf->GetDefinition("CMAKE_SKIP_TEST_ALL_DEPENDENCY")) {
- if (cmIsOff(noall)) {
+ if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -3013,7 +3042,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install(
gti.Depends.emplace_back(this->GetPreinstallTargetName());
} else {
cmValue noall = mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if (cmIsOff(noall)) {
+ if (noall.IsOff()) {
gti.Depends.emplace_back(this->GetAllTargetName());
}
}
@@ -3095,7 +3124,7 @@ bool cmGlobalGenerator::UseFolderProperty() const
// If this property is defined, let the setter turn this on or off.
if (prop) {
- return cmIsOn(*prop);
+ return prop.IsOn();
}
// If CMP0143 is NEW `treat` "USE_FOLDERS" as ON. Otherwise `treat` it as OFF
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ba39768..1ca02d9 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -674,6 +674,7 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
+ bool ApplyCXXStdTargets();
bool DiscoverSyntheticTargets();
bool AddHeaderSetVerification();
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 4ba53ec..37bcc2c 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -124,7 +124,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
{
/* set primary target */
cmValue t = mf->GetDefinition("GHS_PRIMARY_TARGET");
- if (cmIsOff(t)) {
+ if (t.IsOff()) {
/* Use the value from `-A` or use `arm` */
std::string arch = "arm";
if (!cmIsOff(p)) {
@@ -297,18 +297,18 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
// Specify BSP option if supplied by user
// -- not all platforms require this entry in the project file
cmValue bspName = root->GetMakefile()->GetDefinition("GHS_BSP_NAME");
- if (!cmIsOff(bspName)) {
+ if (!bspName.IsOff()) {
fout << " -bsp " << *bspName << '\n';
}
// Specify OS DIR if supplied by user
// -- not all platforms require this entry in the project file
cmValue osDir = root->GetMakefile()->GetDefinition("GHS_OS_DIR");
- if (!cmIsOff(osDir)) {
+ if (!osDir.IsOff()) {
cmValue osDirOption =
root->GetMakefile()->GetDefinition("GHS_OS_DIR_OPTION");
fout << " ";
- if (cmIsOff(osDirOption)) {
+ if (osDirOption.IsOff()) {
fout << "";
} else {
fout << *osDirOption;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 30206b5..56748a5 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -698,7 +698,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
if (cmValue tgtMsg =
this->GetCMakeInstance()->GetState()->GetGlobalProperty(
"TARGET_MESSAGES")) {
- targetMessages = cmIsOn(*tgtMsg);
+ targetMessages = tgtMsg.IsOn();
}
if (targetMessages) {
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index 68b4d1a..35b69af 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -390,7 +390,7 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKMaxVersion(
"CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION_MAXIMUM")) {
// If the value is some off/false value, then there is NO maximum set.
- if (cmIsOff(value)) {
+ if (value.IsOff()) {
return std::string();
}
// If the value is something else, trust that it is a valid SDK value.
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 9739a09..866ace2 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -740,7 +740,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
}
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for (std::string const& i : configs) {
- if (cmIsOff(target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i))) {
+ if (target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i).IsOff()) {
activeConfigs.insert(i);
}
}
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 5305fec..6fdc32c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -491,7 +491,7 @@ bool cmGlobalVisualStudioGenerator::FindMakeProgram(cmMakefile* mf)
// Visual Studio generators know how to lookup their build tool
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
- if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
+ if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetVSMakeProgram());
}
return true;
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 98d77c6..8067694 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -269,7 +269,7 @@ bool cmGlobalXCodeGenerator::FindMakeProgram(cmMakefile* mf)
// The Xcode generator knows how to lookup its build tool
// directly instead of needing a helper module to do it, so we
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
- if (cmIsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
+ if (mf->GetDefinition("CMAKE_MAKE_PROGRAM").IsOff()) {
mf->AddDefinition("CMAKE_MAKE_PROGRAM", this->GetXcodeBuildCommand());
}
return true;
@@ -1095,7 +1095,7 @@ std::string GetSourcecodeValueFromFileExtension(
bool& keepLastKnownFileType, const std::vector<std::string>& enabled_langs)
{
std::string ext = cmSystemTools::LowerCase(_ext);
- std::string sourcecode = "sourcecode";
+ std::string sourcecode = "default";
if (ext == "o"_s) {
keepLastKnownFileType = true;
@@ -1110,42 +1110,42 @@ std::string GetSourcecodeValueFromFileExtension(
sourcecode = "file.storyboard";
// NOLINTNEXTLINE(bugprone-branch-clone)
} else if (ext == "mm"_s && !cm::contains(enabled_langs, "OBJCXX")) {
- sourcecode += ".cpp.objcpp";
+ sourcecode = "sourcecode.cpp.objcpp";
// NOLINTNEXTLINE(bugprone-branch-clone)
} else if (ext == "m"_s && !cm::contains(enabled_langs, "OBJC")) {
- sourcecode += ".c.objc";
+ sourcecode = "sourcecode.c.objc";
} else if (ext == "swift"_s) {
- sourcecode += ".swift";
+ sourcecode = "sourcecode.swift";
} else if (ext == "plist"_s) {
- sourcecode += ".text.plist";
+ sourcecode = "sourcecode.text.plist";
} else if (ext == "h"_s) {
- sourcecode += ".c.h";
+ sourcecode = "sourcecode.c.h";
} else if (ext == "hxx"_s || ext == "hpp"_s || ext == "txx"_s ||
ext == "pch"_s || ext == "hh"_s || ext == "inl"_s) {
- sourcecode += ".cpp.h";
+ sourcecode = "sourcecode.cpp.h";
} else if (ext == "png"_s || ext == "gif"_s || ext == "jpg"_s) {
keepLastKnownFileType = true;
sourcecode = "image";
} else if (ext == "txt"_s) {
- sourcecode += ".text";
+ sourcecode = "sourcecode.text";
} else if (lang == "CXX"_s) {
- sourcecode += ".cpp.cpp";
+ sourcecode = "sourcecode.cpp.cpp";
} else if (lang == "C"_s) {
- sourcecode += ".c.c";
+ sourcecode = "sourcecode.c.c";
} else if (lang == "OBJCXX"_s) {
- sourcecode += ".cpp.objcpp";
+ sourcecode = "sourcecode.cpp.objcpp";
} else if (lang == "OBJC"_s) {
- sourcecode += ".c.objc";
+ sourcecode = "sourcecode.c.objc";
} else if (lang == "Fortran"_s) {
- sourcecode += ".fortran.f90";
+ sourcecode = "sourcecode.fortran.f90";
} else if (lang == "ASM"_s) {
- sourcecode += ".asm";
+ sourcecode = "sourcecode.asm";
} else if (ext == "metal"_s) {
- sourcecode += ".metal";
+ sourcecode = "sourcecode.metal";
} else if (ext == "mig"_s) {
- sourcecode += ".mig";
+ sourcecode = "sourcecode.mig";
} else if (ext == "tbd"_s) {
- sourcecode += ".text-based-dylib-definition";
+ sourcecode = "sourcecode.text-based-dylib-definition";
} else if (ext == "a"_s) {
keepLastKnownFileType = true;
sourcecode = "archive.ar";
@@ -3115,8 +3115,12 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
"shellScript", this->CreateString("# shell script goes here\nexit 0"));
shellBuildPhase->AddAttribute("showEnvVarsInLog", this->CreateString("0"));
- cmXCodeObject* target =
- this->CreateObject(cmXCodeObject::PBXAggregateTarget);
+ std::string targetBinaryPath = cmStrCat(
+ gtgt->Makefile->GetCurrentBinaryDirectory(), '/', gtgt->GetName());
+
+ cmXCodeObject* target = this->CreateObject(
+ cmXCodeObject::PBXAggregateTarget,
+ cmStrCat("PBXAggregateTarget:", gtgt->GetName(), ":", targetBinaryPath));
target->SetComment(gtgt->GetName());
cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> emptyContentVector;
@@ -3340,7 +3344,14 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
if (!gtgt->IsInBuildSystem()) {
return nullptr;
}
- cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXNativeTarget);
+
+ std::string targetBinaryPath = this->RelativeToRootBinary(cmStrCat(
+ gtgt->Makefile->GetCurrentBinaryDirectory(), '/', gtgt->GetName()));
+
+ cmXCodeObject* target = this->CreateObject(
+ cmXCodeObject::PBXNativeTarget,
+ cmStrCat("PBXNativeTarget:", gtgt->GetName(), ":", targetBinaryPath));
+
target->AddAttribute("buildPhases", buildPhases);
cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("buildRules", buildRules);
@@ -4223,18 +4234,18 @@ void cmGlobalXCodeGenerator::AddEmbeddedObjects(
cmXCodeObject* attrs = this->CreateObject(cmXCodeObject::OBJECT_LIST);
bool removeHeaders = actionsOnByDefault & RemoveHeadersOnCopyByDefault;
- if (auto prop = gt->GetProperty(
+ if (cmValue prop = gt->GetProperty(
cmStrCat(embedPropertyName, "_REMOVE_HEADERS_ON_COPY"))) {
- removeHeaders = cmIsOn(*prop);
+ removeHeaders = prop.IsOn();
}
if (removeHeaders) {
attrs->AddObject(this->CreateString("RemoveHeadersOnCopy"));
}
bool codeSign = actionsOnByDefault & CodeSignOnCopyByDefault;
- if (auto prop =
+ if (cmValue prop =
gt->GetProperty(cmStrCat(embedPropertyName, "_CODE_SIGN_ON_COPY"))) {
- codeSign = cmIsOn(*prop);
+ codeSign = prop.IsOn();
}
if (codeSign) {
attrs->AddObject(this->CreateString("CodeSignOnCopy"));
@@ -5130,6 +5141,17 @@ std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
return p;
}
+std::string cmGlobalXCodeGenerator::RelativeToRootBinary(const std::string& p)
+{
+ std::string binaryDirectory =
+ this->CurrentRootGenerator->GetCurrentBinaryDirectory();
+ if (cmSystemTools::IsSubDirectory(p, binaryDirectory)) {
+ binaryDirectory = cmSystemTools::ForceToRelativePath(binaryDirectory, p);
+ }
+
+ return binaryDirectory;
+}
+
std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p)
{
return this->CurrentRootGenerator->MaybeRelativeToCurBinDir(p);
@@ -5298,7 +5320,7 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
return mf->PlatformIsAppleEmbedded();
}
- return cmIsOn(*epnValue);
+ return epnValue.IsOn();
}
bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 12a5cad..2375e95 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -161,6 +161,7 @@ private:
bool CreateGroups(std::vector<cmLocalGenerator*>& generators);
std::string XCodeEscapePath(const std::string& p);
std::string RelativeToSource(const std::string& p);
+ std::string RelativeToRootBinary(const std::string& p);
std::string RelativeToBinary(const std::string& p);
std::string ConvertToRelativeForMake(std::string const& p);
void CreateCustomCommands(
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index a8a7abb..6c3afef 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -284,7 +284,8 @@ void cmGraphVizWriter::Write()
// Reserved targets have inconsistent names across platforms (e.g. 'all'
// vs. 'ALL_BUILD'), which can disrupt the traversal ordering.
// We don't need or want them anyway.
- if (!cmGlobalGenerator::IsReservedTarget(gt->GetName())) {
+ if (!cmGlobalGenerator::IsReservedTarget(gt->GetName()) &&
+ !cmHasLiteralPrefix(gt->GetName(), "__cmake_")) {
sortedGeneratorTargets.insert(gt.get());
}
}
diff --git a/Source/cmLinkLineDeviceComputer.cxx b/Source/cmLinkLineDeviceComputer.cxx
index 28aa5d9..f1bda8d 100644
--- a/Source/cmLinkLineDeviceComputer.cxx
+++ b/Source/cmLinkLineDeviceComputer.cxx
@@ -204,7 +204,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
target.GetProperty("CUDA_RESOLVE_DEVICE_SYMBOLS")) {
// If CUDA_RESOLVE_DEVICE_SYMBOLS has been explicitly set we need
// to honor the value no matter what it is.
- return cmIsOn(*resolveDeviceSymbols);
+ return resolveDeviceSymbols.IsOn();
}
// Determine if we have any dependencies that require
@@ -213,7 +213,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
target.GetLinkClosure(config);
if (cm::contains(closure->Languages, "CUDA")) {
- if (cmIsOn(target.GetProperty("CUDA_SEPARABLE_COMPILATION"))) {
+ if (target.GetProperty("CUDA_SEPARABLE_COMPILATION").IsOn()) {
bool doDeviceLinking = false;
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY:
diff --git a/Source/cmList.h b/Source/cmList.h
index c29aae7..e107096 100644
--- a/Source/cmList.h
+++ b/Source/cmList.h
@@ -6,7 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <algorithm>
-#include <cstdint>
+#include <cstddef>
#include <initializer_list>
#include <iterator>
#include <memory>
@@ -47,7 +47,7 @@ public:
using value_type = container_type::value_type;
using allocator_type = container_type::allocator_type;
- using index_type = std::intptr_t;
+ using index_type = std::ptrdiff_t;
using size_type = container_type::size_type;
using difference_type = container_type::difference_type;
using reference = container_type::reference;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d38ed50..ffd41d2 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -595,7 +595,7 @@ void cmLocalGenerator::GenerateInstallRules()
"CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM")) {
/* clang-format off */
fout <<
- "# Set default install directory permissions.\n"
+ "# Set OS and executable format for runtime-dependencies.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM \""
<< *platform << "\")\n"
@@ -611,7 +611,7 @@ void cmLocalGenerator::GenerateInstallRules()
this->Makefile->GetDefinition("CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL")) {
/* clang-format off */
fout <<
- "# Set default install directory permissions.\n"
+ "# Set tool for dependency-resolution of runtime-dependencies.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_TOOL \""
<< *command << "\")\n"
@@ -627,7 +627,7 @@ void cmLocalGenerator::GenerateInstallRules()
"CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND")) {
/* clang-format off */
fout <<
- "# Set default install directory permissions.\n"
+ "# Set path to tool for dependency-resolution of runtime-dependencies.\n"
"if(NOT DEFINED CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND)\n"
" set(CMAKE_GET_RUNTIME_DEPENDENCIES_COMMAND \""
<< *command << "\")\n"
@@ -644,7 +644,7 @@ void cmLocalGenerator::GenerateInstallRules()
if (cmValue command = this->Makefile->GetDefinition("CMAKE_OBJDUMP")) {
/* clang-format off */
fout <<
- "# Set default install directory permissions.\n"
+ "# Set path to fallback-tool for dependency-resolution.\n"
"if(NOT DEFINED CMAKE_OBJDUMP)\n"
" set(CMAKE_OBJDUMP \""
<< *command << "\")\n"
@@ -910,8 +910,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
for (std::string const& i : includes) {
if (cmNonempty(fwSearchFlag) && this->Makefile->IsOn("APPLE") &&
cmSystemTools::IsPathToFramework(i)) {
- std::string const frameworkDir =
- cmSystemTools::CollapseFullPath(cmStrCat(i, "/../"));
+ std::string const frameworkDir = cmSystemTools::GetFilenamePath(i);
if (emitted.insert(frameworkDir).second) {
if (sysFwSearchFlag && target &&
target->IsSystemIncludeDirectory(frameworkDir, config, lang)) {
@@ -1479,7 +1478,7 @@ void cmLocalGenerator::GetTargetFlags(
CM_FALLTHROUGH;
case cmStateEnums::SHARED_LIBRARY: {
std::string sharedLibFlags;
- if (linkLanguage != "Swift") {
+ if (this->IsSplitSwiftBuild() || linkLanguage != "Swift") {
sharedLibFlags = cmStrCat(
this->Makefile->GetSafeDefinition(libraryLinkVariable), ' ');
if (!configUpper.empty()) {
@@ -1522,6 +1521,13 @@ void cmLocalGenerator::GetTargetFlags(
} break;
case cmStateEnums::EXECUTABLE: {
std::string exeFlags;
+ if (linkLanguage.empty()) {
+ cmSystemTools::Error(
+ "CMake can not determine linker language for target: " +
+ target->GetName());
+ return;
+ }
+
if (linkLanguage != "Swift") {
exeFlags = this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
exeFlags += " ";
@@ -1530,28 +1536,22 @@ void cmLocalGenerator::GetTargetFlags(
cmStrCat("CMAKE_EXE_LINKER_FLAGS_", configUpper));
exeFlags += " ";
}
- if (linkLanguage.empty()) {
- cmSystemTools::Error(
- "CMake can not determine linker language for target: " +
- target->GetName());
- return;
- }
+ }
- if (target->IsWin32Executable(config)) {
- exeFlags += this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", linkLanguage, "_CREATE_WIN32_EXE"));
- exeFlags += " ";
- } else {
- exeFlags += this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_", linkLanguage, "_CREATE_CONSOLE_EXE"));
- exeFlags += " ";
- }
+ if (target->IsWin32Executable(config)) {
+ exeFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", linkLanguage, "_CREATE_WIN32_EXE"));
+ exeFlags += " ";
+ } else {
+ exeFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_", linkLanguage, "_CREATE_CONSOLE_EXE"));
+ exeFlags += " ";
+ }
- if (target->IsExecutableWithExports()) {
- exeFlags += this->Makefile->GetSafeDefinition(
- cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"));
- exeFlags += " ";
- }
+ if (target->IsExecutableWithExports()) {
+ exeFlags += this->Makefile->GetSafeDefinition(
+ cmStrCat("CMAKE_EXE_EXPORTS_", linkLanguage, "_FLAG"));
+ exeFlags += " ";
}
this->AddLanguageFlagsForLinking(flags, target, linkLanguage, config);
@@ -2721,15 +2721,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
continue;
}
- std::vector<std::string> architectures;
- if (!this->GetGlobalGenerator()->IsXcode()) {
- architectures = target->GetAppleArchs(config, lang);
- }
- if (architectures.empty()) {
- architectures.emplace_back();
- } else {
+ std::vector<std::string> pchArchs = target->GetPchArchs(config, lang);
+ if (pchArchs.size() > 1) {
std::string useMultiArchPch;
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchHeader =
target->GetPchHeader(config, lang, arch);
if (!pchHeader.empty()) {
@@ -2746,7 +2741,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
}
}
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchSource = target->GetPchSource(config, lang, arch);
const std::string pchHeader = target->GetPchHeader(config, lang, arch);
@@ -3135,7 +3130,10 @@ void cmLocalGenerator::WriteUnitySourceInclude(
unity_file << *beforeInclude << "\n";
}
- unity_file << "/* NOLINTNEXTLINE(bugprone-suspicious-include) */\n";
+ // clang-tidy-17 has new include checks that needs NOLINT too.
+ unity_file
+ << "/* NOLINTNEXTLINE(bugprone-suspicious-include,misc-include-cleaner) "
+ "*/\n";
unity_file << "#include \"" << sf_full_path << "\"\n";
if (afterInclude) {
@@ -3425,7 +3423,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
const std::string mode = cmIsOn(PICValue) ? "PIE" : "NO_PIE";
std::string supported = "CMAKE_" + lang + "_LINK_" + mode + "_SUPPORTED";
- if (cmIsOff(this->Makefile->GetDefinition(supported))) {
+ if (this->Makefile->GetDefinition(supported).IsOff()) {
return;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 7bce1d2..7def1fe 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -898,7 +898,7 @@ void cmLocalUnixMakefileGenerator3::AppendRuleDepend(
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
cmValue nodep = this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
- if (cmIsOff(nodep)) {
+ if (nodep.IsOff()) {
depends.emplace_back(ruleFileName);
}
}
@@ -1532,7 +1532,7 @@ bool cmLocalUnixMakefileGenerator3::ScanDependencies(
if (haveDirectoryInfo) {
// Test whether we need to force Unix paths.
if (cmValue force = mf->GetDefinition("CMAKE_FORCE_UNIX_PATHS")) {
- if (!cmIsOff(force)) {
+ if (!force.IsOff()) {
cmSystemTools::SetForceUnixPaths(true);
}
}
@@ -1784,7 +1784,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
depends.clear();
cmValue noall =
this->Makefile->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if (cmIsOff(noall)) {
+ if (noall.IsOff()) {
// Drive the build before installing.
depends.emplace_back("all");
} else if (regenerate) {
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index d315f0f..12ca528 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1135,7 +1135,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
cmStrCat(target->GetPDBDirectory(configName), '/', targetNames.PDB);
fout << "\t\t\t\tProgramDatabaseFile=\""
<< this->ConvertToXMLOutputPathSingle(temp) << "\"\n";
- if (targetOptions.IsDebug()) {
+ if (targetOptions.UsingDebugInfo()) {
fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n";
}
if (this->WindowsCEProject) {
@@ -1223,7 +1223,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
target->GetPDBDirectory(configName));
fout << "\t\t\t\tProgramDatabaseFile=\"" << path << "/"
<< targetNames.PDB << "\"\n";
- if (targetOptions.IsDebug()) {
+ if (targetOptions.UsingDebugInfo()) {
fout << "\t\t\t\tGenerateDebugInformation=\"true\"\n";
}
if (this->WindowsCEProject) {
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 509f28b..ba9fab5 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2522,7 +2522,7 @@ void cmMakefile::ExpandVariablesCMP0019()
bool cmMakefile::IsOn(const std::string& name) const
{
- return cmIsOn(this->GetDefinition(name));
+ return this->GetDefinition(name).IsOn();
}
bool cmMakefile::IsSet(const std::string& name) const
@@ -3906,8 +3906,8 @@ void cmMakefile::DisplayStatus(const std::string& message, float s) const
#endif
}
-std::string cmMakefile::GetModulesFile(const std::string& filename,
- bool& system, bool debug,
+std::string cmMakefile::GetModulesFile(cm::string_view filename, bool& system,
+ bool debug,
std::string& debugBuffer) const
{
std::string result;
@@ -4025,7 +4025,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
// Replace #cmakedefine instances.
if (this->cmDefineRegex.find(line)) {
cmValue def = this->GetDefinition(this->cmDefineRegex.match(2));
- if (!cmIsOff(def)) {
+ if (!def.IsOff()) {
const std::string indentation = this->cmDefineRegex.match(1);
cmSystemTools::ReplaceString(line,
cmStrCat("#", indentation, "cmakedefine"),
@@ -4043,7 +4043,7 @@ void cmMakefile::ConfigureString(const std::string& input, std::string& output,
cmStrCat("#", indentation, "cmakedefine01"),
cmStrCat("#", indentation, "define"));
output += line;
- if (!cmIsOff(def)) {
+ if (!def.IsOff()) {
output += " 1";
} else {
output += " 0";
@@ -4218,7 +4218,7 @@ cmValue cmMakefile::GetProperty(const std::string& prop, bool chain) const
bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
std::vector<std::string> cmMakefile::GetPropertyKeys() const
@@ -4625,7 +4625,7 @@ bool cmMakefile::PolicyOptionalWarningEnabled(std::string const& var) const
{
// Check for an explicit CMAKE_POLICY_WARNING_CMP<NNNN> setting.
if (cmValue val = this->GetDefinition(var)) {
- return cmIsOn(val);
+ return val.IsOn();
}
// Enable optional policy warnings with --debug-output, --trace,
// or --trace-expand.
@@ -4657,13 +4657,14 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
// Deprecate old policies.
- if (status == cmPolicies::OLD && id <= cmPolicies::CMP0126 &&
+ if (status == cmPolicies::OLD && id <= cmPolicies::CMP0128 &&
!(this->GetCMakeInstance()->GetIsInTryCompile() &&
(
// Policies set by cmCoreTryCompile::TryCompileCode.
id == cmPolicies::CMP0065 || id == cmPolicies::CMP0083 ||
id == cmPolicies::CMP0091 || id == cmPolicies::CMP0104 ||
- id == cmPolicies::CMP0123 || id == cmPolicies::CMP0126)) &&
+ id == cmPolicies::CMP0123 || id == cmPolicies::CMP0126 ||
+ id == cmPolicies::CMP0128)) &&
(!this->IsSet("CMAKE_WARN_DEPRECATED") ||
this->IsOn("CMAKE_WARN_DEPRECATED"))) {
this->IssueMessage(MessageType::DEPRECATION_WARNING,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index e5edbae..ea0b4c6 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -803,7 +803,7 @@ public:
/**
* Return a location of a file in cmake or custom modules directory
*/
- std::string GetModulesFile(const std::string& name) const
+ std::string GetModulesFile(cm::string_view name) const
{
bool system;
std::string debugBuffer;
@@ -813,13 +813,13 @@ public:
/**
* Return a location of a file in cmake or custom modules directory
*/
- std::string GetModulesFile(const std::string& name, bool& system) const
+ std::string GetModulesFile(cm::string_view name, bool& system) const
{
std::string debugBuffer;
return this->GetModulesFile(name, system, false, debugBuffer);
}
- std::string GetModulesFile(const std::string& name, bool& system, bool debug,
+ std::string GetModulesFile(cm::string_view name, bool& system, bool debug,
std::string& debugBuffer) const;
//! Set/Get a property of this directory
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index ff509ce..d5c50bc 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -65,7 +65,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
this->NoRuleMessages = false;
if (cmValue ruleStatus =
cm->GetState()->GetGlobalProperty("RULE_MESSAGES")) {
- this->NoRuleMessages = cmIsOff(*ruleStatus);
+ this->NoRuleMessages = ruleStatus.IsOff();
}
switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) {
case cmPolicies::WARN:
@@ -244,7 +244,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
}
// add custom commands to the clean rules?
- bool const clean = cmIsOff(this->Makefile->GetProperty("CLEAN_NO_CUSTOM"));
+ bool const clean = this->Makefile->GetProperty("CLEAN_NO_CUSTOM").IsOff();
// First generate the object rule files. Save a list of all object
// files for this target.
@@ -613,8 +613,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
// Use compiler to generate dependencies, if supported.
bool const compilerGenerateDeps =
this->GlobalGenerator->SupportsCompilerDependencies() &&
- cmIsOn(this->Makefile->GetDefinition(
- cmStrCat("CMAKE_", lang, "_DEPENDS_USE_COMPILER")));
+ this->Makefile
+ ->GetDefinition(cmStrCat("CMAKE_", lang, "_DEPENDS_USE_COMPILER"))
+ .IsOn();
auto const scanner = compilerGenerateDeps ? cmDependencyScannerKind::Compiler
: cmDependencyScannerKind::CMake;
@@ -671,15 +672,12 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string const configUpper = cmSystemTools::UpperCase(config);
// Add precompile headers dependencies
- std::vector<std::string> architectures =
- this->GeneratorTarget->GetAppleArchs(config, lang);
- if (architectures.empty()) {
- architectures.emplace_back();
- }
+ std::vector<std::string> pchArchs =
+ this->GeneratorTarget->GetPchArchs(config, lang);
std::string filterArch;
std::unordered_map<std::string, std::string> pchSources;
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchSource =
this->GeneratorTarget->GetPchSource(config, lang, arch);
if (pchSource == source.GetFullPath()) {
@@ -691,7 +689,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
}
if (!pchSources.empty() && !source.GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
std::string const& pchHeader =
this->GeneratorTarget->GetPchHeader(config, lang, arch);
depends.push_back(pchHeader);
@@ -2082,7 +2080,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForObjects(
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_OBJECTS";
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
- return cmIsOn(val);
+ return val.IsOn();
}
}
@@ -2121,7 +2119,7 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
"CMAKE_" + l + "_USE_RESPONSE_FILE_FOR_LIBRARIES";
if (cmValue val = this->Makefile->GetDefinition(responseVar)) {
if (!val->empty()) {
- return cmIsOn(val);
+ return val.IsOn();
}
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index e2642b2..c61f445 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -189,14 +189,11 @@ std::string cmNinjaTargetGenerator::ComputeFlagsForObject(
const std::string& config, const std::string& objectFileName)
{
std::unordered_map<std::string, std::string> pchSources;
- std::vector<std::string> architectures =
- this->GeneratorTarget->GetAppleArchs(config, language);
- if (architectures.empty()) {
- architectures.emplace_back();
- }
+ std::vector<std::string> pchArchs =
+ this->GeneratorTarget->GetPchArchs(config, language);
std::string filterArch;
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchSource =
this->GeneratorTarget->GetPchSource(config, language, arch);
if (pchSource == source->GetFullPath()) {
@@ -1500,14 +1497,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// Add precompile headers dependencies
std::vector<std::string> depList;
- std::vector<std::string> architectures =
- this->GeneratorTarget->GetAppleArchs(config, language);
- if (architectures.empty()) {
- architectures.emplace_back();
- }
+ std::vector<std::string> pchArchs =
+ this->GeneratorTarget->GetPchArchs(config, language);
std::unordered_set<std::string> pchSources;
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
const std::string pchSource =
this->GeneratorTarget->GetPchSource(config, language, arch);
@@ -1517,7 +1511,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
}
if (!pchSources.empty() && !source->GetProperty("SKIP_PRECOMPILE_HEADERS")) {
- for (const std::string& arch : architectures) {
+ for (const std::string& arch : pchArchs) {
depList.push_back(
this->GeneratorTarget->GetPchHeader(config, language, arch));
if (pchSources.find(source->GetFullPath()) == pchSources.end()) {
@@ -1841,12 +1835,6 @@ void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
std::vector<std::string> depList;
- std::vector<std::string> architectures =
- this->GeneratorTarget->GetAppleArchs(config, language);
- if (architectures.empty()) {
- architectures.emplace_back();
- }
-
bmiBuild.OrderOnlyDeps.push_back(this->OrderDependsTargetForTarget(config));
// For some cases we scan to dynamically discover dependencies.
@@ -1992,6 +1980,11 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
std::string const moduleFilepath =
this->ConvertToNinjaPath(cmStrCat(moduleDirectory, '/', moduleFilename));
+ vars.emplace("description",
+ cmStrCat("Building Swift Module '", moduleName, "' with ",
+ sources.size(),
+ sources.size() == 1 ? " source" : " sources"));
+
bool const isSingleOutput = [this, compileMode]() -> bool {
bool isMultiThread = false;
if (cmValue numThreadStr =
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 705314f..eb9f031 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -294,8 +294,8 @@ class cmMakefile;
"FindFLEX runs flex in CMAKE_CURRENT_BINARY_DIR when executing.", 3, \
17, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0099, \
- "Link properties are transitive over private dependency on static " \
- "libraries.", \
+ "Link properties are transitive over private dependencies of " \
+ "static libraries.", \
3, 17, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0100, "Let AUTOMOC and AUTOUIC process .hh files.", 3, \
17, 0, cmPolicies::WARN) \
@@ -349,10 +349,10 @@ class cmMakefile;
SELECT(POLICY, CMP0117, \
"MSVC RTTI flag /GR is not added to CMAKE_CXX_FLAGS by default.", 3, \
20, 0, cmPolicies::WARN) \
- SELECT( \
- POLICY, CMP0118, \
- "The GENERATED source file property is now visible in all directories.", \
- 3, 20, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0118, \
+ "GENERATED sources may be used across directories without manual " \
+ "marking.", \
+ 3, 20, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0119, \
"LANGUAGE source file property explicitly compiles as specified " \
"language.", \
@@ -406,8 +406,8 @@ class cmMakefile;
"is not usable.", \
3, 24, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0135, \
- "ExternalProject ignores timestamps in archives by default for the " \
- "URL download method", \
+ "ExternalProject and FetchContent ignore timestamps in archives by " \
+ "default for the URL download method", \
3, 24, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0136, \
"Watcom runtime library flags are selected by an abstraction.", 3, \
@@ -493,7 +493,26 @@ class cmMakefile;
"More read-only target properties now error when trying to set them.", 3, \
29, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0161, "CPACK_PRODUCTBUILD_DOMAINS defaults to true.", 3, \
- 29, 0, cmPolicies::WARN)
+ 29, 0, cmPolicies::WARN) \
+ SELECT( \
+ POLICY, CMP0162, \
+ "Visual Studio generators add UseDebugLibraries indicators by default.", \
+ 3, 30, 0, cmPolicies::WARN) \
+ SELECT( \
+ POLICY, CMP0163, \
+ "The GENERATED source file property is now visible in all directories.", \
+ 3, 30, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0164, \
+ "add_library() rejects SHARED libraries when not supported by the " \
+ "platform.", \
+ 3, 30, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0165, \
+ "enable_language() must not be called before project().", 3, 30, 0, \
+ cmPolicies::WARN) \
+ SELECT(POLICY, CMP0166, \
+ "TARGET_PROPERTY evaluates link properties transitively over " \
+ "private dependencies of static libraries.", \
+ 3, 30, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
@@ -536,7 +555,8 @@ class cmMakefile;
F(CMP0155) \
F(CMP0156) \
F(CMP0157) \
- F(CMP0160)
+ F(CMP0160) \
+ F(CMP0162)
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
F(CMP0116) \
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 3d2373d..34a47cc 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -601,7 +601,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
if (this->Moc.Enabled) {
// Path prefix
- if (cmIsOn(this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX"))) {
+ if (this->GenTarget->GetProperty("AUTOMOC_PATH_PREFIX").IsOn()) {
this->Moc.PathPrefix = true;
}
@@ -657,7 +657,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
auto const& value =
this->GenTarget->GetProperty("AUTOGEN_USE_SYSTEM_INCLUDE");
if (value.IsSet()) {
- if (cmIsOn(value)) {
+ if (value.IsOn()) {
this->GenTarget->AddSystemIncludeDirectory(this->Dir.IncludeGenExp,
"CXX");
} else {
@@ -1918,8 +1918,9 @@ bool cmQtAutoGenInitializer::SetupWriteAutogenInfo()
info.SetBool("MOC_RELAXED_MODE", this->Moc.RelaxedMode);
info.SetBool("MOC_PATH_PREFIX", this->Moc.PathPrefix);
- cmGeneratorExpressionDAGChecker dagChecker(
- this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr);
+ cmGeneratorExpressionDAGChecker dagChecker(this->GenTarget,
+ "AUTOMOC_MACRO_NAMES", nullptr,
+ nullptr, this->LocalGen);
EvaluatedTargetPropertyEntries InterfaceAutoMocMacroNamesEntries;
if (this->MultiConfig) {
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 60610a4..a229ea2 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -6,6 +6,8 @@
#include <sstream>
#include <unordered_set>
+#include <cm/string_view>
+
#include "cmExecutionStatus.h"
#include "cmGlobalGenerator.h"
#include "cmInstalledFile.h"
@@ -281,12 +283,60 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
cmSourceFile* sf, std::string const& propertyValue, PropertyOp op)
{
const auto& mf = *sf->GetLocation().GetMakefile();
- auto policyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
- const bool policyWARN = policyStatus == cmPolicies::WARN;
- const bool policyNEW = policyStatus != cmPolicies::OLD && !policyWARN;
+ auto isProblematic = [&mf, &propertyValue,
+ op](cm::string_view policy) -> bool {
+ if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
+ mf.IssueMessage(
+ MessageType::AUTHOR_ERROR,
+ cmStrCat("Policy ", policy,
+ " is set to NEW and the following non-boolean value given "
+ "for property 'GENERATED' is therefore not allowed:\n",
+ propertyValue, "\nReplace it with a boolean value!\n"));
+ return true;
+ }
+ if (cmIsOff(propertyValue)) {
+ mf.IssueMessage(
+ MessageType::AUTHOR_ERROR,
+ cmStrCat("Unsetting the 'GENERATED' property is not allowed under ",
+ policy, "!\n"));
+ return true;
+ }
+ if (op == PropertyOp::Append || op == PropertyOp::AppendAsString) {
+ mf.IssueMessage(
+ MessageType::AUTHOR_ERROR,
+ cmStrCat(
+ "Policy ", policy,
+ " is set to NEW and appending to the 'GENERATED' property is "
+ "therefore not allowed. Only setting it to \"1\" is allowed!\n"));
+ return true;
+ }
+ return false;
+ };
+
+ const auto cmp0163PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0163);
+ const bool cmp0163PolicyNEW = cmp0163PolicyStatus != cmPolicies::OLD &&
+ cmp0163PolicyStatus != cmPolicies::WARN;
+ if (cmp0163PolicyNEW) {
+ if (!isProblematic("CMP0163")) {
+ sf->MarkAsGenerated();
+ }
+ return true;
+ }
+
+ const auto cmp0118PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
+ const bool cmp0118PolicyWARN = cmp0118PolicyStatus == cmPolicies::WARN;
+ const bool cmp0118PolicyNEW =
+ cmp0118PolicyStatus != cmPolicies::OLD && !cmp0118PolicyWARN;
+
+ if (cmp0118PolicyNEW) {
+ if (!isProblematic("CMP0118")) {
+ sf->MarkAsGenerated();
+ }
+ return true;
+ }
- if (policyWARN) {
+ if (cmp0118PolicyWARN) {
if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
mf.IssueMessage(
MessageType::AUTHOR_WARNING,
@@ -312,50 +362,22 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
"\nAppending to property 'GENERATED' will not be allowed "
"under policy CMP0118!\n"));
}
- } else if (policyNEW) {
- if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
- mf.IssueMessage(
- MessageType::AUTHOR_ERROR,
- cmStrCat(
- "Policy CMP0118 is set to NEW and the following non-boolean value "
- "given for property 'GENERATED' is therefore not allowed:\n",
- propertyValue, "\nReplace it with a boolean value!\n"));
- return true;
- }
- if (cmIsOff(propertyValue)) {
- mf.IssueMessage(
- MessageType::AUTHOR_ERROR,
- "Unsetting the 'GENERATED' property is not allowed under CMP0118!\n");
- return true;
- }
- if (op == PropertyOp::Append || op == PropertyOp::AppendAsString) {
- mf.IssueMessage(MessageType::AUTHOR_ERROR,
- "Policy CMP0118 is set to NEW and appending to the "
- "'GENERATED' property is therefore not allowed. Only "
- "setting it to \"1\" is allowed!\n");
- return true;
- }
}
- // Set property.
- if (!policyNEW) {
- // Do it the traditional way.
- switch (op) {
- case PropertyOp::Append:
- sf->AppendProperty("GENERATED", propertyValue, false);
- break;
- case PropertyOp::AppendAsString:
- sf->AppendProperty("GENERATED", propertyValue, true);
- break;
- case PropertyOp::Remove:
- sf->RemoveProperty("GENERATED");
- break;
- case PropertyOp::Set:
- sf->SetProperty("GENERATED", propertyValue);
- break;
- }
- } else {
- sf->MarkAsGenerated();
+ // Set property the traditional way.
+ switch (op) {
+ case PropertyOp::Append:
+ sf->AppendProperty("GENERATED", propertyValue, false);
+ break;
+ case PropertyOp::AppendAsString:
+ sf->AppendProperty("GENERATED", propertyValue, true);
+ break;
+ case PropertyOp::Remove:
+ sf->RemoveProperty("GENERATED");
+ break;
+ case PropertyOp::Set:
+ sf->SetProperty("GENERATED", propertyValue);
+ break;
}
return true;
}
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 1be680a..30ee369 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -123,7 +123,8 @@ bool cmSourceFile::FindFullPath(std::string* error,
{
// If the file is generated compute the location without checking on disk.
// Note: We also check for a locally set GENERATED property, because
- // it might have been set before policy CMP0118 was set to NEW.
+ // it might have been set before policy CMP0118 (or CMP0163) was set
+ // to NEW.
if (this->GetIsGenerated(CheckScope::GlobalAndLocal)) {
// The file is either already a full path or is relative to the
// build directory for the target.
@@ -146,9 +147,12 @@ bool cmSourceFile::FindFullPath(std::string* error,
std::vector<std::string> exts =
makefile->GetCMakeInstance()->GetAllExtensions();
auto cmp0115 = makefile->GetPolicyStatus(cmPolicies::CMP0115);
+ auto cmp0163 = makefile->GetPolicyStatus(cmPolicies::CMP0163);
auto cmp0118 = makefile->GetPolicyStatus(cmPolicies::CMP0118);
+ bool const cmp0163new =
+ cmp0163 != cmPolicies::OLD && cmp0163 != cmPolicies::WARN;
bool const cmp0118new =
- cmp0118 != cmPolicies::OLD && cmp0118 != cmPolicies::WARN;
+ cmp0163new || (cmp0118 != cmPolicies::OLD && cmp0118 != cmPolicies::WARN);
// Tries to find the file in a given directory
auto findInDir = [this, &exts, &lPath, cmp0115, cmp0115Warning, cmp0118new,
@@ -156,6 +160,7 @@ bool cmSourceFile::FindFullPath(std::string* error,
// Compute full path
std::string const fullPath = cmSystemTools::CollapseFullPath(lPath, dir);
// Try full path
+ // Is this file globally marked as generated? Then mark so locally.
if (cmp0118new &&
makefile->GetGlobalGenerator()->IsGeneratedFile(fullPath)) {
this->IsGenerated = true;
@@ -172,6 +177,7 @@ bool cmSourceFile::FindFullPath(std::string* error,
for (std::string const& ext : exts) {
if (!ext.empty()) {
std::string extPath = cmStrCat(fullPath, '.', ext);
+ // Is this file globally marked as generated? Then mark so locally.
if (cmp0118new &&
makefile->GetGlobalGenerator()->IsGeneratedFile(extPath)) {
this->IsGenerated = true;
@@ -357,14 +363,19 @@ cmValue cmSourceFile::GetPropertyForUser(const std::string& prop)
// Special handling for GENERATED property.
if (prop == propGENERATED) {
- // We need to check policy CMP0118 in order to determine if we need to
- // possibly consider the value of a locally set GENERATED property, too.
- auto policyStatus =
+ // We need to check policy CMP0163 and CMP0118 in order to determine if we
+ // need to possibly consider the value of a locally set GENERATED property,
+ // too.
+ auto cmp0163 =
+ this->Location.GetMakefile()->GetPolicyStatus(cmPolicies::CMP0163);
+ auto cmp0118 =
this->Location.GetMakefile()->GetPolicyStatus(cmPolicies::CMP0118);
- if (this->GetIsGenerated(
- (policyStatus == cmPolicies::WARN || policyStatus == cmPolicies::OLD)
- ? CheckScope::GlobalAndLocal
- : CheckScope::Global)) {
+ bool const cmp0163new =
+ cmp0163 != cmPolicies::OLD && cmp0163 != cmPolicies::WARN;
+ bool const cmp0118new = cmp0163new ||
+ (cmp0118 != cmPolicies::OLD && cmp0118 != cmPolicies::WARN);
+ if (this->GetIsGenerated((!cmp0118new) ? CheckScope::GlobalAndLocal
+ : CheckScope::Global)) {
return cmValue(propTRUE);
}
return cmValue(propFALSE);
@@ -442,7 +453,7 @@ const std::string& cmSourceFile::GetSafeProperty(const std::string& prop) const
bool cmSourceFile::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
void cmSourceFile::MarkAsGenerated()
diff --git a/Source/cmStandardLevelResolver.cxx b/Source/cmStandardLevelResolver.cxx
index e814690..44c4ae1 100644
--- a/Source/cmStandardLevelResolver.cxx
+++ b/Source/cmStandardLevelResolver.cxx
@@ -88,8 +88,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) };
- bool const defaultExt{ cmIsOn(*makefile->GetDefinition(
- cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) };
+ bool const defaultExt{ makefile
+ ->GetDefinition(cmStrCat("CMAKE_", this->Language,
+ "_EXTENSIONS_DEFAULT"))
+ .IsOn() };
bool ext = true;
if (cmp0128 == cmPolicies::NEW) {
@@ -97,7 +99,7 @@ struct StandardLevelComputer
}
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
- ext = cmIsOn(*extPropValue);
+ ext = extPropValue.IsOn();
}
std::string const type{ ext ? "EXTENSION" : "STANDARD" };
@@ -252,8 +254,10 @@ struct StandardLevelComputer
cmPolicies::PolicyStatus const cmp0128{ makefile->GetPolicyStatus(
cmPolicies::CMP0128) };
- bool const defaultExt{ cmIsOn(*makefile->GetDefinition(
- cmStrCat("CMAKE_", this->Language, "_EXTENSIONS_DEFAULT"))) };
+ bool const defaultExt{ makefile
+ ->GetDefinition(cmStrCat("CMAKE_", this->Language,
+ "_EXTENSIONS_DEFAULT"))
+ .IsOn() };
bool ext = true;
if (cmp0128 == cmPolicies::NEW) {
@@ -261,7 +265,7 @@ struct StandardLevelComputer
}
if (cmValue extPropValue = target->GetLanguageExtensions(this->Language)) {
- ext = cmIsOn(*extPropValue);
+ ext = extPropValue.IsOn();
}
std::string const type{ ext ? "EXTENSION" : "STANDARD" };
@@ -537,6 +541,21 @@ std::string cmStandardLevelResolver::GetEffectiveStandard(
return mapping->second.GetEffectiveStandard(this->Makefile, target, config);
}
+std::string cmStandardLevelResolver::GetLevelString(
+ std::string const& lang, cmStandardLevel const& level) const
+{
+ auto mapping = StandardComputerMapping.find(lang);
+ if (mapping == StandardComputerMapping.end()) {
+ return {};
+ }
+
+ if (mapping->second.LevelsAsStrings.size() <= level.Index()) {
+ return {};
+ }
+
+ return mapping->second.LevelsAsStrings[level.Index()];
+}
+
bool cmStandardLevelResolver::AddRequiredTargetFeature(
cmTarget* target, const std::string& feature, std::string* error) const
{
diff --git a/Source/cmStandardLevelResolver.h b/Source/cmStandardLevelResolver.h
index 29cab55..523aa73 100644
--- a/Source/cmStandardLevelResolver.h
+++ b/Source/cmStandardLevelResolver.h
@@ -29,6 +29,9 @@ public:
std::string const& lang,
std::string const& config) const;
+ std::string GetLevelString(std::string const& lang,
+ cmStandardLevel const& level) const;
+
bool AddRequiredTargetFeature(cmTarget* target, const std::string& feature,
std::string* error = nullptr) const;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index d104268..72eeb9d 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -16,6 +16,7 @@
#include "cmCommand.h"
#include "cmDefinitions.h"
#include "cmExecutionStatus.h"
+#include "cmGlobCacheEntry.h"
#include "cmGlobVerificationManager.h"
#include "cmList.h"
#include "cmListFileCache.h"
@@ -238,15 +239,18 @@ bool cmState::SaveVerificationScript(const std::string& path,
messenger);
}
-void cmState::AddGlobCacheEntry(
- bool recurse, bool listDirectories, bool followSymlinks,
- const std::string& relative, const std::string& expression,
- const std::vector<std::string>& files, const std::string& variable,
- cmListFileBacktrace const& backtrace, cmMessenger* messenger)
+void cmState::AddGlobCacheEntry(const cmGlobCacheEntry& entry,
+ const std::string& variable,
+ cmListFileBacktrace const& backtrace,
+ cmMessenger* messenger)
{
- this->GlobVerificationManager->AddCacheEntry(
- recurse, listDirectories, followSymlinks, relative, expression, files,
- variable, backtrace, messenger);
+ this->GlobVerificationManager->AddCacheEntry(entry, variable, backtrace,
+ messenger);
+}
+
+std::vector<cmGlobCacheEntry> cmState::GetGlobCacheEntries() const
+{
+ return this->GlobVerificationManager->GetCacheEntries();
}
void cmState::RemoveCacheEntry(std::string const& key)
@@ -662,7 +666,7 @@ cmValue cmState::GetGlobalProperty(const std::string& prop)
bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
{
- return cmIsOn(this->GetGlobalProperty(prop));
+ return this->GetGlobalProperty(prop).IsOn();
}
void cmState::SetSourceDirectory(std::string const& sourceDirectory)
diff --git a/Source/cmState.h b/Source/cmState.h
index ae0d52b..5aceb6a 100644
--- a/Source/cmState.h
+++ b/Source/cmState.h
@@ -34,6 +34,7 @@ class cmStateSnapshot;
class cmMessenger;
class cmExecutionStatus;
class cmListFileBacktrace;
+struct cmGlobCacheEntry;
struct cmListFileArgument;
template <typename T>
@@ -263,13 +264,11 @@ private:
std::string const& GetGlobVerifyScript() const;
std::string const& GetGlobVerifyStamp() const;
bool SaveVerificationScript(const std::string& path, cmMessenger* messenger);
- void AddGlobCacheEntry(bool recurse, bool listDirectories,
- bool followSymlinks, const std::string& relative,
- const std::string& expression,
- const std::vector<std::string>& files,
+ void AddGlobCacheEntry(const cmGlobCacheEntry& entry,
const std::string& variable,
cmListFileBacktrace const& bt,
cmMessenger* messenger);
+ std::vector<cmGlobCacheEntry> GetGlobCacheEntries() const;
cmPropertyDefinitionMap PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index 39353f3..343bee5 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -451,7 +451,7 @@ cmValue cmStateDirectory::GetProperty(const std::string& prop,
bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
std::vector<std::string> cmStateDirectory::GetPropertyKeys() const
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 76cca21..1284130 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -404,6 +404,7 @@ TargetProperty const StaticTargetProperties[] = {
{ "VS_DEBUGGER_COMMAND_ARGUMENTS"_s, IC::ExecutableTarget },
{ "VS_DEBUGGER_ENVIRONMENT"_s, IC::ExecutableTarget },
{ "VS_DEBUGGER_WORKING_DIRECTORY"_s, IC::ExecutableTarget },
+ { "VS_USE_DEBUG_LIBRARIES"_s, IC::NonImportedTarget },
// ---- OpenWatcom
{ "WATCOM_RUNTIME_LIBRARY"_s, IC::CanCompileSources },
// -- Language
@@ -411,6 +412,7 @@ TargetProperty const StaticTargetProperties[] = {
COMMON_LANGUAGE_PROPERTIES(C),
// ---- C++
COMMON_LANGUAGE_PROPERTIES(CXX),
+ { "CXX_MODULE_STD"_s, IC::CanCompileSources },
// ---- CSharp
{ "DOTNET_SDK"_s, IC::NonImportedTarget },
{ "DOTNET_TARGET_FRAMEWORK"_s, IC::TargetWithCommands },
@@ -1841,6 +1843,7 @@ void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
"CXX_STANDARD_REQUIRED",
"CXX_EXTENSIONS",
"CXX_VISIBILITY_PRESET",
+ "CXX_MODULE_STD",
// Static analysis
"CXX_CLANG_TIDY",
@@ -2150,7 +2153,7 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
}
if (prop == propIMPORTED_GLOBAL) {
- if (!cmIsOn(value)) {
+ if (!value.IsOn()) {
std::ostringstream e;
e << "IMPORTED_GLOBAL property can't be set to FALSE on targets (\""
<< this->impl->Name << "\")\n";
@@ -2844,7 +2847,7 @@ std::string const& cmTarget::GetSafeProperty(std::string const& prop) const
bool cmTarget::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
cmPropertyMap const& cmTarget::GetProperties() const
diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx
index 7c9969c..8a39144 100644
--- a/Source/cmTest.cxx
+++ b/Source/cmTest.cxx
@@ -50,7 +50,7 @@ cmValue cmTest::GetProperty(const std::string& prop) const
bool cmTest::GetPropertyAsBool(const std::string& prop) const
{
- return cmIsOn(this->GetProperty(prop));
+ return this->GetProperty(prop).IsOn();
}
void cmTest::SetProperty(const std::string& prop, cmValue value)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index fbd676d..0fb8bae 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1177,7 +1177,7 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference(
const char* privateReference = "True";
if (cmValue value = this->GeneratorTarget->GetProperty(
"VS_DOTNET_REFERENCES_COPY_LOCAL")) {
- if (cmIsOff(*value)) {
+ if (value.IsOff()) {
privateReference = "False";
}
}
@@ -1522,7 +1522,6 @@ void cmVisualStudio10TargetGenerator::WriteCEDebugProjectConfigurationValues(
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
Elem& e1, std::string const& config)
{
- cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmValue mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if (mfcFlag) {
std::string const mfcFlagValue =
@@ -1553,12 +1552,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
} else {
e1.Element("CharacterSet", "MultiByte");
}
- if (cmValue projectToolsetOverride =
- this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
- e1.Element("PlatformToolset", *projectToolsetOverride);
- } else if (const char* toolset = gg->GetPlatformToolset()) {
- e1.Element("PlatformToolset", toolset);
- }
+
+ this->WriteMSToolConfigurationValuesCommon(e1, config);
+
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
e1.Element("WindowsAppContainer", "true");
@@ -1589,11 +1585,9 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
return;
}
- cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
-
Options& o = *(this->ClOptions[config]);
- if (o.IsDebug()) {
+ if (o.UsingDebugInfo()) {
e1.Element("DebugSymbols", "true");
e1.Element("DefineDebug", "true");
}
@@ -1608,12 +1602,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
o.RemoveFlag("Platform");
}
- if (cmValue projectToolsetOverride =
- this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
- e1.Element("PlatformToolset", *projectToolsetOverride);
- } else if (const char* toolset = gg->GetPlatformToolset()) {
- e1.Element("PlatformToolset", toolset);
- }
+ this->WriteMSToolConfigurationValuesCommon(e1, config);
std::string postfixName =
cmStrCat(cmSystemTools::UpperCase(config), "_POSTFIX");
@@ -1633,6 +1622,50 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
oh.OutputFlagMap();
}
+void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesCommon(
+ Elem& e1, std::string const& config)
+{
+ cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
+ if (cmValue projectToolsetOverride =
+ this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
+ e1.Element("PlatformToolset", *projectToolsetOverride);
+ } else if (const char* toolset = gg->GetPlatformToolset()) {
+ e1.Element("PlatformToolset", toolset);
+ }
+
+ cm::optional<bool> maybeUseDebugLibraries;
+ if (cmValue useDebugLibrariesProp =
+ this->GeneratorTarget->GetProperty("VS_USE_DEBUG_LIBRARIES")) {
+ // The project explicitly specified a value for this target.
+ // An empty string suppresses generation of the setting altogether.
+ std::string const useDebugLibraries = cmGeneratorExpression::Evaluate(
+ *useDebugLibrariesProp, this->LocalGenerator, config);
+ if (!useDebugLibraries.empty()) {
+ maybeUseDebugLibraries = cmIsOn(useDebugLibraries);
+ }
+ } else if (this->GeneratorTarget->GetPolicyStatusCMP0162() ==
+ cmPolicies::NEW) {
+ // The project did not explicitly specify a value for this target.
+ // If the target compiles sources for a known MSVC runtime library,
+ // base our default value on that.
+ if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
+ maybeUseDebugLibraries = this->ClOptions[config]->UsingDebugRuntime();
+ }
+ // For other targets, such as UTILITY targets, base our default
+ // on the configuration name.
+ if (!maybeUseDebugLibraries) {
+ maybeUseDebugLibraries = cmSystemTools::UpperCase(config) == "DEBUG"_s;
+ }
+ }
+ if (maybeUseDebugLibraries) {
+ if (*maybeUseDebugLibraries) {
+ e1.Element("UseDebugLibraries", "true");
+ } else {
+ e1.Element("UseDebugLibraries", "false");
+ }
+ }
+}
+
//----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
Elem& e1, std::string const&)
@@ -2051,6 +2084,18 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
"gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms");
}
}
+ {
+ if (cmValue p = this->GeneratorTarget->GetProperty("VS_FILTER_PROPS")) {
+ auto props = *p;
+ if (!props.empty()) {
+ ConvertToWindowsSlash(props);
+ Elem(e0, "Import")
+ .Attribute("Project", props)
+ .Attribute("Condition", cmStrCat("exists('", props, "')"))
+ .Attribute("Label", "LocalAppDataPlatform");
+ }
+ }
+ }
}
fout << '\n';
@@ -3168,7 +3213,10 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
Options& linkOptions = *(this->LinkOptions[configName]);
const std::string cond = this->CalcCondition(configName);
- if (this->IPOEnabledConfigurations.count(configName) == 0) {
+ if (this->IPOEnabledConfigurations.count(configName) > 0) {
+ // Suppress LinkIncremental in favor of WholeProgramOptimization.
+ e1.WritePlatformConfigTag("LinkIncremental", cond, "");
+ } else {
const char* incremental = linkOptions.GetFlag("LinkIncremental");
e1.WritePlatformConfigTag("LinkIncremental", cond,
(incremental ? incremental : "true"));
@@ -3513,6 +3561,26 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.RemoveFlag("CompileAs");
}
+ if (this->ProjectType == VsProjectType::vcxproj && this->MSTools) {
+ // Suppress Microsoft.Cl.Common.props default settings for which the
+ // project specifies no flags. Do not let UseDebugLibraries affect them.
+ if (!clOptions.HasFlag("BasicRuntimeChecks")) {
+ clOptions.AddFlag("BasicRuntimeChecks", "Default");
+ }
+ if (!clOptions.HasFlag("MinimalRebuild")) {
+ clOptions.AddFlag("MinimalRebuild", "");
+ }
+ if (!clOptions.HasFlag("Optimization")) {
+ clOptions.AddFlag("Optimization", "");
+ }
+ if (!clOptions.HasFlag("RuntimeLibrary")) {
+ clOptions.AddFlag("RuntimeLibrary", "");
+ }
+ if (!clOptions.HasFlag("SupportJustMyCode")) {
+ clOptions.AddFlag("SupportJustMyCode", "");
+ }
+ }
+
this->ClOptions[configName] = std::move(pOptions);
return true;
}
@@ -3555,7 +3623,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
// without value so PDBs don't get generated uselessly. Each tag
// goes on its own line because Visual Studio corrects it this
// way when saving the project after CMake generates it.
- if (!clOptions.IsDebug()) {
+ if (!clOptions.UsingDebugInfo()) {
Elem e3(e2, "DebugInformationFormat");
e3.SetHasElements();
}
@@ -4176,9 +4244,9 @@ void cmVisualStudio10TargetGenerator::WriteManifestOptions(
if (dpiAware) {
if (*dpiAware == "PerMonitor"_s) {
e2.Element("EnableDpiAwareness", "PerMonitorHighDPIAware");
- } else if (cmIsOn(*dpiAware)) {
+ } else if (dpiAware.IsOn()) {
e2.Element("EnableDpiAwareness", "true");
- } else if (cmIsOff(*dpiAware)) {
+ } else if (dpiAware.IsOff()) {
e2.Element("EnableDpiAwareness", "false");
} else {
cmSystemTools::Error(
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 1f8b2eb..056f426 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -72,6 +72,8 @@ private:
void WriteCEDebugProjectConfigurationValues(Elem& e0);
void WriteMSToolConfigurationValuesManaged(Elem& e1,
std::string const& config);
+ void WriteMSToolConfigurationValuesCommon(Elem& e1,
+ std::string const& config);
void WriteHeaderSource(Elem& e1, cmSourceFile const* sf,
ConfigToSettings const& toolSettings);
void WriteExtraSource(Elem& e1, cmSourceFile const* sf,
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 9dd2e6c..659510c 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -110,7 +110,7 @@ void cmVisualStudioGeneratorOptions::SetVerboseMakefile(bool verbose)
}
}
-bool cmVisualStudioGeneratorOptions::IsDebug() const
+bool cmVisualStudioGeneratorOptions::UsingDebugInfo() const
{
if (this->CurrentTool != CSharpCompiler) {
return this->FlagMap.find("DebugInformationFormat") != this->FlagMap.end();
@@ -124,6 +124,15 @@ bool cmVisualStudioGeneratorOptions::IsDebug() const
return false;
}
+cm::optional<bool> cmVisualStudioGeneratorOptions::UsingDebugRuntime() const
+{
+ cm::optional<bool> result;
+ if (const char* rtl = this->GetFlag("RuntimeLibrary")) {
+ result = strstr(rtl, "Debug") != nullptr;
+ }
+ return result;
+}
+
bool cmVisualStudioGeneratorOptions::IsWinRt() const
{
return this->FlagMap.find("CompileAsWinRT") != this->FlagMap.end();
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index 20e2d22..1ca569d 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -7,6 +7,8 @@
#include <iosfwd>
#include <string>
+#include <cm/optional>
+
#include "cmGlobalVisualStudioGenerator.h"
#include "cmIDEFlagTable.h"
#include "cmIDEOptions.h"
@@ -65,7 +67,8 @@ public:
void FixManifestUACFlags();
- bool IsDebug() const;
+ bool UsingDebugInfo() const;
+ cm::optional<bool> UsingDebugRuntime() const;
bool IsWinRt() const;
bool IsManaged() const;
// Write options to output.
diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx
index 80327e4..12272d1 100644
--- a/Source/cmXCodeScheme.cxx
+++ b/Source/cmXCodeScheme.cxx
@@ -77,7 +77,7 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout,
WriteBuildAction(xout, container);
WriteTestAction(xout, FindConfiguration("Debug"), container);
WriteLaunchAction(xout, FindConfiguration(launchConfiguration), container);
- WriteProfileAction(xout, FindConfiguration("Release"));
+ WriteProfileAction(xout, FindConfiguration("Release"), container);
WriteAnalyzeAction(xout, FindConfiguration("Debug"));
WriteArchiveAction(xout, FindConfiguration("Release"));
@@ -240,18 +240,13 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout,
// Diagnostics tab end
if (IsExecutable(this->Target)) {
- xout.StartElement("BuildableProductRunnable");
- xout.BreakAttributes();
- xout.Attribute("runnableDebuggingMode", "0");
-
+ WriteBuildableProductRunnable(xout, this->Target, container);
} else {
xout.StartElement("MacroExpansion");
+ WriteBuildableReference(xout, this->Target, container);
+ xout.EndElement();
}
- WriteBuildableReference(xout, this->Target, container);
-
- xout.EndElement(); // MacroExpansion
-
// Info tab begin
if (cmValue exe =
@@ -374,7 +369,7 @@ bool cmXCodeScheme::WriteLaunchActionBooleanAttribute(
bool defaultValue)
{
cmValue property = Target->GetTarget()->GetProperty(varName);
- bool isOn = (!property && defaultValue) || cmIsOn(property);
+ bool isOn = (!property && defaultValue) || property.IsOn();
if (isOn) {
xout.Attribute(attrName.c_str(), "YES");
@@ -404,7 +399,8 @@ bool cmXCodeScheme::WriteLaunchActionAdditionalOption(
}
void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
- const std::string& configuration)
+ const std::string& configuration,
+ const std::string& container)
{
xout.StartElement("ProfileAction");
xout.BreakAttributes();
@@ -415,6 +411,11 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout,
WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning",
"XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING",
true);
+
+ if (IsExecutable(this->Target)) {
+ WriteBuildableProductRunnable(xout, this->Target, container);
+ }
+
xout.EndElement();
}
@@ -437,6 +438,17 @@ void cmXCodeScheme::WriteArchiveAction(cmXMLWriter& xout,
xout.EndElement();
}
+void cmXCodeScheme::WriteBuildableProductRunnable(cmXMLWriter& xout,
+ const cmXCodeObject* xcObj,
+ const std::string& container)
+{
+ xout.StartElement("BuildableProductRunnable");
+ xout.BreakAttributes();
+ xout.Attribute("runnableDebuggingMode", "0");
+ WriteBuildableReference(xout, xcObj, container);
+ xout.EndElement();
+}
+
void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
const cmXCodeObject* xcObj,
const std::string& container)
diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h
index 07fdedb..c933a6e 100644
--- a/Source/cmXCodeScheme.h
+++ b/Source/cmXCodeScheme.h
@@ -57,10 +57,14 @@ private:
const std::string& value,
const std::string& varName);
- void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration);
+ void WriteProfileAction(cmXMLWriter& xout, const std::string& configuration,
+ const std::string& container);
void WriteAnalyzeAction(cmXMLWriter& xout, const std::string& configuration);
void WriteArchiveAction(cmXMLWriter& xout, const std::string& configuration);
+ void WriteBuildableProductRunnable(cmXMLWriter& xout,
+ const cmXCodeObject* xcObj,
+ const std::string& container);
void WriteBuildableReference(cmXMLWriter& xout, const cmXCodeObject* xcObj,
const std::string& container);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 88fac8d..319e597 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -48,6 +48,7 @@
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileTimeCache.h"
#include "cmGeneratorTarget.h"
+#include "cmGlobCacheEntry.h"
#include "cmGlobalGenerator.h"
#include "cmGlobalGeneratorFactory.h"
#include "cmLinkLineComputer.h"
@@ -2346,16 +2347,16 @@ int cmake::Configure()
// so we cannot rely on command line options alone. Always ensure our
// messenger is in sync with the cache.
cmValue value = this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
- this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(*value));
+ this->Messenger->SetSuppressDeprecatedWarnings(value && value.IsOff());
value = this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED");
- this->Messenger->SetDeprecatedWarningsAsErrors(cmIsOn(value));
+ this->Messenger->SetDeprecatedWarningsAsErrors(value.IsOn());
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
- this->Messenger->SetSuppressDevWarnings(cmIsOn(value));
+ this->Messenger->SetSuppressDevWarnings(value.IsOn());
value = this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS");
- this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(*value));
+ this->Messenger->SetDevWarningsAsErrors(value && value.IsOff());
int ret = this->ActualConfigure();
cmValue delCacheVars =
@@ -2924,13 +2925,13 @@ void cmake::AddCacheEntry(const std::string& key, cmValue value,
this->UnwatchUnusedCli(key);
if (key == "CMAKE_WARN_DEPRECATED"_s) {
- this->Messenger->SetSuppressDeprecatedWarnings(value && cmIsOff(value));
+ this->Messenger->SetSuppressDeprecatedWarnings(value && value.IsOff());
} else if (key == "CMAKE_ERROR_DEPRECATED"_s) {
- this->Messenger->SetDeprecatedWarningsAsErrors(cmIsOn(value));
+ this->Messenger->SetDeprecatedWarningsAsErrors(value.IsOn());
} else if (key == "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"_s) {
- this->Messenger->SetSuppressDevWarnings(cmIsOn(value));
+ this->Messenger->SetSuppressDevWarnings(value.IsOn());
} else if (key == "CMAKE_SUPPRESS_DEVELOPER_ERRORS"_s) {
- this->Messenger->SetDevWarningsAsErrors(value && cmIsOff(value));
+ this->Messenger->SetDevWarningsAsErrors(value && value.IsOff());
}
}
@@ -2949,16 +2950,17 @@ std::string const& cmake::GetGlobVerifyStamp() const
return this->State->GetGlobVerifyStamp();
}
-void cmake::AddGlobCacheEntry(bool recurse, bool listDirectories,
- bool followSymlinks, const std::string& relative,
- const std::string& expression,
- const std::vector<std::string>& files,
+void cmake::AddGlobCacheEntry(const cmGlobCacheEntry& entry,
const std::string& variable,
cmListFileBacktrace const& backtrace)
{
- this->State->AddGlobCacheEntry(recurse, listDirectories, followSymlinks,
- relative, expression, files, variable,
- backtrace, this->Messenger.get());
+ this->State->AddGlobCacheEntry(entry, variable, backtrace,
+ this->Messenger.get());
+}
+
+std::vector<cmGlobCacheEntry> cmake::GetGlobCacheEntries() const
+{
+ return this->State->GetGlobCacheEntries();
}
std::vector<std::string> cmake::GetAllExtensions() const
@@ -3769,7 +3771,7 @@ int cmake::Build(int jobs, std::string dir, std::vector<std::string> targets,
}
projName = *cachedProjectName;
- if (cmIsOn(this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE"))) {
+ if (this->State->GetCacheEntryValue("CMAKE_VERBOSE_MAKEFILE").IsOn()) {
verbose = true;
}
diff --git a/Source/cmake.h b/Source/cmake.h
index ccf5154..2d17ed2 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -53,6 +53,7 @@ class cmMakefile;
class cmMessenger;
class cmVariableWatch;
struct cmBuildOptions;
+struct cmGlobCacheEntry;
/** \brief Represents a cmake invocation.
*
@@ -351,12 +352,10 @@ public:
bool DoWriteGlobVerifyTarget() const;
std::string const& GetGlobVerifyScript() const;
std::string const& GetGlobVerifyStamp() const;
- void AddGlobCacheEntry(bool recurse, bool listDirectories,
- bool followSymlinks, const std::string& relative,
- const std::string& expression,
- const std::vector<std::string>& files,
+ void AddGlobCacheEntry(const cmGlobCacheEntry& entry,
const std::string& variable,
cmListFileBacktrace const& bt);
+ std::vector<cmGlobCacheEntry> GetGlobCacheEntries() const;
/**
* Get the system information and write it to the file specified
diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst
index ebd3ed3..d62afa5 100644
--- a/Source/kwsys/CONTRIBUTING.rst
+++ b/Source/kwsys/CONTRIBUTING.rst
@@ -34,7 +34,7 @@ code. It automatically runs ``clang-format`` on the set of source files
for which we enforce style. The script also has options to format only
a subset of files, such as those that are locally modified.
-.. _`clang-format`: http://clang.llvm.org/docs/ClangFormat.html
+.. _`clang-format`: https://clang.llvm.org/docs/ClangFormat.html
.. _`.clang-format`: .clang-format
.. _`clang-format.bash`: clang-format.bash
diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx
index 50171dd..61703ad 100644
--- a/Source/kwsys/CommandLineArguments.cxx
+++ b/Source/kwsys/CommandLineArguments.cxx
@@ -132,7 +132,7 @@ bool CommandLineArguments::GetMatchedArguments(
// Does the argument match to any we know about?
for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
+ it != this->Internals->Callbacks.end(); ++it) {
const CommandLineArguments::Internal::String& parg = it->first;
CommandLineArgumentsCallbackStructure* cs = &it->second;
if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
@@ -467,7 +467,7 @@ void CommandLineArguments::GenerateHelp()
MapArgs mp;
MapArgs::iterator mpit, smpit;
for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
+ it != this->Internals->Callbacks.end(); ++it) {
CommandLineArgumentsCallbackStructure* cs = &(it->second);
mpit = mp.find(cs->Help);
if (mpit != mp.end()) {
@@ -478,14 +478,14 @@ void CommandLineArguments::GenerateHelp()
}
}
for (it = this->Internals->Callbacks.begin();
- it != this->Internals->Callbacks.end(); it++) {
+ it != this->Internals->Callbacks.end(); ++it) {
CommandLineArgumentsCallbackStructure* cs = &(it->second);
mpit = mp.find(cs->Help);
if (mpit != mp.end()) {
mpit->second.insert(it->first);
smpit = mp.find(it->first);
CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = smpit->second.begin(); sit != smpit->second.end(); sit++) {
+ for (sit = smpit->second.begin(); sit != smpit->second.end(); ++sit) {
mpit->second.insert(*sit);
}
mp.erase(smpit);
@@ -496,9 +496,9 @@ void CommandLineArguments::GenerateHelp()
// Find the length of the longest string
CommandLineArguments::Internal::String::size_type maxlen = 0;
- for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
+ for (mpit = mp.begin(); mpit != mp.end(); ++mpit) {
CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
+ for (sit = mpit->second.begin(); sit != mpit->second.end(); ++sit) {
CommandLineArguments::Internal::String::size_type clen = sit->size();
switch (this->Internals->Callbacks[*sit].ArgumentType) {
case CommandLineArguments::NO_ARGUMENT:
@@ -524,9 +524,9 @@ void CommandLineArguments::GenerateHelp()
maxlen += 4; // For the space before and after the option
// Print help for each option
- for (mpit = mp.begin(); mpit != mp.end(); mpit++) {
+ for (mpit = mp.begin(); mpit != mp.end(); ++mpit) {
CommandLineArguments::Internal::SetOfStrings::iterator sit;
- for (sit = mpit->second.begin(); sit != mpit->second.end(); sit++) {
+ for (sit = mpit->second.begin(); sit != mpit->second.end(); ++sit) {
str << std::endl;
std::string argument = *sit;
switch (this->Internals->Callbacks[*sit].ArgumentType) {
diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx
index f239576..f152ca4 100644
--- a/Source/kwsys/Directory.cxx
+++ b/Source/kwsys/Directory.cxx
@@ -269,7 +269,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
# include <string.h>
// PGI with glibc has trouble with dirent and large file support:
-// http://www.pgroup.com/userforum/viewtopic.php?
+// https://www.pgroup.com/userforum/viewtopic.php?
// p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
// Work around the problem by mapping dirent the same way as readdir.
# if defined(__PGI) && defined(__GLIBC__)
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index 76995e2..b0faa0e 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -52,7 +52,7 @@
This code implements the MD5 Algorithm defined in RFC 1321, whose
text is available at
- http://www.ietf.org/rfc/rfc1321.txt
+ https://www.ietf.org/rfc/rfc1321.txt
The code is derived from the text of the RFC, including the test suite
(section A.5) but excluding the rest of Appendix A. It does not include
any code or documentation that is identified in the RFC as being
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 369ff9a..5e07e80 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -22,10 +22,10 @@
// Consider using these on Win32/Win64 for some of them:
//
// IsProcessorFeaturePresent
-// http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx
+// https://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx
//
// GetProcessMemoryInfo
-// http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
+// https://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
#include "kwsysPrivate.h"
#include KWSYS_HEADER(SystemInformation.hxx)
@@ -4265,7 +4265,7 @@ bool SystemInformationImplementation::QueryCygwinMemory()
{
#ifdef __CYGWIN__
// _SC_PAGE_SIZE does return the mmap() granularity on Cygwin,
- // see http://cygwin.com/ml/cygwin/2006-06/msg00350.html
+ // see https://sourceware.org/legacy-ml/cygwin/2006-06/msg00350.html
// Therefore just use 4096 as the page size of Windows.
long m = sysconf(_SC_PHYS_PAGES);
if (m < 0) {
@@ -4890,7 +4890,7 @@ std::string SystemInformationImplementation::ParseValueFromKStat(
args.reserve(3 + args_string.size());
args.push_back("kstat");
args.push_back("-p");
- for (auto& i : args_string) {
+ for (const auto& i : args_string) {
args.push_back(i.c_str());
}
args.push_back(nullptr);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 53b55f6..11018a6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2867,9 +2867,8 @@ std::string SystemToolsStatic::FindName(
path.reserve(path.size() + userPaths.size());
path.insert(path.end(), userPaths.begin(), userPaths.end());
// now look for the file
- std::string tryPath;
for (std::string const& p : path) {
- tryPath = p;
+ std::string tryPath = p;
if (tryPath.empty() || tryPath.back() != '/') {
tryPath += '/';
}
@@ -2938,8 +2937,6 @@ std::string SystemTools::FindProgram(const std::string& name,
const std::vector<std::string>& userPaths,
bool no_system_path)
{
- std::string tryPath;
-
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
std::vector<std::string> extensions;
// check to see if the name already has a .xxx at
@@ -2951,7 +2948,7 @@ std::string SystemTools::FindProgram(const std::string& name,
// first try with extensions if the os supports them
for (std::string const& ext : extensions) {
- tryPath = name;
+ std::string tryPath = name;
tryPath += ext;
if (SystemTools::FileIsExecutable(tryPath)) {
return SystemTools::CollapseFullPath(tryPath);
@@ -2988,7 +2985,7 @@ std::string SystemTools::FindProgram(const std::string& name,
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
// first try with extensions
for (std::string const& ext : extensions) {
- tryPath = p;
+ std::string tryPath = p;
tryPath += name;
tryPath += ext;
if (SystemTools::FileIsExecutable(tryPath)) {
@@ -2997,7 +2994,7 @@ std::string SystemTools::FindProgram(const std::string& name,
}
#endif
// now try it without them
- tryPath = p;
+ std::string tryPath = p;
tryPath += name;
if (SystemTools::FileIsExecutable(tryPath)) {
return SystemTools::CollapseFullPath(tryPath);
@@ -3152,16 +3149,13 @@ bool SystemTools::FileIsDirectory(const std::string& inName)
#if defined(_WIN32)
DWORD attr =
GetFileAttributesW(Encoding::ToWindowsExtendedPath(name).c_str());
- if (attr != INVALID_FILE_ATTRIBUTES) {
- return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
+ return (attr != INVALID_FILE_ATTRIBUTES) &&
+ (attr & FILE_ATTRIBUTE_DIRECTORY);
#else
struct stat fs;
- if (stat(name, &fs) == 0) {
- return S_ISDIR(fs.st_mode);
+
+ return (stat(name, &fs) == 0) && S_ISDIR(fs.st_mode);
#endif
- } else {
- return false;
- }
}
bool SystemTools::FileIsExecutable(const std::string& inName)
@@ -3226,11 +3220,7 @@ bool SystemTools::FileIsSymlink(const std::string& name)
return FileIsSymlinkWithAttr(path, GetFileAttributesW(path.c_str()));
#else
struct stat fs;
- if (lstat(name.c_str(), &fs) == 0) {
- return S_ISLNK(fs.st_mode);
- } else {
- return false;
- }
+ return (lstat(name.c_str(), &fs) == 0) && S_ISLNK(fs.st_mode);
#endif
}
@@ -3248,11 +3238,7 @@ bool SystemTools::FileIsFIFO(const std::string& name)
return type == FILE_TYPE_PIPE;
#else
struct stat fs;
- if (lstat(name.c_str(), &fs) == 0) {
- return S_ISFIFO(fs.st_mode);
- } else {
- return false;
- }
+ return (lstat(name.c_str(), &fs) == 0) && S_ISFIFO(fs.st_mode);
#endif
}
@@ -4889,7 +4875,7 @@ SystemToolsManager::~SystemToolsManager()
#if defined(__VMS)
// On VMS we configure the run time C library to be more UNIX like.
-// http://h71000.www7.hp.com/doc/732final/5763/5763pro_004.html
+// https://h71000.www7.hp.com/doc/732final/5763/5763pro_004.html
extern "C" int decc$feature_get_index(char* name);
extern "C" int decc$feature_set_value(int index, int mode, int value);
static int SetVMSFeature(char* name, int value)
diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c
index 39081a7..eb6e01b 100644
--- a/Source/kwsys/Terminal.c
+++ b/Source/kwsys/Terminal.c
@@ -168,7 +168,7 @@ static const char* kwsysTerminalVT100Names[] = { "Eterm",
static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
int default_tty)
{
- /* Force color according to http://bixense.com/clicolors/ convention. */
+ /* Force color according to https://bixense.com/clicolors/ convention. */
{
const char* clicolor_force = getenv("CLICOLOR_FORCE");
if (clicolor_force && *clicolor_force &&
@@ -177,7 +177,7 @@ static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
}
}
- /* Disable color according to http://bixense.com/clicolors/ convention. */
+ /* Disable color according to https://bixense.com/clicolors/ convention. */
{
const char* clicolor = getenv("CLICOLOR");
if (clicolor && strcmp(clicolor, "0") == 0) {
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index 8afcb68..9275043 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -1148,12 +1148,12 @@ static bool CheckCopyFileIfDifferent()
static bool CheckURLParsing()
{
bool ret = true;
- std::string url = "http://user:pw@hostname:42/full/url.com";
+ std::string url = "https://user:pw@hostname:42/full/url.com";
std::string protocol, username, password, hostname, dataport, database;
kwsys::SystemTools::ParseURL(url, protocol, username, password, hostname,
dataport, database);
- if (protocol != "http" || username != "user" || password != "pw" ||
+ if (protocol != "https" || username != "user" || password != "pw" ||
hostname != "hostname" || dataport != "42" ||
database != "full/url.com") {
std::cerr << "Incorrect URL parsing" << std::endl;
diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt
index 3d10ee0..8b3d0af 100644
--- a/Tests/Architecture/CMakeLists.txt
+++ b/Tests/Architecture/CMakeLists.txt
@@ -1,30 +1,21 @@
cmake_minimum_required(VERSION 3.5)
project(Architecture C)
-function(test_for_xcode4 result_var)
- set(${result_var} 0 PARENT_SCOPE)
- if(APPLE)
- execute_process(COMMAND xcodebuild -version
- OUTPUT_VARIABLE ov RESULT_VARIABLE rv
- )
- if("${rv}" STREQUAL "0" AND ov MATCHES "^Xcode ([0-9]+)\\.")
- if(NOT CMAKE_MATCH_1 VERSION_LESS 4)
- set(${result_var} 1 PARENT_SCOPE)
- endif()
- endif()
- endif()
-endfunction()
-
-test_for_xcode4(is_xcode4)
-
-set(arch0 i386)
-set(arch1 ppc)
-
-if(is_xcode4)
- # Xcode 4, use modern architectures as defaults
- # Arch 'ppc' no longer works: tools no longer available starting with Xcode 4
+if (CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 12)
+ # Since Xcode 12 we have two architectures again: arm64 and x86_64.
+ set(arch0 x86_64)
+ set(arch1 arm64)
+elseif(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 10)
+ # Xcode 10 / 11 do not have two supported architectures for the host.
+ message(STATUS "Skip test x86_64 only")
+ return()
+elseif(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 4)
+ # Xcode 4 no longer supports ppc, but does support x86_64.
set(arch0 i386)
set(arch1 x86_64)
+else()
+ set(arch0 i386)
+ set(arch1 ppc)
endif()
add_library(foo foo.c)
@@ -43,7 +34,6 @@ if(CMAKE_OSX_ARCHITECTURES)
endif()
endif()
-message("is_xcode4='${is_xcode4}'")
message("archs='${archs}'")
message("arch0='${arch0}'")
message("arch1='${arch1}'")
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 5ddae83..dbafc85 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -47,6 +47,10 @@ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
list(APPEND _cmake_options "-DTEST_MULTI3=1")
endif()
+if (APPLE)
+ list(APPEND _cmake_options "-DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION}")
+endif()
+
file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
message("Creating Project/foo.cxx")
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index a320d53..2abda2e 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -1,19 +1,7 @@
cmake_minimum_required(VERSION 2.6)
project(testRebuild)
-if(APPLE)
- set(CMake_TEST_XCODE_VERSION 0)
- if(XCODE_VERSION)
- set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}")
- else()
- execute_process(
- COMMAND xcodebuild -version
- OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
- )
- if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
- set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
- endif()
- endif()
+if(APPLE AND CMake_TEST_XCODE_VERSION)
# only use multi-arch if the sysroot exists on this machine
# Ninja needs -M which could not be used with multiple -arch flags
if(EXISTS "${CMAKE_OSX_SYSROOT}" AND NOT "${CMAKE_GENERATOR}" MATCHES "Ninja")
diff --git a/Tests/CMakeLib/CMakeLists.txt b/Tests/CMakeLib/CMakeLists.txt
index 2c1d22b..4d43e08 100644
--- a/Tests/CMakeLib/CMakeLists.txt
+++ b/Tests/CMakeLib/CMakeLists.txt
@@ -53,6 +53,7 @@ endif()
add_executable(testUVProcessChainHelper testUVProcessChainHelper.cxx)
target_link_libraries(testUVProcessChainHelper CMakeLib)
+target_compile_definitions(testUVProcessChainHelper PRIVATE WIN32_LEAN_AND_MEAN)
set(testRST_ARGS ${CMAKE_CURRENT_SOURCE_DIR})
set(testUVProcessChain_ARGS $<TARGET_FILE:testUVProcessChainHelper>)
diff --git a/Tests/CMakeLib/testDebuggerNamedPipe.cxx b/Tests/CMakeLib/testDebuggerNamedPipe.cxx
index 1ae3f64..67e1372 100644
--- a/Tests/CMakeLib/testDebuggerNamedPipe.cxx
+++ b/Tests/CMakeLib/testDebuggerNamedPipe.cxx
@@ -194,7 +194,7 @@ int runTest(int argc, char* argv[])
R"("command" *: *"disconnect".*"success" *: *true.*"type" *: *"response")"
};
- for (auto& regexString : expectedResponses) {
+ for (const auto& regexString : expectedResponses) {
cmsys::RegularExpression regex(regexString);
if (!regex.find(debuggerResponse)) {
std::cout << "Expected response not found: " << regexString << std::endl;
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 72b55e0..a75f6c2 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -299,25 +299,20 @@ if(BUILD_TESTING)
"Should the tests that use '--build-target package' be run?"
ON)
mark_as_advanced(CTEST_TEST_CPACK)
- set(CTEST_TEST_OSX_ARCH 0)
set(CMake_TEST_XCODE_VERSION 0)
if(APPLE)
- set(CTEST_TEST_OSX_ARCH 1)
if(XCODE_VERSION)
set(CMake_TEST_XCODE_VERSION "${XCODE_VERSION}")
else()
execute_process(
COMMAND xcodebuild -version
- OUTPUT_VARIABLE _version ERROR_VARIABLE _version_err
+ OUTPUT_VARIABLE _version
+ RESULT_VARIABLE _failed
)
- if(_version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
+ if(NOT _failed AND _version MATCHES "^Xcode ([0-9]+(\\.[0-9]+)*)")
set(CMake_TEST_XCODE_VERSION "${CMAKE_MATCH_1}")
endif()
endif()
- if(NOT CMake_TEST_XCODE_VERSION VERSION_LESS 10)
- # Since Xcode 10 we do not have two supported architectures for the host.
- set(CTEST_TEST_OSX_ARCH 0)
- endif()
if(CMAKE_OSX_SYSROOT)
execute_process(
COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version ProductName
@@ -392,7 +387,19 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(TryCompile TryCompile)
ADD_TEST_MACRO(SystemInformation SystemInformation)
ADD_TEST_MACRO(MathTest MathTest)
+
+ string(REPLACE ";" "$<SEMICOLON>" TEST_STDS_C "${CMake_TEST_C_STANDARDS}")
+ string(REPLACE ";" "$<SEMICOLON>" TEST_STDS_CXX "${CMake_TEST_CXX_STANDARDS}")
+ string(REPLACE ";" "$<SEMICOLON>" TEST_STDS_CUDA "${CMake_TEST_CUDA_STANDARDS}")
+ set(CompileFeatures_BUILD_OPTIONS
+ -DCMake_TEST_C_STANDARDS=${TEST_STDS_C}
+ -DCMake_TEST_CXX_STANDARDS=${TEST_STDS_CXX}
+ -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
+ -DCMake_TEST_CUDA_STANDARDS=${TEST_STDS_CUDA}
+ )
ADD_TEST_MACRO(CompileFeatures CompileFeatures)
+ set_property(TEST CompileFeatures APPEND PROPERTY LABELS "CUDA")
+
ADD_TEST_MACRO(CMakeCommands.target_compile_features)
if(CMake_TEST_RESOURCES)
@@ -498,6 +505,10 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(ReturnTest ReturnTest)
ADD_TEST_MACRO(Properties Properties)
ADD_TEST_MACRO(Assembler HelloAsm)
+ # relies on Linux syscall interface
+ if(CMake_TEST_ASM_NASM AND CMAKE_SYSTEM_NAME MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ ADD_TEST_MACRO(NasmOnly NasmOnly)
+ endif()
ADD_TEST_MACRO(SourceGroups SourceGroups)
ADD_TEST_MACRO(Preprocess Preprocess)
set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
@@ -562,10 +573,13 @@ if(BUILD_TESTING)
if("${CMAKE_GENERATOR}" MATCHES "Make")
ADD_TEST_MACRO(Policy0002 Policy0002)
endif()
- if(CTEST_TEST_OSX_ARCH)
+ if(CMake_TEST_XCODE_VERSION)
+ set(Architecture_BUILD_OPTIONS -DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION})
ADD_TEST_MACRO(Architecture Architecture)
set_tests_properties(Architecture PROPERTIES
PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked|but attempting to link with file built for)")
+ set_property(TEST Architecture APPEND PROPERTY
+ PASS_REGULAR_EXPRESSION "Skip test x86_64 only|found architecture '.*', required architecture '.*'")
endif()
list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
@@ -933,6 +947,8 @@ if(BUILD_TESTING)
"${CMake_BINARY_DIR}/Tests/BuildDepends"
${build_generator_args}
--build-project BuildDepends
+ --build-options
+ "-DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION}"
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
@@ -974,36 +990,6 @@ if(BUILD_TESTING)
endif()
endif()
- # On Windows run the CPackWiXGenerator test
- # if the WiX Toolset seems to be available
- if(WIN32)
- file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT)
-
- find_program(WIX_LIGHT_EXECUTABLE light
- PATHS "${WIX_ROOT}/bin"
- DOC "WiX Toolset light.exe location")
-
- if(WIX_LIGHT_EXECUTABLE)
- add_test(CPackWiXGenerator ${CMAKE_CTEST_COMMAND}
- -C \${CTEST_CONFIGURATION_TYPE}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator"
- "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
- ${build_generator_args}
- --build-project CPackWiXGenerator
- --build-options
- --test-command ${CMAKE_CMAKE_COMMAND}
- "-DCPackWiXGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackWiXGenerator"
- "-Dno_verify:BOOL=${CMake_TEST_WIX_NO_VERIFY}"
- "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
- -P "${CMake_SOURCE_DIR}/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake")
-
- set_property(TEST CPackWiXGenerator PROPERTY
- ATTACHED_FILES_ON_FAIL
- "${CMake_BINARY_DIR}/Tests/CPackWiXGenerator/_CPack_Packages/win32/WIX/wix.log")
- endif()
- endif()
-
# On Windows run the CPackInnoSetupGenerator test
if(WIN32 AND CMake_TEST_CPACK_INNOSETUP)
add_test(CPackInnoSetupGenerator ${CMAKE_CTEST_COMMAND}
@@ -1473,6 +1459,7 @@ if(BUILD_TESTING)
_mod
IN ITEMS
ALSA
+ Backtrace
BLAS
Boost
BZip2
diff --git a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake b/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
deleted file mode 100644
index c549e61..0000000
--- a/Tests/CPackWiXGenerator/RunCPackVerifyResult.cmake
+++ /dev/null
@@ -1,79 +0,0 @@
-message(STATUS "=============================================================")
-message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
-message(STATUS "")
-
-if(NOT CPackWiXGenerator_BINARY_DIR)
- message(FATAL_ERROR "CPackWiXGenerator_BINARY_DIR not set")
-endif()
-
-message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
-message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}")
-message(STATUS "CPackWiXGenerator_BINARY_DIR: ${CPackWiXGenerator_BINARY_DIR}")
-
-if(config)
- set(_C_config -C ${config})
-endif()
-
-execute_process(COMMAND "${CMAKE_CPACK_COMMAND}"
- ${_C_config}
- RESULT_VARIABLE CPack_result
- OUTPUT_VARIABLE CPack_output
- ERROR_VARIABLE CPack_error
- WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}")
-
-if(CPack_result)
- message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}")
-else ()
- message(STATUS "CPack_output=${CPack_output}")
-endif()
-
-set(expected_file_mask "*.msi")
-file(GLOB installer_file "${expected_file_mask}")
-
-message(STATUS "installer_file='${installer_file}'")
-message(STATUS "expected_file_mask='${expected_file_mask}'")
-
-if(NOT installer_file)
- message(FATAL_ERROR "installer_file does not exist.")
-endif()
-
-function(run_wix_command command)
- file(TO_CMAKE_PATH "$ENV{WIX}" WIX_ROOT)
- set(WIX_PROGRAM "${WIX_ROOT}/bin/${command}.exe")
-
- if(NOT EXISTS "${WIX_PROGRAM}")
- message(FATAL_ERROR "Failed to find WiX Tool: ${WIX_PROGRAM}")
- endif()
-
- message(STATUS "Running WiX Tool: ${command} ${ARGN}")
-
- execute_process(COMMAND "${WIX_PROGRAM}" ${ARGN}
- RESULT_VARIABLE WIX_result
- OUTPUT_VARIABLE WIX_output
- ERROR_VARIABLE WIX_output
- WORKING_DIRECTORY "${CPackWiXGenerator_BINARY_DIR}")
-
- message(STATUS "${command} Output: \n${WIX_output}")
-
- if(WIX_result)
- message(FATAL_ERROR "WiX ${command} failed: ${WIX_result}")
- endif()
-endfunction()
-
-file(GLOB WXS_SOURCE_FILES
- "${CPackWiXGenerator_BINARY_DIR}/_CPack_Packages/*/WIX/*.wxs")
-
-if(NOT WXS_SOURCE_FILES)
- message(FATAL_ERROR "Failed finding WiX source files to validate.")
-endif()
-
-foreach(WXS_SOURCE_FILE IN LISTS WXS_SOURCE_FILES)
- run_wix_command(wixcop "${WXS_SOURCE_FILE}")
-endforeach()
-
-# error SMOK1076 : ICE61: This product should remove only older
-# versions of itself. The Maximum version is not less
-# than the current product. (1.0.0 1.0.0)
-if (NOT no_verify)
- run_wix_command(smoke -nologo -wx -sw1076 "${installer_file}")
-endif ()
diff --git a/Tests/CompatibleInterface/CMakeLists.txt b/Tests/CompatibleInterface/CMakeLists.txt
index 668a97b..5d57ce4 100644
--- a/Tests/CompatibleInterface/CMakeLists.txt
+++ b/Tests/CompatibleInterface/CMakeLists.txt
@@ -13,12 +13,14 @@ set_property(TARGET iface1 APPEND PROPERTY
BOOL_PROP2
BOOL_PROP3
BOOL_PROP4
+ BOOL_PROP5
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING
STRING_PROP1
STRING_PROP2
STRING_PROP3
+ STRING_PROP4
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MIN
@@ -26,30 +28,40 @@ set_property(TARGET iface1 APPEND PROPERTY
NUMBER_MIN_PROP2
NUMBER_MIN_PROP3
NUMBER_MIN_PROP4
+ NUMBER_MIN_PROP5
+ NUMBER_MIN_PROP6
)
set_property(TARGET iface1 APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX
NUMBER_MAX_PROP1
NUMBER_MAX_PROP2
+ NUMBER_MAX_PROP3
+ NUMBER_MAX_PROP4
)
set(CMAKE_DEBUG_TARGET_PROPERTIES
- BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4
- STRING_PROP1 STRING_PROP2 STRING_PROP3
- NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4
- NUMBER_MAX_PROP1 NUMBER_MAX_PROP2
+ BOOL_PROP1 BOOL_PROP2 BOOL_PROP3 BOOL_PROP4 BOOL_PROP5
+ STRING_PROP1 STRING_PROP2 STRING_PROP3 STRING_PROP4
+ NUMBER_MIN_PROP1 NUMBER_MIN_PROP2 NUMBER_MIN_PROP3 NUMBER_MIN_PROP4 NUMBER_MIN_PROP5 NUMBER_MIN_PROP6
+ NUMBER_MAX_PROP1 NUMBER_MAX_PROP2 NUMBER_MAX_PROP3 NUMBER_MAX_PROP4
)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP1 ON)
set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP2 ON)
+set_property(TARGET iface1 PROPERTY INTERFACE_BOOL_PROP5 ON)
set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP1 prop1)
set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP2 prop2)
+set_property(TARGET iface1 PROPERTY INTERFACE_STRING_PROP4 prop4)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP1 100)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP2 200)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP3 0x10)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP4 0x10)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP5 5)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MIN_PROP6 6)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP1 100)
set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP2 200)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP3 3)
+set_property(TARGET iface1 PROPERTY INTERFACE_NUMBER_MAX_PROP4 4)
add_executable(CompatibleInterface main.cpp)
target_link_libraries(CompatibleInterface iface1)
@@ -86,8 +98,48 @@ target_compile_definitions(CompatibleInterface
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP2>,200>:NUMBER_MIN_PROP2=200>
$<$<EQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP3>,0xA>:NUMBER_MIN_PROP3=0xA>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP4>,0x10>:NUMBER_MIN_PROP4=0x10>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MIN_PROP5>,5>:NUMBER_MIN_PROP5=5>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP1>,100>:NUMBER_MAX_PROP1=100>
$<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP2>,250>:NUMBER_MAX_PROP2=250>
+ $<$<STREQUAL:$<TARGET_PROPERTY:NUMBER_MAX_PROP3>,3>:NUMBER_MAX_PROP3=3>
+
+ # Static libraries compute COMPATIBLE_INTERFACE_ properties transitively.
+ $<$<BOOL:$<TARGET_PROPERTY:static1,BOOL_PROP1>>:STATIC1_BOOL_PROP1>
+ $<$<STREQUAL:$<TARGET_PROPERTY:static1,STRING_PROP1>,prop1>:STATIC1_STRING_PROP1>
+ $<$<EQUAL:$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP3>,3>:STATIC1_NUMBER_MAX_PROP3>
+ $<$<EQUAL:$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP5>,5>:STATIC1_NUMBER_MIN_PROP5>
+
+ # Object libraries do not compute COMPATIBLE_INTERFACE_ properties transitively.
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:object1,BOOL_PROP1>,>>:OBJECT1_BOOL_PROP1>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:object1,STRING_PROP1>,>>:OBJECT1_STRING_PROP1>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP3>,>>:OBJECT1_NUMBER_MAX_PROP3>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP5>,>>:OBJECT1_NUMBER_MIN_PROP5>
+
+ # Interface libraries do not compute COMPATIBLE_INTERFACE_ properties transitively.
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:iface3,BOOL_PROP1>,>>:IFACE3_BOOL_PROP1>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:iface3,STRING_PROP1>,>>:IFACE3_STRING_PROP1>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP3>,>>:IFACE3_NUMBER_MAX_PROP3>
+ $<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP5>,>>:IFACE3_NUMBER_MIN_PROP5>
+
+ # Static libraries compute COMPATIBLE_INTERFACE_ properties transitively.
+ $<$<BOOL:$<TARGET_PROPERTY:static1,BOOL_PROP5>>:STATIC1_BOOL_PROP5>
+ $<$<STREQUAL:$<TARGET_PROPERTY:static1,STRING_PROP4>,prop4>:STATIC1_STRING_PROP4>
+ $<$<EQUAL:$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP6>,6>:STATIC1_NUMBER_MIN_PROP6>
+ $<$<EQUAL:$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP4>,4>:STATIC1_NUMBER_MAX_PROP4>
+
+ # Object libraries do not compute COMPATIBLE_INTERFACE_ properties transitively,
+ # but can have properties set on them.
+ $<$<BOOL:$<TARGET_PROPERTY:object1,BOOL_PROP5>>:OBJECT1_BOOL_PROP5>
+ $<$<STREQUAL:$<TARGET_PROPERTY:object1,STRING_PROP4>,prop4>:OBJECT1_STRING_PROP4>
+ $<$<EQUAL:$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP6>,7>:OBJECT1_NUMBER_MIN_PROP6>
+ $<$<EQUAL:$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP4>,1>:OBJECT1_NUMBER_MAX_PROP4>
+
+ # Interface libraries do not compute COMPATIBLE_INTERFACE_ properties transitively,
+ # but can have properties set on them.
+ $<$<BOOL:$<TARGET_PROPERTY:iface3,BOOL_PROP5>>:IFACE3_BOOL_PROP5>
+ $<$<STREQUAL:$<TARGET_PROPERTY:iface3,STRING_PROP4>,prop4>:IFACE3_STRING_PROP4>
+ $<$<EQUAL:$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP6>,7>:IFACE3_NUMBER_MIN_PROP6>
+ $<$<EQUAL:$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP4>,1>:IFACE3_NUMBER_MAX_PROP4>
)
@@ -128,3 +180,64 @@ set_property(TARGET CompatibleInterface APPEND PROPERTY
COMPATIBLE_INTERFACE_BOOL
NON_RELEVANT_PROP
)
+
+add_library(static1 STATIC foo.cpp)
+set_property(TARGET static1 PROPERTY BOOL_PROP5 ON)
+set_property(TARGET static1 PROPERTY STRING_PROP4 prop4)
+set_property(TARGET static1 PROPERTY NUMBER_MIN_PROP6 7)
+set_property(TARGET static1 PROPERTY NUMBER_MAX_PROP4 1)
+target_link_libraries(static1 PUBLIC iface1)
+
+add_library(object1 OBJECT foo.cpp)
+set_property(TARGET object1 PROPERTY BOOL_PROP5 ON)
+set_property(TARGET object1 PROPERTY STRING_PROP4 prop4)
+set_property(TARGET object1 PROPERTY NUMBER_MIN_PROP6 7)
+set_property(TARGET object1 PROPERTY NUMBER_MAX_PROP4 1)
+target_link_libraries(object1 PUBLIC iface1)
+
+add_library(iface3 INTERFACE)
+set_property(TARGET iface3 PROPERTY BOOL_PROP5 ON)
+set_property(TARGET iface3 PROPERTY STRING_PROP4 prop4)
+set_property(TARGET iface3 PROPERTY NUMBER_MIN_PROP6 7)
+set_property(TARGET iface3 PROPERTY NUMBER_MAX_PROP4 1)
+target_link_libraries(iface3 INTERFACE iface1)
+
+# Test COMPATIBLE_INTERFACE_* property evaluation outside of usage requirements.
+add_custom_target(check ALL VERBATIM
+ COMMAND CompatibleInterface
+ # expect actual
+ "1" "$<TARGET_PROPERTY:CompatibleInterface,BOOL_PROP1>"
+ "prop1" "$<TARGET_PROPERTY:CompatibleInterface,STRING_PROP1>"
+ "3" "$<TARGET_PROPERTY:CompatibleInterface,NUMBER_MAX_PROP3>"
+ "5" "$<TARGET_PROPERTY:CompatibleInterface,NUMBER_MIN_PROP5>"
+
+ "1" "$<TARGET_PROPERTY:static1,BOOL_PROP1>"
+ "prop1" "$<TARGET_PROPERTY:static1,STRING_PROP1>"
+ "3" "$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP3>"
+ "5" "$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP5>"
+
+ "" "$<TARGET_PROPERTY:object1,BOOL_PROP1>"
+ "" "$<TARGET_PROPERTY:object1,STRING_PROP1>"
+ "" "$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP3>"
+ "" "$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP5>"
+
+ "" "$<TARGET_PROPERTY:iface3,BOOL_PROP1>"
+ "" "$<TARGET_PROPERTY:iface3,STRING_PROP1>"
+ "" "$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP3>"
+ "" "$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP5>"
+
+ "ON" "$<TARGET_PROPERTY:static1,BOOL_PROP5>"
+ "prop4" "$<TARGET_PROPERTY:static1,STRING_PROP4>"
+ "6" "$<TARGET_PROPERTY:static1,NUMBER_MIN_PROP6>"
+ "4" "$<TARGET_PROPERTY:static1,NUMBER_MAX_PROP4>"
+
+ "ON" "$<TARGET_PROPERTY:object1,BOOL_PROP5>"
+ "prop4" "$<TARGET_PROPERTY:object1,STRING_PROP4>"
+ "7" "$<TARGET_PROPERTY:object1,NUMBER_MIN_PROP6>"
+ "1" "$<TARGET_PROPERTY:object1,NUMBER_MAX_PROP4>"
+
+ "ON" "$<TARGET_PROPERTY:iface3,BOOL_PROP5>"
+ "prop4" "$<TARGET_PROPERTY:iface3,STRING_PROP4>"
+ "7" "$<TARGET_PROPERTY:iface3,NUMBER_MIN_PROP6>"
+ "1" "$<TARGET_PROPERTY:iface3,NUMBER_MAX_PROP4>"
+ )
diff --git a/Tests/CompatibleInterface/main.cpp b/Tests/CompatibleInterface/main.cpp
index 0bccb82..1205cca 100644
--- a/Tests/CompatibleInterface/main.cpp
+++ b/Tests/CompatibleInterface/main.cpp
@@ -1,3 +1,5 @@
+#include <stdio.h>
+#include <string.h>
#ifndef BOOL_PROP1
# error Expected BOOL_PROP1
@@ -23,6 +25,102 @@
# error Expected STRING_PROP3
#endif
+#ifndef STATIC1_BOOL_PROP1
+# error Expected STATIC1_BOOL_PROP1
+#endif
+
+#ifndef STATIC1_STRING_PROP1
+# error Expected STATIC1_STRING_PROP1
+#endif
+
+#ifndef STATIC1_NUMBER_MAX_PROP3
+# error Expected STATIC1_NUMBER_MAX_PROP3
+#endif
+
+#ifndef STATIC1_NUMBER_MIN_PROP5
+# error Expected STATIC1_NUMBER_MIN_PROP5
+#endif
+
+#ifdef OBJECT1_BOOL_PROP1
+# error Unexpected OBJECT1_BOOL_PROP1
+#endif
+
+#ifdef OBJECT1_STRING_PROP1
+# error Unexpected OBJECT1_STRING_PROP1
+#endif
+
+#ifdef OBJECT1_NUMBER_MAX_PROP3
+# error Unexpected OBJECT1_NUMBER_MAX_PROP3
+#endif
+
+#ifdef OBJECT1_NUMBER_MIN_PROP5
+# error Unexpected OBJECT1_NUMBER_MIN_PROP5
+#endif
+
+#ifdef IFACE3_BOOL_PROP1
+# error Unexpected IFACE3_BOOL_PROP1
+#endif
+
+#ifdef IFACE3_STRING_PROP1
+# error Unexpected IFACE3_STRING_PROP1
+#endif
+
+#ifdef IFACE3_NUMBER_MAX_PROP3
+# error Unexpected IFACE3_NUMBER_MAX_PROP3
+#endif
+
+#ifdef IFACE3_NUMBER_MIN_PROP5
+# error Unexpected IFACE3_NUMBER_MIN_PROP5
+#endif
+
+#ifndef STATIC1_BOOL_PROP5
+# error Expected STATIC1_BOOL_PROP5
+#endif
+
+#ifndef STATIC1_STRING_PROP4
+# error Expected STATIC1_STRING_PROP4
+#endif
+
+#ifndef STATIC1_NUMBER_MIN_PROP6
+# error Expected STATIC1_NUMBER_MIN_PROP6
+#endif
+
+#ifndef STATIC1_NUMBER_MAX_PROP4
+# error Expected STATIC1_NUMBER_MAX_PROP4
+#endif
+
+#ifndef OBJECT1_BOOL_PROP5
+# error Expected OBJECT1_BOOL_PROP5
+#endif
+
+#ifndef OBJECT1_STRING_PROP4
+# error Expected OBJECT1_STRING_PROP4
+#endif
+
+#ifndef OBJECT1_NUMBER_MIN_PROP6
+# error Expected OBJECT1_NUMBER_MIN_PROP6
+#endif
+
+#ifndef OBJECT1_NUMBER_MAX_PROP4
+# error Expected OBJECT1_NUMBER_MAX_PROP4
+#endif
+
+#ifndef IFACE3_BOOL_PROP5
+# error Expected IFACE3_BOOL_PROP5
+#endif
+
+#ifndef IFACE3_STRING_PROP4
+# error Expected IFACE3_STRING_PROP4
+#endif
+
+#ifndef IFACE3_NUMBER_MIN_PROP6
+# error Expected IFACE3_NUMBER_MIN_PROP6
+#endif
+
+#ifndef IFACE3_NUMBER_MAX_PROP4
+# error Expected IFACE3_NUMBER_MAX_PROP4
+#endif
+
template <bool test>
struct CMakeStaticAssert;
@@ -35,10 +133,12 @@ enum
{
NumericMaxTest1 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP1 == 100>),
NumericMaxTest2 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP2 == 250>),
+ NumericMaxTest3 = sizeof(CMakeStaticAssert<NUMBER_MAX_PROP3 == 3>),
NumericMinTest1 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP1 == 50>),
NumericMinTest2 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP2 == 200>),
NumericMinTest3 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP3 == 0xA>),
- NumericMinTest4 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP4 == 0x10>)
+ NumericMinTest4 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP4 == 0x10>),
+ NumericMinTest5 = sizeof(CMakeStaticAssert<NUMBER_MIN_PROP5 == 5>)
};
#include "iface2.h"
@@ -51,6 +151,14 @@ __declspec(dllimport)
int main(int argc, char** argv)
{
+ int result = 0;
+ for (int i = 2; i < argc; i += 2) {
+ if (strcmp(argv[i - 1], argv[i]) != 0) {
+ fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i,
+ argv[i - 1], argv[i]);
+ result = 1;
+ }
+ }
Iface2 if2;
- return if2.foo() + foo() + bar();
+ return result + if2.foo() + foo() + bar();
}
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index d9bb447..469a085 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -6,6 +6,25 @@ project(CompileFeatures)
set(ext_C c)
set(ext_CXX cpp)
+set(std_C 90 99 11 17 23)
+set(std_CXX 98 11 14 17 20 23 26)
+
+if(CMake_TEST_CUDA)
+ enable_language(CUDA)
+ set(ext_CUDA cu)
+ set(std_CUDA 03 11 14 17 20 23 26)
+endif()
+
+foreach(lang C CXX CUDA)
+ foreach(std IN LISTS std_${lang})
+ string(TOLOWER "${lang}_std_${std}" feature)
+ if("${std}" IN_LIST CMake_TEST_${lang}_STANDARDS
+ OR CMAKE_${lang}${std}_STANDARD_COMPILE_OPTION)
+ add_library(test_${feature} OBJECT ${feature}.${ext_${lang}})
+ target_compile_features(test_${feature} PRIVATE ${feature})
+ endif()
+ endforeach()
+endforeach()
macro(run_test feature lang)
if (${feature} IN_LIST CMAKE_${lang}_COMPILE_FEATURES)
@@ -273,6 +292,7 @@ if (CMAKE_CXX_COMPILE_FEATURES)
if (std_flag_idx EQUAL -1)
add_executable(default_dialect default_dialect.cpp)
target_compile_definitions(default_dialect PRIVATE
+ DEFAULT_CXX26=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},26>
DEFAULT_CXX23=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},23>
DEFAULT_CXX20=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},20>
DEFAULT_CXX17=$<EQUAL:${CMAKE_CXX_STANDARD_DEFAULT},17>
@@ -284,6 +304,22 @@ if (CMAKE_CXX_COMPILE_FEATURES)
endif()
endif ()
+if (CMake_TEST_CUDA
+ AND CMAKE_CUDA_COMPILE_FEATURES
+ AND CMAKE_CUDA_STANDARD_DEFAULT
+ AND NOT CMAKE_CUDA_FLAGS MATCHES "-std=")
+ add_executable(default_dialect_cuda default_dialect.cu)
+ target_compile_definitions(default_dialect_cuda PRIVATE
+ DEFAULT_CXX26=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},26>
+ DEFAULT_CXX23=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},23>
+ DEFAULT_CXX20=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},20>
+ DEFAULT_CXX17=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},17>
+ DEFAULT_CXX14=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},14>
+ DEFAULT_CXX11=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},11>
+ DEFAULT_CXX98=$<EQUAL:${CMAKE_CUDA_STANDARD_DEFAULT},03>
+ )
+endif ()
+
# always add a target "CompileFeatures"
if ((NOT CXX_expected_features) OR
(NOT cxx_auto_type IN_LIST CXX_expected_features))
diff --git a/Tests/CompileFeatures/c_std.h b/Tests/CompileFeatures/c_std.h
new file mode 100644
index 0000000..afe0308
--- /dev/null
+++ b/Tests/CompileFeatures/c_std.h
@@ -0,0 +1,8 @@
+#define C_STD_99 199901L
+#define C_STD_11 201112L
+#define C_STD_17 201710L
+#define C_STD_23 202311L
+
+#ifdef __STDC_VERSION__
+# define C_STD __STDC_VERSION__
+#endif
diff --git a/Tests/CompileFeatures/c_std_11.c b/Tests/CompileFeatures/c_std_11.c
new file mode 100644
index 0000000..2938c17
--- /dev/null
+++ b/Tests/CompileFeatures/c_std_11.c
@@ -0,0 +1,5 @@
+#include "c_std.h"
+#if defined(C_STD) && C_STD <= C_STD_99 && \
+ !(defined(__SUNPRO_C) && __SUNPRO_C < 0x5140 && C_STD == C_STD_99)
+# error "c_std_11 not honored"
+#endif
diff --git a/Tests/CompileFeatures/c_std_17.c b/Tests/CompileFeatures/c_std_17.c
new file mode 100644
index 0000000..938cba4
--- /dev/null
+++ b/Tests/CompileFeatures/c_std_17.c
@@ -0,0 +1,4 @@
+#include "c_std.h"
+#if defined(C_STD) && C_STD <= C_STD_11
+# error "c_std_17 not honored"
+#endif
diff --git a/Tests/CompileFeatures/c_std_23.c b/Tests/CompileFeatures/c_std_23.c
new file mode 100644
index 0000000..a60a16e
--- /dev/null
+++ b/Tests/CompileFeatures/c_std_23.c
@@ -0,0 +1,5 @@
+#include "c_std.h"
+#if defined(C_STD) && C_STD <= C_STD_17 && \
+ !(C_STD == C_STD_17 && defined(__clang_major__) && __clang_major__ < 14)
+# error "c_std_23 not honored"
+#endif
diff --git a/Tests/CPackWiXGenerator/file with spaces.h b/Tests/CompileFeatures/c_std_90.c
index e69de29..e69de29 100644
--- a/Tests/CPackWiXGenerator/file with spaces.h
+++ b/Tests/CompileFeatures/c_std_90.c
diff --git a/Tests/CompileFeatures/c_std_99.c b/Tests/CompileFeatures/c_std_99.c
new file mode 100644
index 0000000..20b6372
--- /dev/null
+++ b/Tests/CompileFeatures/c_std_99.c
@@ -0,0 +1,4 @@
+#include "c_std.h"
+#if defined(C_STD) && C_STD < C_STD_99
+# error "c_std_99 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_03.cu b/Tests/CompileFeatures/cuda_std_03.cu
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_03.cu
diff --git a/Tests/CompileFeatures/cuda_std_11.cu b/Tests/CompileFeatures/cuda_std_11.cu
new file mode 100644
index 0000000..76813fd
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_11.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD < CXX_STD_11
+# error "cuda_std_11 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_14.cu b/Tests/CompileFeatures/cuda_std_14.cu
new file mode 100644
index 0000000..53e23c8
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_14.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_11
+# error "cuda_std_14 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_17.cu b/Tests/CompileFeatures/cuda_std_17.cu
new file mode 100644
index 0000000..502defb
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_17.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_14
+# error "cuda_std_17 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_20.cu b/Tests/CompileFeatures/cuda_std_20.cu
new file mode 100644
index 0000000..afdd3ba
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_20.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_17
+# error "cuda_std_20 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_23.cu b/Tests/CompileFeatures/cuda_std_23.cu
new file mode 100644
index 0000000..6bdaeb9
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_23.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_20
+# error "cuda_std_23 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cuda_std_26.cu b/Tests/CompileFeatures/cuda_std_26.cu
new file mode 100644
index 0000000..efeca8d
--- /dev/null
+++ b/Tests/CompileFeatures/cuda_std_26.cu
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_23
+# error "cuda_std_26 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std.h b/Tests/CompileFeatures/cxx_std.h
new file mode 100644
index 0000000..f17b683
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std.h
@@ -0,0 +1,54 @@
+#define CXX_STD_98 199711L
+#define CXX_STD_11 201103L
+#define CXX_STD_14 201402L
+#define CXX_STD_17 201703L
+#define CXX_STD_20 202002L
+#define CXX_STD_23 202302L
+
+#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG)
+# if _MSVC_LANG > CXX_STD_17
+# define CXX_STD _MSVC_LANG
+# elif _MSVC_LANG == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
+# define CXX_STD CXX_STD_20
+# elif _MSVC_LANG > CXX_STD_14 && __cplusplus > CXX_STD_17
+# define CXX_STD CXX_STD_20
+# elif _MSVC_LANG > CXX_STD_14
+# define CXX_STD CXX_STD_17
+# elif defined(__INTEL_CXX11_MODE__) && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# elif defined(__INTEL_CXX11_MODE__)
+# define CXX_STD CXX_STD_11
+# else
+# define CXX_STD CXX_STD_98
+# endif
+#elif defined(_MSC_VER) && defined(_MSVC_LANG)
+# if _MSVC_LANG > __cplusplus
+# define CXX_STD _MSVC_LANG
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif defined(__NVCOMPILER)
+# if __cplusplus == CXX_STD_17 && defined(__cpp_aggregate_paren_init)
+# define CXX_STD CXX_STD_20
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif defined(__INTEL_COMPILER) || defined(__PGI)
+# if __cplusplus == CXX_STD_11 && defined(__cpp_namespace_attributes)
+# define CXX_STD CXX_STD_17
+# elif __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif (defined(__IBMCPP__) || defined(__ibmxl__)) && defined(__linux__)
+# if __cplusplus == CXX_STD_11 && defined(__cpp_aggregate_nsdmi)
+# define CXX_STD CXX_STD_14
+# else
+# define CXX_STD __cplusplus
+# endif
+#elif __cplusplus == 1 && defined(__GXX_EXPERIMENTAL_CXX0X__)
+# define CXX_STD CXX_STD_11
+#else
+# define CXX_STD __cplusplus
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_11.cpp b/Tests/CompileFeatures/cxx_std_11.cpp
new file mode 100644
index 0000000..aa85cdb
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_11.cpp
@@ -0,0 +1,6 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD < CXX_STD_11 && \
+ !(CXX_STD == CXX_STD_98 && \
+ (defined(__IBMCPP__) && defined(_AIX) && __IBMCPP__ == 1610))
+# error "cxx_std_11 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_14.cpp b/Tests/CompileFeatures/cxx_std_14.cpp
new file mode 100644
index 0000000..dabd2ee
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_14.cpp
@@ -0,0 +1,9 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_11 && \
+ !(CXX_STD == CXX_STD_11 && \
+ ((defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 4 && \
+ __GNUC_MINOR__ <= 8 && !defined(__clang__) && \
+ !defined(__INTEL_COMPILER) && !defined(__PGI)) || \
+ (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5150)))
+# error "cxx_std_14 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_17.cpp b/Tests/CompileFeatures/cxx_std_17.cpp
new file mode 100644
index 0000000..3ca6bbe
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_17.cpp
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_14
+# error "cxx_std_17 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_20.cpp b/Tests/CompileFeatures/cxx_std_20.cpp
new file mode 100644
index 0000000..35f5ac1
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_20.cpp
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_17
+# error "cxx_std_20 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_23.cpp b/Tests/CompileFeatures/cxx_std_23.cpp
new file mode 100644
index 0000000..020578d
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_23.cpp
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_20
+# error "cxx_std_23 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_26.cpp b/Tests/CompileFeatures/cxx_std_26.cpp
new file mode 100644
index 0000000..db3f6bc
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_26.cpp
@@ -0,0 +1,4 @@
+#include "cxx_std.h"
+#if defined(CXX_STD) && CXX_STD <= CXX_STD_23
+# error "cxx_std_26 not honored"
+#endif
diff --git a/Tests/CompileFeatures/cxx_std_98.cpp b/Tests/CompileFeatures/cxx_std_98.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_std_98.cpp
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index cae107b..4cd4ca0 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -1,18 +1,19 @@
+#include "c_std.h"
#if DEFAULT_C23
-# if __STDC_VERSION__ <= 201710L
+# if C_STD <= C_STD_17
# error Unexpected value for __STDC_VERSION__.
# endif
#elif DEFAULT_C17
-# if __STDC_VERSION__ < 201710L
+# if C_STD <= C_STD_11
# error Unexpected value for __STDC_VERSION__.
# endif
#elif DEFAULT_C11
-# if __STDC_VERSION__ < 201112L
+# if C_STD <= C_STD_99
# error Unexpected value for __STDC_VERSION__.
# endif
#elif DEFAULT_C99
-# if __STDC_VERSION__ != 199901L
+# if C_STD != C_STD_99
# error Unexpected value for __STDC_VERSION__.
# endif
#else
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
index bd504ff..b873b14 100644
--- a/Tests/CompileFeatures/default_dialect.cpp
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -1,48 +1,37 @@
+#include "cxx_std.h"
template <long l>
struct Outputter;
-#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
-# if defined(__INTEL_CXX11_MODE__)
-# if defined(__cpp_aggregate_nsdmi)
-# define CXX_STD 201402L
-# else
-# define CXX_STD 201103L
-# endif
-# else
-# define CXX_STD 199711L
-# endif
-#elif defined(_MSC_VER) && defined(_MSVC_LANG)
-# define CXX_STD _MSVC_LANG
-#else
-# define CXX_STD __cplusplus
-#endif
-
-#if DEFAULT_CXX23
-# if CXX_STD <= 202002L
+#if DEFAULT_CXX26
+# if CXX_STD <= CXX_STD_23
+Outputter<CXX_STD> o;
+# endif
+#elif DEFAULT_CXX23
+# if CXX_STD <= CXX_STD_20
Outputter<CXX_STD> o;
# endif
#elif DEFAULT_CXX20
-# if CXX_STD <= 201703L
+# if CXX_STD <= CXX_STD_17
Outputter<CXX_STD> o;
# endif
#elif DEFAULT_CXX17
-# if CXX_STD <= 201402L
+# if CXX_STD <= CXX_STD_14
Outputter<CXX_STD> o;
# endif
#elif DEFAULT_CXX14
-# if CXX_STD != 201402L
+# if CXX_STD <= CXX_STD_11
Outputter<CXX_STD> o;
# endif
#elif DEFAULT_CXX11
-# if CXX_STD != 201103L
+# if CXX_STD != CXX_STD_11
Outputter<CXX_STD> o;
# endif
#else
# if !DEFAULT_CXX98
# error Buildsystem error
# endif
-# if CXX_STD != 199711L && CXX_STD != 1 && \
+# if CXX_STD != CXX_STD_98 && CXX_STD != 1 && \
!defined(__GXX_EXPERIMENTAL_CXX0X__)
Outputter<CXX_STD> o;
# endif
diff --git a/Tests/CompileFeatures/default_dialect.cu b/Tests/CompileFeatures/default_dialect.cu
new file mode 100644
index 0000000..a549a5c
--- /dev/null
+++ b/Tests/CompileFeatures/default_dialect.cu
@@ -0,0 +1 @@
+#include "default_dialect.cpp"
diff --git a/Tests/FindBacktrace/CMakeLists.txt b/Tests/FindBacktrace/CMakeLists.txt
new file mode 100644
index 0000000..8ee2a4d
--- /dev/null
+++ b/Tests/FindBacktrace/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindBacktrace.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindBacktrace/Test"
+ "${CMake_BINARY_DIR}/Tests/FindBacktrace/Test"
+ ${build_generator_args}
+ --build-project TestFindBacktrace
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindBacktrace/Test/CMakeLists.txt b/Tests/FindBacktrace/Test/CMakeLists.txt
new file mode 100644
index 0000000..7f5d8ec
--- /dev/null
+++ b/Tests/FindBacktrace/Test/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.29)
+project(TestFindBLAS C)
+include(CTest)
+
+find_package(Backtrace REQUIRED)
+
+add_executable(test_tgt backtrace.c)
+target_link_libraries(test_tgt Backtrace::Backtrace)
+target_compile_options(test_tgt PUBLIC -rdynamic -fno-omit-frame-pointer)
+target_link_options(test_tgt PUBLIC -rdynamic -fno-omit-frame-pointer)
+add_test(NAME test_tgt COMMAND test_tgt)
diff --git a/Tests/FindBacktrace/Test/backtrace.c b/Tests/FindBacktrace/Test/backtrace.c
new file mode 100644
index 0000000..e143bc7
--- /dev/null
+++ b/Tests/FindBacktrace/Test/backtrace.c
@@ -0,0 +1,56 @@
+/* This is the code from `man backtrace_symbols`, reformatted, and without
+ * requiring a command-line argument */
+
+#include <execinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#define BT_BUF_SIZE 100
+
+void myfunc3(void)
+{
+ int nptrs;
+ void* buffer[BT_BUF_SIZE];
+ char** strings;
+ size_t j;
+
+ nptrs = backtrace(buffer, BT_BUF_SIZE);
+ printf("backtrace() returned %d addresses\n", nptrs);
+
+ /* The call backtrace_symbols_fd(buffer, nptrs, STDOUT_FILENO)
+ would produce similar output to the following: */
+
+ strings = backtrace_symbols(buffer, nptrs);
+ if (strings == NULL) {
+ perror("backtrace_symbols");
+ exit(EXIT_FAILURE);
+ }
+
+ for (j = 0; j < nptrs; j++) {
+ printf("%s\n", strings[j]);
+ }
+
+ free(strings);
+}
+
+static void /* "static" means don't export the symbol... */
+myfunc2(void)
+{
+ myfunc3();
+}
+
+void myfunc(int ncalls)
+{
+ if (ncalls > 1) {
+ myfunc(ncalls - 1);
+ } else {
+ myfunc2();
+ }
+}
+
+int main(int argc, char* argv[])
+{
+ myfunc(5);
+ exit(EXIT_SUCCESS);
+}
diff --git a/Tests/FindGTK2/gdk/main.c b/Tests/FindGTK2/gdk/main.c
index 71f523b..2d03fbe 100644
--- a/Tests/FindGTK2/gdk/main.c
+++ b/Tests/FindGTK2/gdk/main.c
@@ -2,6 +2,6 @@
int main(int argc, char* argv[])
{
- gdk_init(argc, argv);
+ gdk_init(&argc, &argv);
return 0;
}
diff --git a/Tests/FindJasper/Test/CMakeLists.txt b/Tests/FindJasper/Test/CMakeLists.txt
index 1e9467d..93873bf 100644
--- a/Tests/FindJasper/Test/CMakeLists.txt
+++ b/Tests/FindJasper/Test/CMakeLists.txt
@@ -4,7 +4,7 @@ include(CTest)
find_package(Jasper)
-add_definitions(-DCMAKE_EXPECTED_JASPER_VERSION=${JASPER_VERSION_STRING})
+add_definitions(-DCMAKE_EXPECTED_JASPER_VERSION="${JASPER_VERSION_STRING}")
add_executable(test_jasper_tgt main.c)
target_link_libraries(test_jasper_tgt Jasper::Jasper)
diff --git a/Tests/FindJasper/Test/main.c b/Tests/FindJasper/Test/main.c
index 242ff7d..b9dbe1e 100644
--- a/Tests/FindJasper/Test/main.c
+++ b/Tests/FindJasper/Test/main.c
@@ -1,17 +1,11 @@
-#include <assert.h>
-// clang-format off
-#include <stdio.h>
#include <jasper/jasper.h>
-// clang-format on
+#include <string.h>
int main(void)
{
- /* Without any JPEG file to open, test that the call fails as
- expected. This tests that linking worked. */
- jas_init();
- jas_image_t* img = jas_image_create0();
- jas_image_destroy(img);
- jas_cleanup();
-
- return (JAS_VERSION != CMAKE_EXPECTED_JASPER_VERSION);
+ jas_conf_clear();
+ jas_conf_set_max_mem_usage(0x100000);
+ jas_init_library();
+ jas_cleanup_library();
+ return strcmp(JAS_VERSION, CMAKE_EXPECTED_JASPER_VERSION);
}
diff --git a/Tests/FindOpenACC/CMakeLists.txt b/Tests/FindOpenACC/CMakeLists.txt
index ef7de65..1b6bcf2 100644
--- a/Tests/FindOpenACC/CMakeLists.txt
+++ b/Tests/FindOpenACC/CMakeLists.txt
@@ -1,11 +1,5 @@
-
-set(langs C CXX)
-if(NOT CMAKE_GENERATOR STREQUAL "Ninja")
- list(APPEND langs Fortran)
-endif()
-
-foreach(lang IN LISTS langs)
- if(CMAKE_${lang}_COMPILER)
+foreach(lang IN ITEMS C CXX Fortran)
+ if(CMake_TEST_FindOpenACC_${lang})
add_test(NAME FindOpenACC.Test${lang} COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt
index ebdb6b8..7ead835 100644
--- a/Tests/FindOpenMP/Test/CMakeLists.txt
+++ b/Tests/FindOpenMP/Test/CMakeLists.txt
@@ -26,8 +26,21 @@ foreach(c C CXX Fortran)
endif()
endforeach()
+if(CMAKE_C_COMPILER_ID STREQUAL "MSVC"
+ AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.30
+ AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64")
+ set(test_msvc_runtime 1)
+ set(OpenMP_RUNTIME_MSVC "llvm")
+endif()
+
find_package(OpenMP REQUIRED)
+if(test_msvc_runtime)
+ if(NOT OpenMP_C_FLAGS STREQUAL "-openmp:llvm")
+ message(FATAL_ERROR "OpenMP_RUNTIME_MSVC='${OpenMP_RUNTIME_MSVC}' not honored: '${OpenMP_C_FLAGS}'")
+ endif()
+endif()
+
foreach(c C CXX Fortran)
if(NOT "${OpenMP_TEST_${c}}")
continue()
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt
index df7cda0..be750e1 100644
--- a/Tests/GeneratorExpression/CMakeLists.txt
+++ b/Tests/GeneratorExpression/CMakeLists.txt
@@ -70,6 +70,7 @@ add_custom_target(check-part1 ALL
-Dtest_strequal_comma=$<STREQUAL:$<COMMA>,$<COMMA>>
-Dtest_strequal_semicolon=$<STREQUAL:$<SEMICOLON>,$<SEMICOLON>>
-Dtest_strequal_angle_r_comma=$<STREQUAL:$<ANGLE-R>,$<COMMA>>
+ -Dtest_strequal_quote=$<STREQUAL:$<QUOTE>,$<QUOTE>>
-Dtest_strequal_both_empty=$<STREQUAL:,>
-Dtest_strequal_one_empty=$<STREQUAL:something,>
-Dtest_inlist_true=$<IN_LIST:a,a$<SEMICOLON>b>
diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake
index 41bcd6d..ddf2507 100644
--- a/Tests/GeneratorExpression/check-part1.cmake
+++ b/Tests/GeneratorExpression/check-part1.cmake
@@ -47,6 +47,7 @@ check(test_strequal_angle_r "1")
check(test_strequal_comma "1")
check(test_strequal_semicolon "1")
check(test_strequal_angle_r_comma "0")
+check(test_strequal_quote "1")
check(test_strequal_both_empty "1")
check(test_strequal_one_empty "0")
check(test_inlist_true "1")
diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt
index baf00d5..201c39e 100644
--- a/Tests/GoogleTest/Test/CMakeLists.txt
+++ b/Tests/GoogleTest/Test/CMakeLists.txt
@@ -81,10 +81,30 @@ gtest_add_tests(test_gtest3 "" AUTO)
if(NOT TEST GoogleTest.Foo)
message(FATAL_ERROR "Test case GoogleTest.Foo not defined")
endif()
+# Check if test has property DEF_SOURCE_LINE
+get_test_property(GoogleTest.Foo DEF_SOURCE_LINE testSourceLineFoo)
+if(NOT testSourceLineFoo)
+ message(FATAL_ERROR "Test GoogleTest.Foo should have DEF_SOURCE_LINE property")
+endif()
+# If check property ends with correct value
+string(FIND "${testSourceLineFoo}" "main3.cxx:3" testSourceLineFooFound)
+if(${testSourceLineFooFound} EQUAL -1)
+ message(FATAL_ERROR "Test GoogleTest.Foo should have DEF_SOURCE_LINE property with value main3.cxx:3")
+endif()
+
if(NOT TEST GoogleTest.Bar)
message(FATAL_ERROR "Test case GoogleTest.Bar not defined")
endif()
-
+# Check if test has property DEF_SOURCE_LINE
+get_test_property(GoogleTest.Bar DEF_SOURCE_LINE testSourceLineBar)
+if(NOT testSourceLineBar)
+ message(FATAL_ERROR "Test GoogleTest.Bar should have DEF_SOURCE_LINE property")
+endif()
+# If check property ends with correct value
+string(FIND "${testSourceLineBar}" "main3.cxx:8" testSourceLineBarFound)
+if(${testSourceLineBarFound} EQUAL -1)
+ message(FATAL_ERROR "Test GoogleTest.Bar should have DEF_SOURCE_LINE property with value main3.cxx:8")
+endif()
# Non-keyword form, explicitly specified sources. Allows a non-target to be
# given for the executable.
diff --git a/Tests/MSVCRuntimeLibrary/CMakeLists.txt b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
index f7d9fec..f1ed9b4 100644
--- a/Tests/MSVCRuntimeLibrary/CMakeLists.txt
+++ b/Tests/MSVCRuntimeLibrary/CMakeLists.txt
@@ -57,10 +57,6 @@ function(verify lang src)
# VS 2005 and above default to multi-threaded.
target_compile_definitions(empty-${lang} PRIVATE VERIFY_MT)
endif()
- if(CMAKE_GENERATOR MATCHES "Visual Studio ([^9]|9[0-9])")
- # VS 2010 and above have a different default runtime library for projects than 'cl'.
- target_compile_definitions(empty-${lang} PRIVATE VERIFY_DLL)
- endif()
endif()
endfunction()
diff --git a/Tests/NasmOnly/CMakeLists.txt b/Tests/NasmOnly/CMakeLists.txt
new file mode 100644
index 0000000..e4190c2
--- /dev/null
+++ b/Tests/NasmOnly/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.28)
+
+project(NasmOnly LANGUAGES ASM_NASM)
+
+add_library(testnasm1 STATIC libnasm1.nasm)
+add_executable(NasmOnly nasmonly.nasm)
+target_link_libraries(NasmOnly testnasm1)
diff --git a/Tests/NasmOnly/libnasm1.nasm b/Tests/NasmOnly/libnasm1.nasm
new file mode 100644
index 0000000..c72a1ad
--- /dev/null
+++ b/Tests/NasmOnly/libnasm1.nasm
@@ -0,0 +1,6 @@
+global LibNasm1Func
+
+section .text
+LibNasm1Func:
+ mov rax, 1
+ ret
diff --git a/Tests/NasmOnly/nasmonly.nasm b/Tests/NasmOnly/nasmonly.nasm
new file mode 100644
index 0000000..db9b655
--- /dev/null
+++ b/Tests/NasmOnly/nasmonly.nasm
@@ -0,0 +1,19 @@
+global _start
+
+extern LibNasm1Func
+
+section .text
+_start:
+ xor rax, rax
+ call LibNasm1Func
+ cmp rax, 1
+ jne err
+
+ mov rax, 60
+ xor rdi, rdi
+ syscall
+
+err:
+ mov rax, 60
+ mov rdi, 1
+ syscall
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test16.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test16.cmake
new file mode 100644
index 0000000..909be6f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test16.cmake
@@ -0,0 +1,38 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(TARGET custom2 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+
+add_subdirectory(subdir-Common-Test16)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test1b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test1b.cmake
new file mode 100644
index 0000000..622633f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test1b.cmake
@@ -0,0 +1,9 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test2b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2b.cmake
new file mode 100644
index 0000000..5317781
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2b.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_source_files_properties(
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTIES GENERATED "1")
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test2c.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2c.cmake
new file mode 100644
index 0000000..2f2d3a2
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2c.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_property(SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED "1")
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test2d.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2d.cmake
new file mode 100644
index 0000000..67f9b8c
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test2d.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_source_files_properties(
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTIES GENERATED "1")
+get_property(prop SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake
index 27516b7..2880aec 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3.cmake
@@ -35,7 +35,7 @@ set_property(SOURCE "Generated_with_full_path2.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_path3.txt")
@@ -61,6 +61,6 @@ set_property(SOURCE "Generated_with_full_source_path2.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake
index 3e03a1f..64294d9 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test3b.cmake
@@ -9,7 +9,7 @@ set_property(SOURCE "Generated_with_full_path2.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_path3.txt")
@@ -35,7 +35,7 @@ set_property(SOURCE "Generated_with_full_source_path2.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
PROPERTY GENERATED "1")
get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake
index 953e26a..dbc603c 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4.cmake
@@ -35,7 +35,7 @@ set_property(SOURCE "Generated_with_full_path2.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_path3.txt")
@@ -61,6 +61,6 @@ set_property(SOURCE "Generated_with_full_source_path2.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake
index 025caa8..833714c 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test4b.cmake
@@ -9,7 +9,7 @@ set_property(SOURCE "Generated_with_full_path2.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_path3.txt")
@@ -35,7 +35,7 @@ set_property(SOURCE "Generated_with_full_source_path2.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
PROPERTY GENERATED "0")
get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake
index 5349bff..549ce1e 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test5.cmake
@@ -65,7 +65,7 @@ set_property(SOURCE "Generated_with_relative_path3.txt"
get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
-set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
PROPERTY GENERATED "tRue")
get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
@@ -73,6 +73,6 @@ set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path
PROPERTY GENERATED "SomeVar-NOTFOUND")
get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
-set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/"Generated_with_full_source_path3.txt"
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
PROPERTY GENERATED "Junk-value")
get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake
index 5cc6e99..e6b3cce 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8.cmake
@@ -27,6 +27,7 @@ target_sources(custom6 PRIVATE
)
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
CONTENT "int func();\nint main(){ return func(); }"
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test8b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8b.cmake
new file mode 100644
index 0000000..704300a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test8b.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test8b)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake
index b7d36ef..e9abf36 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9.cmake
@@ -27,6 +27,7 @@ target_sources(custom6 PRIVATE
)
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
CONTENT "int func();\nint main(){ return func(); }"
diff --git a/Tests/RunCMake/CMP0118/CMP0118-Common-Test9b.cmake b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9b.cmake
new file mode 100644
index 0000000..a452fdb
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-Common-Test9b.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0118-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test9b)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16.cmake
new file mode 100644
index 0000000..74b05c4
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test16.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test16.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-stderr.txt
new file mode 100644
index 0000000..419c571
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0118-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b.cmake
new file mode 100644
index 0000000..30cd6cd
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test1b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test1b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b.cmake
new file mode 100644
index 0000000..27f2a2d
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test2b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c.cmake
new file mode 100644
index 0000000..ade66fd
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2c.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test2c.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d.cmake
new file mode 100644
index 0000000..456760d
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test2d.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test2d.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt
index 929dafd..4175587 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3-stderr.txt
@@ -12,10 +12,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -48,14 +48,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -63,7 +63,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -71,15 +71,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt
index 6a096b8..e9a1ee2 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test3b-stderr.txt
@@ -12,10 +12,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -48,14 +48,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -63,7 +63,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -71,15 +71,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-NEW-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt
index 0e27c1d..686ba23 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test5-stderr.txt
@@ -76,12 +76,12 @@ Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
Unsetting the 'GENERATED' property is not allowed under CMP0118!
@@ -118,7 +118,7 @@ Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -126,7 +126,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -134,7 +134,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -142,7 +142,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -150,7 +150,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -158,15 +158,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
-Call Stack \(most recent call first\):
- CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-NEW-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-NEW-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b-stderr.txt
new file mode 100644
index 0000000..f9ce9be
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b.cmake
new file mode 100644
index 0000000..a39f89f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test8b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test8b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-stderr.txt
new file mode 100644
index 0000000..093f1b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b.cmake b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b.cmake
new file mode 100644
index 0000000..36e30f4
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-NEW-Test9b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 NEW)
+include(CMP0118-Common-Test9b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-stderr.txt
new file mode 100644
index 0000000..2ca118d
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16-stderr.txt
@@ -0,0 +1,38 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test16\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16.cmake
new file mode 100644
index 0000000..c0e40fc
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test16.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test16.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-stderr.txt
new file mode 100644
index 0000000..ad3ea43
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-stderr.txt
@@ -0,0 +1,21 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test1b\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+prop: `NOTFOUND`
+CMake Error at CMP0118-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-OLD-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b.cmake
new file mode 100644
index 0000000..ad1a211
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test1b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test1b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b-stderr.txt
new file mode 100644
index 0000000..41114ba
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test2b\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b.cmake
new file mode 100644
index 0000000..5bfe045
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test2b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c-stderr.txt
new file mode 100644
index 0000000..ba36763
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test2c\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c.cmake
new file mode 100644
index 0000000..e225de4
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2c.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test2c.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d-stderr.txt
new file mode 100644
index 0000000..0a9a8b7
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test2d\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d.cmake
new file mode 100644
index 0000000..ad1c640
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test2d.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test2d.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt
index cce5b19..28fe2f0 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3-stderr.txt
@@ -23,10 +23,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -59,14 +59,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -74,7 +74,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -82,15 +82,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt
index 47eee2e..819b8c0 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test3b-stderr.txt
@@ -23,10 +23,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -59,14 +59,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -74,7 +74,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -82,15 +82,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-OLD-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt
index 4a67fa7..e20ffee 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test5-stderr.txt
@@ -45,12 +45,12 @@ Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
@@ -66,7 +66,7 @@ Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -74,7 +74,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -82,7 +82,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -90,7 +90,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -98,7 +98,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -106,15 +106,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
-Call Stack \(most recent call first\):
- CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-OLD-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-stderr.txt
new file mode 100644
index 0000000..285051c
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-stderr.txt
@@ -0,0 +1,56 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test8b\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0118-Common-Test8b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-OLD-Test8b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b.cmake
new file mode 100644
index 0000000..6676e7c
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test8b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test8b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-stderr.txt
new file mode 100644
index 0000000..9b2fdad
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-stderr.txt
@@ -0,0 +1,72 @@
+^CMake Deprecation Warning at CMP0118-OLD-Test9b\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0118 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b.cmake b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b.cmake
new file mode 100644
index 0000000..3446063
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-OLD-Test9b.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0118 OLD)
+include(CMP0118-Common-Test9b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt
index 93d8b83..9395cd7 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test11-stderr.txt
@@ -1,6 +1,6 @@
^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -9,8 +9,8 @@
This warning is for project developers\. Use -Wno-dev to suppress it\.
+)+
(CMake Warning \(dev\) at CMP0118-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt
index 6d59cb4..957cc69 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test13-stderr.txt
@@ -8,8 +8,8 @@ CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\
TARGET 'custom[4-6]' was not created in this directory\.
+
((CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -18,8 +18,8 @@ CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\
This warning is for project developers\. Use -Wno-dev to suppress it\.
+)+
(CMake Warning \(dev\) at CMP0118-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt
index 9e6a4a5..eab051f 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test15-stderr.txt
@@ -1,6 +1,6 @@
^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -9,8 +9,8 @@
This warning is for project developers\. Use -Wno-dev to suppress it\.
+)+
(CMake Warning \(dev\) at CMP0118-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16.cmake
new file mode 100644
index 0000000..f50df7f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test16.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test16.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-stderr.txt
new file mode 100644
index 0000000..86b9327
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0118-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b.cmake
new file mode 100644
index 0000000..c055570
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test1b.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test1b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b.cmake
new file mode 100644
index 0000000..82a192c
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2b.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test2b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c.cmake
new file mode 100644
index 0000000..ec47683
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2c.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test2c.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d.cmake
new file mode 100644
index 0000000..a5e3fd7
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test2d.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test2d.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt
index 58ba793..491eab0 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3-stderr.txt
@@ -12,10 +12,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -48,14 +48,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -63,7 +63,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -71,15 +71,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN-Test3-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt
index cdb7cb4..e170849 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test3b-stderr.txt
@@ -12,10 +12,10 @@ Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
@@ -48,14 +48,14 @@ Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -63,7 +63,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -71,15 +71,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
-Call Stack \(most recent call first\):
- CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[12]\.txt|CMP0118-WARN-Test3b-build/Generated_with_full_path3\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test3b\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt
index 4cd401c..6340f91 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4-stderr.txt
@@ -1,6 +1,6 @@
^CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -18,8 +18,8 @@ Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -37,8 +37,8 @@ Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -56,8 +56,8 @@ Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -75,8 +75,8 @@ Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -94,8 +94,8 @@ Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -113,8 +113,8 @@ Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -132,8 +132,8 @@ Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -151,8 +151,8 @@ Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt
index 6acd3df..a213ae5 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test4b-stderr.txt
@@ -1,6 +1,6 @@
^CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -18,8 +18,8 @@ Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -37,8 +37,8 @@ Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -56,8 +56,8 @@ Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -75,8 +75,8 @@ Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -94,8 +94,8 @@ Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -113,8 +113,8 @@ Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -132,8 +132,8 @@ Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -151,8 +151,8 @@ Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test4b\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt
index 2805cbf..2f7a390 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test5-stderr.txt
@@ -5,8 +5,8 @@ Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -24,8 +24,8 @@ Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -57,8 +57,8 @@ Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -76,8 +76,8 @@ Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -102,15 +102,15 @@ Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
-Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
-Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -128,8 +128,8 @@ Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
CMake Warning \(dev\) at CMP0118-Common-Test5\.cmake:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -157,7 +157,7 @@ Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -165,7 +165,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -173,7 +173,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -181,7 +181,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -189,7 +189,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
@@ -197,15 +197,7 @@ Call Stack \(most recent call first\):
CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
Cannot find source file:
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
-Call Stack \(most recent call first\):
- CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at CMP0118-Common-Test5\.cmake:[0-9]+ \(target_sources\):
- Cannot find source file:
-
-[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+[ \t]*.*Tests/RunCMake/CMP0118/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
Call Stack \(most recent call first\):
CMP0118-WARN-Test5\.cmake:[0-9]+ \(include\)
CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt
index cde1164..1feef65 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test7-stderr.txt
@@ -1,6 +1,6 @@
^((CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -9,8 +9,8 @@
This warning is for project developers\. Use -Wno-dev to suppress it\.
+)+
(CMake Warning \(dev\) at CMP0118-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-stderr.txt
new file mode 100644
index 0000000..c063326
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0118-Common-Test8b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN-Test8b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b.cmake
new file mode 100644
index 0000000..b44331a
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test8b.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test8b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt
index 547e820..cbce4ab 100644
--- a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9-stderr.txt
@@ -1,6 +1,6 @@
^((CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
@@ -9,8 +9,8 @@
This warning is for project developers\. Use -Wno-dev to suppress it\.
+)+
(CMake Warning \(dev\) at CMP0118-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
- Policy CMP0118 is not set: The GENERATED source file property is now
- visible in all directories\. Run "cmake --help-policy CMP0118" for policy
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
details\. Use the cmake_policy command to set the policy and suppress this
warning\.
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-result.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-stderr.txt b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-stderr.txt
new file mode 100644
index 0000000..878812d
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0118-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b.cmake b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b.cmake
new file mode 100644
index 0000000..9726b30
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/CMP0118-WARN-Test9b.cmake
@@ -0,0 +1 @@
+include(CMP0118-Common-Test9b.cmake)
diff --git a/Tests/RunCMake/CMP0118/CMakeLists.txt b/Tests/RunCMake/CMP0118/CMakeLists.txt
index 957fe03..8bf7896 100644
--- a/Tests/RunCMake/CMP0118/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0118/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
-cmake_policy(SET CMP0115 NEW)
+cmake_policy(SET CMP0115 NEW) # CMP0115 is correct here (for reducing error-output)!
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0118/RunCMakeTest.cmake b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake
index f7f135e..207f3d7 100644
--- a/Tests/RunCMake/CMP0118/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0118/RunCMakeTest.cmake
@@ -5,7 +5,11 @@ run_cmake(GenInSubdir-WARN)
run_cmake(GenInSubdir-NEW)
run_cmake(CMP0118-OLD-Test1)
+run_cmake(CMP0118-OLD-Test1b)
run_cmake(CMP0118-OLD-Test2)
+run_cmake(CMP0118-OLD-Test2b)
+run_cmake(CMP0118-OLD-Test2c)
+run_cmake(CMP0118-OLD-Test2d)
run_cmake(CMP0118-OLD-Test3)
run_cmake(CMP0118-OLD-Test3b)
run_cmake(CMP0118-OLD-Test4)
@@ -14,16 +18,23 @@ run_cmake(CMP0118-OLD-Test5)
run_cmake(CMP0118-OLD-Test6)
run_cmake(CMP0118-OLD-Test7)
run_cmake(CMP0118-OLD-Test8)
+run_cmake(CMP0118-OLD-Test8b)
run_cmake(CMP0118-OLD-Test9)
+run_cmake(CMP0118-OLD-Test9b)
run_cmake(CMP0118-OLD-Test10)
run_cmake(CMP0118-OLD-Test11)
run_cmake(CMP0118-OLD-Test12)
run_cmake(CMP0118-OLD-Test13)
run_cmake(CMP0118-OLD-Test14)
run_cmake(CMP0118-OLD-Test15)
+run_cmake(CMP0118-OLD-Test16)
run_cmake(CMP0118-WARN-Test1)
+run_cmake(CMP0118-WARN-Test1b)
run_cmake(CMP0118-WARN-Test2)
+run_cmake(CMP0118-WARN-Test2b)
+run_cmake(CMP0118-WARN-Test2c)
+run_cmake(CMP0118-WARN-Test2d)
run_cmake(CMP0118-WARN-Test3)
run_cmake(CMP0118-WARN-Test3b)
run_cmake(CMP0118-WARN-Test4)
@@ -32,16 +43,23 @@ run_cmake(CMP0118-WARN-Test5)
run_cmake(CMP0118-WARN-Test6)
run_cmake(CMP0118-WARN-Test7)
run_cmake(CMP0118-WARN-Test8)
+run_cmake(CMP0118-WARN-Test8b)
run_cmake(CMP0118-WARN-Test9)
+run_cmake(CMP0118-WARN-Test9b)
run_cmake(CMP0118-WARN-Test10)
run_cmake(CMP0118-WARN-Test11)
run_cmake(CMP0118-WARN-Test12)
run_cmake(CMP0118-WARN-Test13)
run_cmake(CMP0118-WARN-Test14)
run_cmake(CMP0118-WARN-Test15)
+run_cmake(CMP0118-WARN-Test16)
run_cmake(CMP0118-NEW-Test1)
+run_cmake(CMP0118-NEW-Test1b)
run_cmake(CMP0118-NEW-Test2)
+run_cmake(CMP0118-NEW-Test2b)
+run_cmake(CMP0118-NEW-Test2c)
+run_cmake(CMP0118-NEW-Test2d)
run_cmake(CMP0118-NEW-Test3)
run_cmake(CMP0118-NEW-Test3b)
run_cmake(CMP0118-NEW-Test4)
@@ -50,10 +68,13 @@ run_cmake(CMP0118-NEW-Test5)
run_cmake(CMP0118-NEW-Test6)
run_cmake(CMP0118-NEW-Test7)
run_cmake(CMP0118-NEW-Test8)
+run_cmake(CMP0118-NEW-Test8b)
run_cmake(CMP0118-NEW-Test9)
+run_cmake(CMP0118-NEW-Test9b)
run_cmake(CMP0118-NEW-Test10)
run_cmake(CMP0118-NEW-Test11)
run_cmake(CMP0118-NEW-Test12)
run_cmake(CMP0118-NEW-Test13)
run_cmake(CMP0118-NEW-Test14)
run_cmake(CMP0118-NEW-Test15)
+run_cmake(CMP0118-NEW-Test16)
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt
index f2929aa..7ad02df 100644
--- a/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test13/CMakeLists.txt
@@ -1,13 +1,16 @@
+# Note: Target "custom4" was not created in this directory, so setting this build-event will fail!
add_custom_command(TARGET custom4 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
"${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
)
+# Note: Target "custom5" was not created in this directory, so setting this build-event will fail!
add_custom_command(TARGET custom5 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
"${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
)
+# Note: Target "custom6" was not created in this directory, so setting this build-event will fail!
add_custom_command(TARGET custom6 PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
"${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test16/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test16/CMakeLists.txt
new file mode 100644
index 0000000..877c829
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test16/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+)
+add_custom_command(TARGET custom4 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt
index 55debd1..eefe18c 100644
--- a/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test8/CMakeLists.txt
@@ -1,3 +1,4 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
CONTENT "int func();\nint main(){ return func(); }"
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test8b/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test8b/CMakeLists.txt
new file mode 100644
index 0000000..1e4cccd
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test8b/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt
index cdb8884..99f6d73 100644
--- a/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test9/CMakeLists.txt
@@ -1,3 +1,4 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
CONTENT "int func();\nint main(){ return func(); }"
diff --git a/Tests/RunCMake/CMP0118/subdir-Common-Test9b/CMakeLists.txt b/Tests/RunCMake/CMP0118/subdir-Common-Test9b/CMakeLists.txt
new file mode 100644
index 0000000..f94f36f
--- /dev/null
+++ b/Tests/RunCMake/CMP0118/subdir-Common-Test9b/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-stderr.txt
new file mode 100644
index 0000000..a8b3503
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10-stderr.txt
new file mode 100644
index 0000000..680a830
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test10.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11-stderr.txt
new file mode 100644
index 0000000..7cdc233
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11-stderr.txt
@@ -0,0 +1,55 @@
+^(CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test11.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-stderr.txt
new file mode 100644
index 0000000..6133a35
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test12.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-stderr.txt
new file mode 100644
index 0000000..e65140a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13-stderr.txt
@@ -0,0 +1,64 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test13.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14-stderr.txt
new file mode 100644
index 0000000..680a830
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test14.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15-stderr.txt
new file mode 100644
index 0000000..979481f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15-stderr.txt
@@ -0,0 +1,55 @@
+^(CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test15.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-stderr.txt
new file mode 100644
index 0000000..c18109c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test16.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-stderr.txt
new file mode 100644
index 0000000..fae8bc7
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b.cmake
new file mode 100644
index 0000000..e1b9d22
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test1b.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0118 NEW)
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2a.cmake
new file mode 100644
index 0000000..b1e932c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2a.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM CMP0163_TESTCASE)
+include(${CMAKE_CURRENT_LIST_DIR}/../Test-with-CMP0163-NEW.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2c.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test2d.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-stderr.txt
new file mode 100644
index 0000000..2f90661
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-stderr.txt
new file mode 100644
index 0000000..db40354
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test3b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-stderr.txt
new file mode 100644
index 0000000..9d75891
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4-stderr.txt
@@ -0,0 +1,167 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-stderr.txt
new file mode 100644
index 0000000..c3f35a2
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b-stderr.txt
@@ -0,0 +1,135 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test4b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-stderr.txt
new file mode 100644
index 0000000..779d708
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5-stderr.txt
@@ -0,0 +1,126 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*(Generated_with_relative_path[2-3]\.txt|.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-NEW-Test5-build/Generated_with_full_path[2-3]\.txt))
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test5.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6-stderr.txt
new file mode 100644
index 0000000..ee30636
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test6.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-stderr.txt
new file mode 100644
index 0000000..9ab3d50
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test7.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8-stderr.txt
new file mode 100644
index 0000000..ee30636
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b-stderr.txt
new file mode 100644
index 0000000..f9ce9be
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test8b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-stderr.txt
new file mode 100644
index 0000000..02d9bd3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-stderr.txt
new file mode 100644
index 0000000..672d3b4
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b.cmake
new file mode 100644
index 0000000..2faf482
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-NEW-Test9b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-stderr.txt
new file mode 100644
index 0000000..be3e906
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10-stderr.txt
new file mode 100644
index 0000000..2bd1cba
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test10.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11-stderr.txt
new file mode 100644
index 0000000..02ecd50
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11-stderr.txt
@@ -0,0 +1,55 @@
+^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test11.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-stderr.txt
new file mode 100644
index 0000000..e6c429c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test12.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-stderr.txt
new file mode 100644
index 0000000..fe1ccc3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13-stderr.txt
@@ -0,0 +1,64 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test13.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14-stderr.txt
new file mode 100644
index 0000000..2bd1cba
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test14.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15-stderr.txt
new file mode 100644
index 0000000..b37461a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15-stderr.txt
@@ -0,0 +1,55 @@
+^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test15.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test16.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-stderr.txt
new file mode 100644
index 0000000..9232a57
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b.cmake
new file mode 100644
index 0000000..e1b9d22
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test1b.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0118 NEW)
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2a.cmake
new file mode 100644
index 0000000..60f065c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2a.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_path(GET CMAKE_CURRENT_LIST_FILE FILENAME test_file)
+include(${CMAKE_CURRENT_LIST_DIR}/../${test_file})
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2c.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test2d.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-stderr.txt
new file mode 100644
index 0000000..085f091
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-stderr.txt
new file mode 100644
index 0000000..1c5a178
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test3b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-stderr.txt
new file mode 100644
index 0000000..22ae491
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4-stderr.txt
@@ -0,0 +1,167 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-stderr.txt
new file mode 100644
index 0000000..23dc427
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b-stderr.txt
@@ -0,0 +1,135 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test4b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-stderr.txt
new file mode 100644
index 0000000..ee3ee76
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5-stderr.txt
@@ -0,0 +1,126 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/(Generated_with_relative_path[2-3]\.txt|Generated_with_full_path[2-3]\.txt))
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test5.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6-stderr.txt
new file mode 100644
index 0000000..0c84cfe
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test6.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-stderr.txt
new file mode 100644
index 0000000..ced4fcf
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test7.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8-stderr.txt
new file mode 100644
index 0000000..f723875
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b-stderr.txt
new file mode 100644
index 0000000..f9ce9be
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test8b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-stderr.txt
new file mode 100644
index 0000000..e855458
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-stderr.txt
new file mode 100644
index 0000000..769a3f5
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b.cmake
new file mode 100644
index 0000000..9e979e8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-OLD-Test9b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-stderr.txt
new file mode 100644
index 0000000..4e5f4ac
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10-stderr.txt
new file mode 100644
index 0000000..2bd1cba
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test10.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11-stderr.txt
new file mode 100644
index 0000000..bd98012
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11-stderr.txt
@@ -0,0 +1,55 @@
+^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test11.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-stderr.txt
new file mode 100644
index 0000000..e6c429c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test12.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-stderr.txt
new file mode 100644
index 0000000..6422e36
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13-stderr.txt
@@ -0,0 +1,64 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test13.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14-stderr.txt
new file mode 100644
index 0000000..2bd1cba
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test14.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15-stderr.txt
new file mode 100644
index 0000000..c34acb2
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15-stderr.txt
@@ -0,0 +1,55 @@
+^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test15.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test16.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-stderr.txt
new file mode 100644
index 0000000..9037f5d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b.cmake
new file mode 100644
index 0000000..e1b9d22
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test1b.cmake
@@ -0,0 +1,6 @@
+cmake_policy(SET CMP0118 NEW)
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2a.cmake
new file mode 100644
index 0000000..60f065c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2a.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_path(GET CMAKE_CURRENT_LIST_FILE FILENAME test_file)
+include(${CMAKE_CURRENT_LIST_DIR}/../${test_file})
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2c.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test2d.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-stderr.txt
new file mode 100644
index 0000000..212398e
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-stderr.txt
new file mode 100644
index 0000000..d36919b
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-NEW/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test3b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-stderr.txt
new file mode 100644
index 0000000..0b71575
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4-stderr.txt
@@ -0,0 +1,167 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-stderr.txt
new file mode 100644
index 0000000..0640b89
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b-stderr.txt
@@ -0,0 +1,135 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-NEW/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-NEW/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test4b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-stderr.txt
new file mode 100644
index 0000000..f882081
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5-stderr.txt
@@ -0,0 +1,126 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/(Generated_with_relative_path[2-3]\.txt|Generated_with_full_path[2-3]\.txt))
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test5.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6-stderr.txt
new file mode 100644
index 0000000..0c84cfe
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test6.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-stderr.txt
new file mode 100644
index 0000000..4b7b12e
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test7.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8-stderr.txt
new file mode 100644
index 0000000..f723875
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b-stderr.txt
new file mode 100644
index 0000000..f9ce9be
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test8b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-stderr.txt
new file mode 100644
index 0000000..f8795b9
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-stderr.txt
new file mode 100644
index 0000000..e8c28d3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-NEW/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b.cmake
new file mode 100644
index 0000000..f3ec67a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-NEW/CMP0163-WARN-Test9b.cmake
@@ -0,0 +1,7 @@
+cmake_policy(SET CMP0118 NEW)
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-stderr.txt
new file mode 100644
index 0000000..ca58b9a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10-stderr.txt
new file mode 100644
index 0000000..680a830
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test10.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11-stderr.txt
new file mode 100644
index 0000000..182a43c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11-stderr.txt
@@ -0,0 +1,55 @@
+^(CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test11.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-stderr.txt
new file mode 100644
index 0000000..6133a35
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test12.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-stderr.txt
new file mode 100644
index 0000000..59d81ec
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13-stderr.txt
@@ -0,0 +1,64 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test13.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14-stderr.txt
new file mode 100644
index 0000000..680a830
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14-stderr.txt
@@ -0,0 +1,42 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test14.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15-stderr.txt
new file mode 100644
index 0000000..4c3be67
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15-stderr.txt
@@ -0,0 +1,55 @@
+^(CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test15.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-stderr.txt
new file mode 100644
index 0000000..c18109c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test16.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-stderr.txt
new file mode 100644
index 0000000..b2d0e65
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b.cmake
new file mode 100644
index 0000000..8dc6b3d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test1b.cmake
@@ -0,0 +1,6 @@
+# Leave CMP0118 unset!
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2a.cmake
new file mode 100644
index 0000000..b1e932c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2a.cmake
@@ -0,0 +1,3 @@
+cmake_policy(SET CMP0118 NEW)
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM CMP0163_TESTCASE)
+include(${CMAKE_CURRENT_LIST_DIR}/../Test-with-CMP0163-NEW.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2c.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test2d.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-stderr.txt
new file mode 100644
index 0000000..3298fca
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-stderr.txt
new file mode 100644
index 0000000..0f351ea
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-NEW-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test3b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-stderr.txt
new file mode 100644
index 0000000..ffc7224
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4-stderr.txt
@@ -0,0 +1,126 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-stderr.txt
new file mode 100644
index 0000000..4634ba9
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b-stderr.txt
@@ -0,0 +1,135 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-NEW-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-NEW-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test4b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-stderr.txt
new file mode 100644
index 0000000..4b0961d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5-stderr.txt
@@ -0,0 +1,126 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0163 is set to NEW and the following non-boolean value given for
+ property 'GENERATED' is therefore not allowed:
+
+ Junk-value
+
+ Replace it with a boolean value!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+(CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*(Generated_with_relative_path[2-3]\.txt|.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-NEW-Test5-build/Generated_with_full_path[2-3]\.txt))
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++)+
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test5.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6-stderr.txt
new file mode 100644
index 0000000..ee30636
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test6.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-stderr.txt
new file mode 100644
index 0000000..1e3bc32
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test7.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8-stderr.txt
new file mode 100644
index 0000000..ee30636
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `1`
+Generated_source4\.txt: # 1b # GENERATED = `1`
+Generated_source4\.txt: # 2a # GENERATED = `1`
+Generated_source4\.txt: # 2b # GENERATED = `1`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b-stderr.txt
new file mode 100644
index 0000000..f9ce9be
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b-stderr.txt
@@ -0,0 +1,36 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test8b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-stderr.txt
new file mode 100644
index 0000000..cb63bf3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-stderr.txt
@@ -0,0 +1,74 @@
+^(CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Unsetting the 'GENERATED' property is not allowed under CMP0163!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-stderr.txt
new file mode 100644
index 0000000..2eb755a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-NEW-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b.cmake
new file mode 100644
index 0000000..62e4dc6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-NEW-Test9b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 NEW)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "NEW" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-stderr.txt
new file mode 100644
index 0000000..98b8b6a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-stderr.txt
new file mode 100644
index 0000000..f51de9b
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-stderr.txt
@@ -0,0 +1,51 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test10\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test10\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test10.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-stderr.txt
new file mode 100644
index 0000000..63be2a7
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-stderr.txt
@@ -0,0 +1,90 @@
+^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test11.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-stderr.txt
new file mode 100644
index 0000000..e6c429c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test12.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-stderr.txt
new file mode 100644
index 0000000..3068eb3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13-stderr.txt
@@ -0,0 +1,74 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test13.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-stderr.txt
new file mode 100644
index 0000000..c6ffe0c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-stderr.txt
@@ -0,0 +1,51 @@
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test14\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test14\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test14.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-stderr.txt
new file mode 100644
index 0000000..7ce1d4e
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-stderr.txt
@@ -0,0 +1,90 @@
+^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test15.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test16.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-stderr.txt
new file mode 100644
index 0000000..798641d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b.cmake
new file mode 100644
index 0000000..8dc6b3d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test1b.cmake
@@ -0,0 +1,6 @@
+# Leave CMP0118 unset!
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2a.cmake
new file mode 100644
index 0000000..0729939
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2a.cmake
@@ -0,0 +1,2 @@
+cmake_path(GET CMAKE_CURRENT_LIST_FILE FILENAME test_file)
+include(${CMAKE_CURRENT_LIST_DIR}/../${test_file})
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2c.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test2d.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-stderr.txt
new file mode 100644
index 0000000..9f7d5de
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-stderr.txt
new file mode 100644
index 0000000..81687a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-OLD-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test3b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-stderr.txt
new file mode 100644
index 0000000..9098ddd
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4-stderr.txt
@@ -0,0 +1,212 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-stderr.txt
new file mode 100644
index 0000000..6893cc9
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b-stderr.txt
@@ -0,0 +1,212 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-OLD-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test4b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-stderr.txt
new file mode 100644
index 0000000..7fa3ffe
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5-stderr.txt
@@ -0,0 +1,205 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-OLD-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test5.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-stderr.txt
new file mode 100644
index 0000000..da10641
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test6\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test6\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test6.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-stderr.txt
new file mode 100644
index 0000000..c4ae929
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-stderr.txt
@@ -0,0 +1,100 @@
+^((CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test7.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-stderr.txt
new file mode 100644
index 0000000..5c4014f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test8\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test8\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-stderr.txt
new file mode 100644
index 0000000..81458aa
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test8b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test8b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test8b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-stderr.txt
new file mode 100644
index 0000000..7dbd729
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-stderr.txt
@@ -0,0 +1,84 @@
+^((CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-stderr.txt
new file mode 100644
index 0000000..a03cce0
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-OLD-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b.cmake
new file mode 100644
index 0000000..5069712
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-OLD-Test9b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+cmake_policy(SET CMP0163 OLD)
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "OLD" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-stderr.txt
new file mode 100644
index 0000000..327067d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `0`
+CMake Error at CMP0163-Common-Test1\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test1\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-stderr.txt
new file mode 100644
index 0000000..0a5d4b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-stderr.txt
@@ -0,0 +1,51 @@
+^Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test10\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test10\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test10.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-stderr.txt
new file mode 100644
index 0000000..bffefb6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-stderr.txt
@@ -0,0 +1,90 @@
+^((CMake Warning \(dev\) at subdir-Common-Test11/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test11\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test11\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test11\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test11.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-stderr.txt
new file mode 100644
index 0000000..e6c429c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12-stderr.txt
@@ -0,0 +1,51 @@
+^CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test12/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test12.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-stderr.txt
new file mode 100644
index 0000000..d9ea88e
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13-stderr.txt
@@ -0,0 +1,74 @@
+^CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+CMake Error at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom[4-6]' was not created in this directory\.
++
+(CMake Warning \(dev\) at subdir-Common-Test13/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+(CMake Warning \(dev\) at CMP0163-Common-Test13\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test13\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test13.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-stderr.txt
new file mode 100644
index 0000000..451c413
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-stderr.txt
@@ -0,0 +1,51 @@
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test14\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test14\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test14.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-stderr.txt
new file mode 100644
index 0000000..ac80737
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-stderr.txt
@@ -0,0 +1,90 @@
+^((CMake Warning \(dev\) at subdir-Common-Test15/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test15\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source0\.txt: # 1a # GENERATED = `1`
+Generated_source0\.txt: # 1b # GENERATED = `1`
+Generated_source0\.txt: # 2a # GENERATED = `1`
+Generated_source0\.txt: # 2b # GENERATED = `1`
+Generated_source0\.txt: # 3a # GENERATED = `0`
+Generated_source0\.txt: # 3b # GENERATED = `0`
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test15\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test15\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test15.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-stderr.txt
new file mode 100644
index 0000000..a513b83
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16-stderr.txt
@@ -0,0 +1,27 @@
+^CMake Error at subdir-Common-Test16/CMakeLists\.txt:[0-9]+ \(add_custom_command\):
+ TARGET 'custom4' was not created in this directory\.
++
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test16.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-stderr.txt
new file mode 100644
index 0000000..f7e6846
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-stderr.txt
@@ -0,0 +1,10 @@
+^prop: `NOTFOUND`
+CMake Error at CMP0163-Common-Test1b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b-build/GeneratedMain\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test1b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b.cmake
new file mode 100644
index 0000000..8dc6b3d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test1b.cmake
@@ -0,0 +1,6 @@
+# Leave CMP0118 unset!
+# Extract from the current file the name of the test-case and value for CMP0163 and call the test-case.
+cmake_path(GET CMAKE_CURRENT_LIST_FILE STEM testcase)
+string(REGEX MATCH "NEW|OLD|WARN" value_for_CMP0163 "${testcase}")
+string(REGEX REPLACE "${value_for_CMP0163}" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2a.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2a.cmake
new file mode 100644
index 0000000..0729939
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2a.cmake
@@ -0,0 +1,2 @@
+cmake_path(GET CMAKE_CURRENT_LIST_FILE FILENAME test_file)
+include(${CMAKE_CURRENT_LIST_DIR}/../${test_file})
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2c.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d-stderr.txt
new file mode 100644
index 0000000..403ce5a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d-stderr.txt
@@ -0,0 +1 @@
+^prop: `1`$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test2d.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-stderr.txt
new file mode 100644
index 0000000..1a41192
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-stderr.txt
new file mode 100644
index 0000000..005f005
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b-stderr.txt
@@ -0,0 +1,79 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `1`
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test3b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-2]\.txt|CMP0118-WARN/CMP0163-WARN-Test3b-build/Generated_with_full_path3\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test3b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test3b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-stderr.txt
new file mode 100644
index 0000000..fbdf1da
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4-stderr.txt
@@ -0,0 +1,212 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-stderr.txt
new file mode 100644
index 0000000..caf555c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b-stderr.txt
@@ -0,0 +1,212 @@
+^CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test4b\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test4b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[1-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_full_path1\.txt|CMP0118-WARN/CMP0163-WARN-Test4b-build/Generated_with_relative_path1\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test4b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test4b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-stderr.txt
new file mode 100644
index 0000000..83556e6
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5-stderr.txt
@@ -0,0 +1,205 @@
+^Generated_with_full_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 1a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 1b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_relative_path1\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path1\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_relative_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_relative_path3\.txt: # 3b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path1\.txt: # 2a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 2b # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3a # GENERATED = `1`
+Generated_with_full_source_path1\.txt: # 3b # GENERATED = `1`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path2\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path2\.txt: # 3b # GENERATED = `0`
+CMake Warning \(dev\) at CMP0163-Common-Test5\.cmake:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Attempt to set property 'GENERATED' with the following non-boolean value
+ \(which will be interpreted as "0"\):
+
+ Junk-value
+
+ That exact value will not be retrievable\. A value of "0" will be returned
+ instead\.
+
+ This will be an error under policy CMP0118\.
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++
+Generated_with_full_source_path3\.txt: # 1a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 1b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 2b # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3a # GENERATED = `0`
+Generated_with_full_source_path3\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test5\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/(Generated_with_full_source_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_relative_path[2-3]\.txt|CMP0118-WARN/CMP0163-WARN-Test5-build/Generated_with_full_path[2-3]\.txt)
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test5\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test5.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-stderr.txt
new file mode 100644
index 0000000..08711ab
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test6\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test6\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test6.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-stderr.txt
new file mode 100644
index 0000000..9d8af4f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-stderr.txt
@@ -0,0 +1,100 @@
+^((CMake Warning \(dev\) at subdir-Common-Test7/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test7\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `1`
+Generated_source1\.txt: # 1b # GENERATED = `1`
+Generated_source1\.txt: # 2a # GENERATED = `1`
+Generated_source1\.txt: # 2b # GENERATED = `1`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test7\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7-build/Generated_source[2-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test7\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test7.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-stderr.txt
new file mode 100644
index 0000000..4928234
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `1`
+Generated_source2\.txt: # 1b # GENERATED = `1`
+Generated_source2\.txt: # 2a # GENERATED = `1`
+Generated_source2\.txt: # 2b # GENERATED = `1`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `1`
+Generated_source3\.txt: # 1b # GENERATED = `1`
+Generated_source3\.txt: # 2a # GENERATED = `1`
+Generated_source3\.txt: # 2b # GENERATED = `1`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `1`
+Generated_source5\.txt: # 1b # GENERATED = `1`
+Generated_source5\.txt: # 2a # GENERATED = `1`
+Generated_source5\.txt: # 2b # GENERATED = `1`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `1`
+Generated_source6\.txt: # 1b # GENERATED = `1`
+Generated_source6\.txt: # 2a # GENERATED = `1`
+Generated_source6\.txt: # 2b # GENERATED = `1`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test8\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8-build/Generated_source4\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test8\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-stderr.txt
new file mode 100644
index 0000000..200a180
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-stderr.txt
@@ -0,0 +1,45 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test8b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test8b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test8b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-stderr.txt
new file mode 100644
index 0000000..4d35ef0
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-stderr.txt
@@ -0,0 +1,84 @@
+^((CMake Warning \(dev\) at subdir-Common-Test9/CMakeLists\.txt:[0-9]+ \(set_property\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+
+(CMake Warning \(dev\) at CMP0163-Common-Test9\.cmake:[0-9]+ \(add_subdirectory\):
+ Policy CMP0118 is not set: GENERATED sources may be used across directories
+ without manual marking\. Run "cmake --help-policy CMP0118" for policy
+ details\. Use the cmake_policy command to set the policy and suppress this
+ warning\.
+
+ Unsetting property 'GENERATED' will not be allowed under policy CMP0118!
+
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
++)+)+
+Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-result.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-stderr.txt b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-stderr.txt
new file mode 100644
index 0000000..ed65a7c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-stderr.txt
@@ -0,0 +1,61 @@
+^Generated_source1\.txt: # 1a # GENERATED = `0`
+Generated_source1\.txt: # 1b # GENERATED = `0`
+Generated_source1\.txt: # 2a # GENERATED = `0`
+Generated_source1\.txt: # 2b # GENERATED = `0`
+Generated_source1\.txt: # 3a # GENERATED = `0`
+Generated_source1\.txt: # 3b # GENERATED = `0`
+Generated_source2\.txt: # 1a # GENERATED = `0`
+Generated_source2\.txt: # 1b # GENERATED = `0`
+Generated_source2\.txt: # 2a # GENERATED = `0`
+Generated_source2\.txt: # 2b # GENERATED = `0`
+Generated_source2\.txt: # 3a # GENERATED = `0`
+Generated_source2\.txt: # 3b # GENERATED = `0`
+Generated_source3\.txt: # 1a # GENERATED = `0`
+Generated_source3\.txt: # 1b # GENERATED = `0`
+Generated_source3\.txt: # 2a # GENERATED = `0`
+Generated_source3\.txt: # 2b # GENERATED = `0`
+Generated_source3\.txt: # 3a # GENERATED = `0`
+Generated_source3\.txt: # 3b # GENERATED = `0`
+Generated_source4\.txt: # 1a # GENERATED = `0`
+Generated_source4\.txt: # 1b # GENERATED = `0`
+Generated_source4\.txt: # 2a # GENERATED = `0`
+Generated_source4\.txt: # 2b # GENERATED = `0`
+Generated_source4\.txt: # 3a # GENERATED = `0`
+Generated_source4\.txt: # 3b # GENERATED = `0`
+Generated_source5\.txt: # 1a # GENERATED = `0`
+Generated_source5\.txt: # 1b # GENERATED = `0`
+Generated_source5\.txt: # 2a # GENERATED = `0`
+Generated_source5\.txt: # 2b # GENERATED = `0`
+Generated_source5\.txt: # 3a # GENERATED = `0`
+Generated_source5\.txt: # 3b # GENERATED = `0`
+Generated_source6\.txt: # 1a # GENERATED = `0`
+Generated_source6\.txt: # 1b # GENERATED = `0`
+Generated_source6\.txt: # 2a # GENERATED = `0`
+Generated_source6\.txt: # 2b # GENERATED = `0`
+Generated_source6\.txt: # 3a # GENERATED = `0`
+Generated_source6\.txt: # 3b # GENERATED = `0`
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at CMP0163-Common-Test9b\.cmake:[0-9]+ \(target_sources\):
+ Cannot find source file:
+
+[ \t]*.*Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b-build/Generated_source[4-6]\.txt
+Call Stack \(most recent call first\):
+ CMP0118-WARN/CMP0163-WARN-Test9b\.cmake:[0-9]+ \(include\)
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Generate step failed\. Build files cannot be regenerated correctly\.$
diff --git a/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b.cmake
new file mode 100644
index 0000000..c0327b8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0118-WARN/CMP0163-WARN-Test9b.cmake
@@ -0,0 +1,7 @@
+# Leave CMP0118 unset!
+# Leave CMP0163 unset!
+
+# Call the associated test.
+cmake_path(GET RunCMake_TEST STEM testcase)
+string(REGEX REPLACE "WARN" "Common" testcase "${testcase}")
+include(${CMAKE_CURRENT_LIST_DIR}/../${testcase}.cmake)
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Helper.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Helper.cmake
new file mode 100644
index 0000000..b237b7f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Helper.cmake
@@ -0,0 +1,14 @@
+macro(get_and_print_GENERATED_property filename)
+ get_property(prop SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${filename}" PROPERTY GENERATED)
+ message(NOTICE "${filename}: # 1a # GENERATED = `${prop}`")
+ get_source_file_property(prop "${CMAKE_CURRENT_BINARY_DIR}/${filename}" GENERATED)
+ message(NOTICE "${filename}: # 1b # GENERATED = `${prop}`")
+ get_property(prop SOURCE "${filename}" PROPERTY GENERATED)
+ message(NOTICE "${filename}: # 2a # GENERATED = `${prop}`")
+ get_source_file_property(prop "${filename}" GENERATED)
+ message(NOTICE "${filename}: # 2b # GENERATED = `${prop}`")
+ get_property(prop SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/${filename}" PROPERTY GENERATED)
+ message(NOTICE "${filename}: # 3a # GENERATED = `${prop}`")
+ get_source_file_property(prop "${CMAKE_CURRENT_SOURCE_DIR}/${filename}" GENERATED)
+ message(NOTICE "${filename}: # 3b # GENERATED = `${prop}`")
+endmacro()
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test1.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test1.cmake
new file mode 100644
index 0000000..2b66515
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test1.cmake
@@ -0,0 +1,9 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+get_property(prop SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test10.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test10.cmake
new file mode 100644
index 0000000..97984d8
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test10.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test10)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test11.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test11.cmake
new file mode 100644
index 0000000..59d92f4
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test11.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test11)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test12.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test12.cmake
new file mode 100644
index 0000000..9d514f0
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test12.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_command(TARGET custom0 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_command(TARGET custom1 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(TARGET custom2 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_command(TARGET custom3 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test12)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test13.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test13.cmake
new file mode 100644
index 0000000..b79f369
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test13.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_command(TARGET custom0 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_command(TARGET custom1 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(TARGET custom2 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_command(TARGET custom3 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test13)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test14.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test14.cmake
new file mode 100644
index 0000000..203b114
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test14.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_target(custom0_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_target(custom1_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test14)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test15.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test15.cmake
new file mode 100644
index 0000000..f66011a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test15.cmake
@@ -0,0 +1,65 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+# The sources of custom0 will not be modified by set_property!
+add_custom_target(custom0)
+target_sources(custom0 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+# The sources of custom[1-6] will (tried to) be modified by set_property!
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+add_custom_target(custom0_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source0.txt"
+)
+add_custom_target(custom1_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+
+add_subdirectory(subdir-Common-Test15)
+
+get_and_print_GENERATED_property("Generated_source0.txt")
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test16.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test16.cmake
new file mode 100644
index 0000000..3c63277
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test16.cmake
@@ -0,0 +1,38 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+
+
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_command(TARGET custom2 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+
+add_subdirectory(subdir-Common-Test16)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test1b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test1b.cmake
new file mode 100644
index 0000000..622633f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test1b.cmake
@@ -0,0 +1,9 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test2.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2.cmake
new file mode 100644
index 0000000..1180b6b
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_property(SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED "1")
+get_property(prop SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test2b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2b.cmake
new file mode 100644
index 0000000..5317781
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2b.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_source_files_properties(
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTIES GENERATED "1")
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test2c.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2c.cmake
new file mode 100644
index 0000000..2f2d3a2
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2c.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_property(SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED "1")
+get_source_file_property(prop
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test2d.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2d.cmake
new file mode 100644
index 0000000..67f9b8c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test2d.cmake
@@ -0,0 +1,12 @@
+add_custom_target(custom)
+target_sources(custom PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+)
+
+set_source_files_properties(
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTIES GENERATED "1")
+get_property(prop SOURCE
+ "${CMAKE_CURRENT_BINARY_DIR}/GeneratedMain.txt"
+ PROPERTY GENERATED)
+message(NOTICE "prop: `${prop}`")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test3.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test3.cmake
new file mode 100644
index 0000000..ce47460
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test3.cmake
@@ -0,0 +1,66 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "Generated_with_relative_path1.txt"
+ "Generated_with_relative_path2.txt"
+ "Generated_with_relative_path3.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path1.txt")
+
+set_property(SOURCE "Generated_with_full_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path1.txt")
+
+set_property(SOURCE "Generated_with_relative_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
+
+set_property(SOURCE "Generated_with_full_source_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test3b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test3b.cmake
new file mode 100644
index 0000000..8dda231
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test3b.cmake
@@ -0,0 +1,66 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path1.txt")
+
+set_property(SOURCE "Generated_with_full_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path1.txt")
+
+set_property(SOURCE "Generated_with_relative_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
+
+set_property(SOURCE "Generated_with_full_source_path2.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+ PROPERTY GENERATED "1")
+get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "Generated_with_relative_path1.txt"
+ "Generated_with_relative_path2.txt"
+ "Generated_with_relative_path3.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+)
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test4.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test4.cmake
new file mode 100644
index 0000000..8de4f04
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test4.cmake
@@ -0,0 +1,66 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "Generated_with_relative_path1.txt"
+ "Generated_with_relative_path2.txt"
+ "Generated_with_relative_path3.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path1.txt")
+
+set_property(SOURCE "Generated_with_full_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path1.txt")
+
+set_property(SOURCE "Generated_with_relative_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
+
+set_property(SOURCE "Generated_with_full_source_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test4b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test4b.cmake
new file mode 100644
index 0000000..d218f5d
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test4b.cmake
@@ -0,0 +1,66 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path1.txt")
+
+set_property(SOURCE "Generated_with_full_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_relative_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path1.txt")
+
+set_property(SOURCE "Generated_with_relative_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_relative_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_source_path1.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
+
+set_property(SOURCE "Generated_with_full_source_path2.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+ PROPERTY GENERATED "0")
+get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "Generated_with_relative_path1.txt"
+ "Generated_with_relative_path2.txt"
+ "Generated_with_relative_path3.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+)
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test5.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test5.cmake
new file mode 100644
index 0000000..235e5e5
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test5.cmake
@@ -0,0 +1,78 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "Generated_with_relative_path1.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "Generated_with_relative_path2.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "Generated_with_relative_path3.txt"
+)
+add_custom_target(custom7)
+target_sources(custom7 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+)
+add_custom_target(custom8)
+target_sources(custom8 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+)
+add_custom_target(custom9)
+target_sources(custom9 PRIVATE
+ "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path1.txt"
+ PROPERTY GENERATED "tRue")
+get_and_print_GENERATED_property("Generated_with_full_path1.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path2.txt"
+ PROPERTY GENERATED "SomeVar-NOTFOUND")
+get_and_print_GENERATED_property("Generated_with_full_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_with_full_path3.txt"
+ PROPERTY GENERATED "Junk-value")
+get_and_print_GENERATED_property("Generated_with_full_path3.txt")
+
+
+set_property(SOURCE "Generated_with_relative_path1.txt"
+ PROPERTY GENERATED "tRue")
+get_and_print_GENERATED_property("Generated_with_relative_path1.txt")
+
+set_property(SOURCE "Generated_with_relative_path2.txt"
+ PROPERTY GENERATED "SomeVar-NOTFOUND")
+get_and_print_GENERATED_property("Generated_with_relative_path2.txt")
+
+set_property(SOURCE "Generated_with_relative_path3.txt"
+ PROPERTY GENERATED "Junk-value")
+get_and_print_GENERATED_property("Generated_with_relative_path3.txt")
+
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path1.txt"
+ PROPERTY GENERATED "tRue")
+get_and_print_GENERATED_property("Generated_with_full_source_path1.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path2.txt"
+ PROPERTY GENERATED "SomeVar-NOTFOUND")
+get_and_print_GENERATED_property("Generated_with_full_source_path2.txt")
+
+set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/Generated_with_full_source_path3.txt"
+ PROPERTY GENERATED "Junk-value")
+get_and_print_GENERATED_property("Generated_with_full_source_path3.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test6.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test6.cmake
new file mode 100644
index 0000000..b89af65
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test6.cmake
@@ -0,0 +1,44 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ PROPERTY GENERATED "1")
+
+add_subdirectory(subdir-Common-Test6)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test7.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test7.cmake
new file mode 100644
index 0000000..d1586f5
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test7.cmake
@@ -0,0 +1,44 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ PROPERTY GENERATED "1")
+
+add_subdirectory(subdir-Common-Test7)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test8.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test8.cmake
new file mode 100644
index 0000000..c2bfd03
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test8.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test8)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test8b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test8b.cmake
new file mode 100644
index 0000000..cba4817
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test8b.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test8b)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test9.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test9.cmake
new file mode 100644
index 0000000..dd2e128
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test9.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test9)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMP0163-Common-Test9b.cmake b/Tests/RunCMake/CMP0163/CMP0163-Common-Test9b.cmake
new file mode 100644
index 0000000..c7d494c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMP0163-Common-Test9b.cmake
@@ -0,0 +1,51 @@
+include(${CMAKE_CURRENT_LIST_DIR}/CMP0163-Common-Helper.cmake)
+
+
+add_custom_target(custom1)
+target_sources(custom1 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+)
+add_custom_target(custom2)
+target_sources(custom2 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+)
+add_custom_target(custom3)
+target_sources(custom3 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+)
+add_custom_target(custom4)
+target_sources(custom4 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+)
+add_custom_target(custom5)
+target_sources(custom5 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+)
+add_custom_target(custom6)
+target_sources(custom6 PRIVATE
+ "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+)
+
+
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source1.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source2.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source3.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+add_subdirectory(subdir-Common-Test9b)
+
+get_and_print_GENERATED_property("Generated_source1.txt")
+get_and_print_GENERATED_property("Generated_source2.txt")
+get_and_print_GENERATED_property("Generated_source3.txt")
+get_and_print_GENERATED_property("Generated_source4.txt")
+get_and_print_GENERATED_property("Generated_source5.txt")
+get_and_print_GENERATED_property("Generated_source6.txt")
diff --git a/Tests/RunCMake/CMP0163/CMakeLists.txt b/Tests/RunCMake/CMP0163/CMakeLists.txt
new file mode 100644
index 0000000..4ae248a
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.19) # Must be older than 3.20 in order to also not set CMP0118!
+cmake_policy(SET CMP0115 NEW) # CMP0115 is correct here (for reducing error-output)!
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/CMP0163/RunCMakeTest.cmake b/Tests/RunCMake/CMP0163/RunCMakeTest.cmake
new file mode 100644
index 0000000..edfe130
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/RunCMakeTest.cmake
@@ -0,0 +1,147 @@
+include(RunCMake)
+
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test1)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test1b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test2)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test2b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test2c)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test2d)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test3)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test3b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test4)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test4b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test5)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test6)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test7)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test8)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test8b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test9)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test9b)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test10)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test11)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test12)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test13)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test14)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test15)
+run_cmake(CMP0118-WARN/CMP0163-OLD-Test16)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test1)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test1b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test2)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test2b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test2c)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test2d)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test3)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test3b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test4)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test4b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test5)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test6)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test7)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test8)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test8b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test9)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test9b)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test10)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test11)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test12)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test13)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test14)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test15)
+run_cmake(CMP0118-WARN/CMP0163-WARN-Test16)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test1)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test1b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test2)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test2b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test2c)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test2d)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test3)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test3b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test4)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test4b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test5)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test6)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test7)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test8)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test8b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test9)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test9b)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test10)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test11)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test12)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test13)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test14)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test15)
+run_cmake(CMP0118-WARN/CMP0163-NEW-Test16)
+
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test1)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test1b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test2)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test2b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test2c)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test2d)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test3)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test3b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test4)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test4b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test5)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test6)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test7)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test8)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test8b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test9)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test9b)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test10)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test11)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test12)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test13)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test14)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test15)
+run_cmake(CMP0118-NEW/CMP0163-OLD-Test16)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test1)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test1b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test2)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test2b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test2c)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test2d)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test3)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test3b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test4)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test4b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test5)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test6)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test7)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test8)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test8b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test9)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test9b)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test10)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test11)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test12)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test13)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test14)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test15)
+run_cmake(CMP0118-NEW/CMP0163-WARN-Test16)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test1)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test1b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test2)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test2b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test2c)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test2d)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test3)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test3b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test4)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test4b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test5)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test6)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test7)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test8)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test8b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test9)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test9b)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test10)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test11)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test12)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test13)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test14)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test15)
+run_cmake(CMP0118-NEW/CMP0163-NEW-Test16)
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test10/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test10/CMakeLists.txt
new file mode 100644
index 0000000..6bc99cb
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test10/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test11/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test11/CMakeLists.txt
new file mode 100644
index 0000000..fbd7e6f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test11/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test12/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test12/CMakeLists.txt
new file mode 100644
index 0000000..916725c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test12/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_custom_command(TARGET custom4 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+add_custom_command(TARGET custom5 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+add_custom_command(TARGET custom6 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test13/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test13/CMakeLists.txt
new file mode 100644
index 0000000..7ad02df
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test13/CMakeLists.txt
@@ -0,0 +1,36 @@
+# Note: Target "custom4" was not created in this directory, so setting this build-event will fail!
+add_custom_command(TARGET custom4 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+# Note: Target "custom5" was not created in this directory, so setting this build-event will fail!
+add_custom_command(TARGET custom5 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+# Note: Target "custom6" was not created in this directory, so setting this build-event will fail!
+add_custom_command(TARGET custom6 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test14/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test14/CMakeLists.txt
new file mode 100644
index 0000000..7397db9
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test14/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_custom_target(custom4_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+add_custom_target(custom5_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+add_custom_target(custom6_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test15/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test15/CMakeLists.txt
new file mode 100644
index 0000000..314e427
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test15/CMakeLists.txt
@@ -0,0 +1,33 @@
+add_custom_target(custom4_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
+add_custom_target(custom5_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+)
+add_custom_target(custom6_source_generator ALL
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test16/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test16/CMakeLists.txt
new file mode 100644
index 0000000..877c829
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test16/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+)
+add_custom_command(TARGET custom4 PRE_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/Source.txt.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ BYPRODUCT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+)
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test6/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test6/CMakeLists.txt
new file mode 100644
index 0000000..fa307d1
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test6/CMakeLists.txt
@@ -0,0 +1,16 @@
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test7/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test7/CMakeLists.txt
new file mode 100644
index 0000000..6362f78
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test7/CMakeLists.txt
@@ -0,0 +1,16 @@
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test8/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test8/CMakeLists.txt
new file mode 100644
index 0000000..eefe18c
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test8/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "1")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "1")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test8b/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test8b/CMakeLists.txt
new file mode 100644
index 0000000..1e4cccd
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test8b/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test9/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test9/CMakeLists.txt
new file mode 100644
index 0000000..99f6d73
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test9/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+
+
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source1.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source2.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source3.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source4.txt"
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source5.txt"
+ DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
+ PROPERTY GENERATED "0")
+set_property(SOURCE "${CMAKE_CURRENT_BINARY_DIR}/../Generated_source6.txt"
+ TARGET_DIRECTORY custom1
+ PROPERTY GENERATED "0")
diff --git a/Tests/RunCMake/CMP0163/subdir-Common-Test9b/CMakeLists.txt b/Tests/RunCMake/CMP0163/subdir-Common-Test9b/CMakeLists.txt
new file mode 100644
index 0000000..f94f36f
--- /dev/null
+++ b/Tests/RunCMake/CMP0163/subdir-Common-Test9b/CMakeLists.txt
@@ -0,0 +1,13 @@
+# Note: Currently, `file(GENERATE)` does not set the `GENERATED` property!
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source4.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source5.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
+file(GENERATE
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Generated_source6.txt"
+ CONTENT "int func();\nint main(){ return func(); }"
+)
diff --git a/Tests/RunCMake/CMP0165/CMP0165-NEW-result.txt b/Tests/RunCMake/CMP0165/CMP0165-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0165/CMP0165-NEW-stderr.txt b/Tests/RunCMake/CMP0165/CMP0165-NEW-stderr.txt
new file mode 100644
index 0000000..662d8ad
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-NEW-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at CMP0165-NEW\.cmake:[0-9]+ \(enable_language\):
+ project\(\) must be called prior to this enable_language\(\) call\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0165/CMP0165-NEW.cmake b/Tests/RunCMake/CMP0165/CMP0165-NEW.cmake
new file mode 100644
index 0000000..8bcb3fd
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0165 NEW)
+enable_language(C)
diff --git a/Tests/RunCMake/CMP0165/CMP0165-OLD.cmake b/Tests/RunCMake/CMP0165/CMP0165-OLD.cmake
new file mode 100644
index 0000000..c80ba76
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0165 OLD)
+enable_language(C)
diff --git a/Tests/RunCMake/CMP0165/CMP0165-WARN-stderr.txt b/Tests/RunCMake/CMP0165/CMP0165-WARN-stderr.txt
new file mode 100644
index 0000000..32a79df
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-WARN-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning \(dev\) at CMP0165-WARN\.cmake:[0-9]+ \(enable_language\):
+ project\(\) should be called prior to this enable_language\(\) call\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
diff --git a/Tests/RunCMake/CMP0165/CMP0165-WARN.cmake b/Tests/RunCMake/CMP0165/CMP0165-WARN.cmake
new file mode 100644
index 0000000..75149dd
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMP0165-WARN.cmake
@@ -0,0 +1,2 @@
+# Don't touch the policy, it should warn by default
+enable_language(C)
diff --git a/Tests/RunCMake/CMP0165/CMakeLists.txt b/Tests/RunCMake/CMP0165/CMakeLists.txt
new file mode 100644
index 0000000..2fa8c4e
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.29)
+
+# This is different to the usual RunCMake test pattern. We are specifically
+# testing the scenario where enable_language() is called before project().
+include(${RunCMake_TEST}.cmake)
+
+project(${RunCMake_TEST} NONE)
diff --git a/Tests/RunCMake/CMP0165/RunCMakeTest.cmake b/Tests/RunCMake/CMP0165/RunCMakeTest.cmake
new file mode 100644
index 0000000..f5f167c
--- /dev/null
+++ b/Tests/RunCMake/CMP0165/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0165-WARN)
+run_cmake(CMP0165-OLD)
+run_cmake(CMP0165-NEW)
diff --git a/Tests/RunCMake/CMakeDependentOption/Regex-CMP0127-OLD-stderr.txt b/Tests/RunCMake/CMakeDependentOption/Regex-CMP0127-OLD-stderr.txt
new file mode 100644
index 0000000..1953091
--- /dev/null
+++ b/Tests/RunCMake/CMakeDependentOption/Regex-CMP0127-OLD-stderr.txt
@@ -0,0 +1,9 @@
+^CMake Deprecation Warning at [^
+]*/Tests/RunCMake/CMakeDependentOption/Regex-CMP0127-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0127 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.$
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index f10e72d..005bd17 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -173,6 +173,8 @@ add_RunCMake_test(CMP0153)
add_RunCMake_test(CMP0156 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
add_RunCMake_test(CMP0160)
+add_RunCMake_test(CMP0163)
+add_RunCMake_test(CMP0165)
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
@@ -438,6 +440,16 @@ add_RunCMake_test(GoogleTest # Note: does not actually depend on Google Test
)
add_RunCMake_test(Graphviz)
add_RunCMake_test(Languages)
+
+add_RunCMake_test(LanguageStandards
+ -DCMake_NO_C_STANDARD=${CMake_NO_C_STANDARD}
+ -DCMake_NO_CXX_STANDARD=${CMake_NO_CXX_STANDARD}
+ -DCMake_TEST_CUDA=${CMake_TEST_CUDA}
+ -DCMake_TEST_HIP=${CMake_TEST_HIP}
+ -DCMake_TEST_OBJC=${CMake_TEST_OBJC}
+)
+set_property(TEST RunCMake.LanguageStandards APPEND PROPERTY LABELS "CUDA" "HIP")
+
add_RunCMake_test(LinkItemValidation)
add_RunCMake_test(LinkStatic)
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Cray|PGI|NVHPC|XL|XLClang|IBMClang|Fujitsu|FujitsuClang)$")
@@ -553,13 +565,17 @@ add_RunCMake_test(file-CHMOD -DMSYS=${MSYS})
foreach(var
CMake_TEST_NO_NETWORK
CMake_TEST_TLS_VERIFY_URL
+ CMake_TEST_TLS_VERSION
)
if(DEFINED ${var})
list(APPEND file-DOWNLOAD_ARGS -D${var}=${${var}})
endif()
endforeach()
add_RunCMake_test(file-DOWNLOAD)
-add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
+add_RunCMake_test(file-RPATH
+ -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ -DCMake_TEST_ELF_LARGE=${CMake_TEST_ELF_LARGE}
+)
add_RunCMake_test(file-STRINGS)
add_RunCMake_test(find_file -DMINGW=${MINGW})
add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DMSVC=${MSVC})
@@ -731,6 +747,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])")
-DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION}
)
+ add_RunCMake_test(VS10ProjectUseDebugLibraries)
if( vs12 AND wince )
add_RunCMake_test( VS10ProjectWinCE "-DRunCMake_GENERATOR_PLATFORM=${wince_sdk}")
endif()
@@ -1080,11 +1097,22 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k" AND NOT DEFINED CMake_TEST_E2K_BROKEN_L
DEB.CUSTOM_NAMES
DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY
DEB.PROJECT_META DEB.DEPENDENCIES
+ DEB.EXTRA
+ DEB.GENERATE_SHLIBS_LDCONFIG
+ DEB.LONG_FILENAMES
+ DEB.MD5SUMS
+ DEB.EMPTY_DIR
+ DEB.DEFAULT_PERMISSIONS
+ DEB.VERSION
+ DEB.TIMESTAMPS
RPM.PARTIALLY_RELOCATABLE_WARNING
RPM.PER_COMPONENT_FIELDS
RPM.USER_FILELIST
RPM.DIST
RPM.AUTO_SUFFIXES
+ 7Z
+ TXZ
+ TBZ2
TGZ
ZIP
STGZ
@@ -1095,6 +1123,14 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k" AND NOT DEFINED CMake_TEST_E2K_BROKEN_L
endif()
add_RunCMake_test_group(CPack "${cpack_tests}")
+
+if(CMake_TEST_CPACK_WIX3 OR CMake_TEST_CPACK_WIX4)
+ add_RunCMake_test(CPack_WIX
+ -DCMake_TEST_CPACK_WIX3=${CMake_TEST_CPACK_WIX3}
+ -DCMake_TEST_CPACK_WIX4=${CMake_TEST_CPACK_WIX4}
+ )
+endif()
+
# add a test to make sure symbols are exported from a shared library
# for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used
add_RunCMake_test(AutoExportDll
diff --git a/Tests/RunCMake/CMakePackage/NestedConfigFile-stdout.txt b/Tests/RunCMake/CMakePackage/NestedConfigFile-stdout.txt
new file mode 100644
index 0000000..cdb3384
--- /dev/null
+++ b/Tests/RunCMake/CMakePackage/NestedConfigFile-stdout.txt
@@ -0,0 +1,6 @@
+(-- )?Before find_dependency: PACKAGE_PREFIX_DIR = .*/Tests/RunCMake/CMakePackage/NestedConfigFile-build/install_pkg_b
+(-- )?Hello from pkg_a
+(-- )?Leaving pkg_a-config\.cmake with PACKAGE_PREFIX_DIR = .*/Tests/RunCMake/CMakePackage/NestedConfigFile-build/install_pkg_a
+(-- )?After find_dependency: PACKAGE_PREFIX_DIR = .*/Tests/RunCMake/CMakePackage/NestedConfigFile-build/install_pkg_b
+(-- )?Hello from pkg_b
+(-- )?Leaving pkg_b-config\.cmake with PACKAGE_PREFIX_DIR = .*/Tests/RunCMake/CMakePackage/NestedConfigFile-build/install_pkg_b
diff --git a/Tests/RunCMake/CMakePackage/NestedConfigFile.cmake b/Tests/RunCMake/CMakePackage/NestedConfigFile.cmake
new file mode 100644
index 0000000..2eeaebb
--- /dev/null
+++ b/Tests/RunCMake/CMakePackage/NestedConfigFile.cmake
@@ -0,0 +1,43 @@
+set(CMAKE_INSTALL_DATADIR share)
+
+include(CMakePackageConfigHelpers)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg_a-config.cmake.in [[
+@PACKAGE_INIT@
+include("@PACKAGE_CMAKE_INSTALL_DATADIR@/pkg_a_included.cmake")
+message(STATUS "Leaving pkg_a-config.cmake with PACKAGE_PREFIX_DIR = ${PACKAGE_PREFIX_DIR}")
+]])
+configure_package_config_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/pkg_a-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/install_pkg_a/pkg_a-config.cmake
+ INSTALL_DESTINATION .
+ PATH_VARS CMAKE_INSTALL_DATADIR
+)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_pkg_a/share/pkg_a_included.cmake
+ [[message(STATUS "Hello from pkg_a")]]
+)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg_b-config.cmake.in [[
+@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+message(STATUS "Before find_dependency: PACKAGE_PREFIX_DIR = ${PACKAGE_PREFIX_DIR}")
+find_dependency(pkg_a NO_DEFAULT_PATH
+ PATHS "@CMAKE_CURRENT_BINARY_DIR@/install_pkg_a"
+)
+message(STATUS "After find_dependency: PACKAGE_PREFIX_DIR = ${PACKAGE_PREFIX_DIR}")
+include("@PACKAGE_CMAKE_INSTALL_DATADIR@/pkg_b_included.cmake")
+message(STATUS "Leaving pkg_b-config.cmake with PACKAGE_PREFIX_DIR = ${PACKAGE_PREFIX_DIR}")
+]])
+configure_package_config_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/pkg_b-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/install_pkg_b/pkg_b-config.cmake
+ INSTALL_DESTINATION .
+ PATH_VARS CMAKE_INSTALL_DATADIR
+)
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_pkg_b/share/pkg_b_included.cmake
+ [[message(STATUS "Hello from pkg_b")]]
+)
+
+find_package(pkg_b REQUIRED NO_DEFAULT_PATH
+ PATHS ${CMAKE_CURRENT_BINARY_DIR}/install_pkg_b
+)
diff --git a/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake b/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake
index 3b4bef5..c4a05e3 100644
--- a/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePackage/RunCMakeTest.cmake
@@ -4,6 +4,8 @@ if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(maybe_CMAKE_BUILD_TYPE -DCMAKE_BUILD_TYPE=Release)
endif()
+run_cmake_with_options(NestedConfigFile ${maybe_CMAKE_BUILD_TYPE})
+
function(apple_export platform system_name archs sysroot)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/apple-export-${platform}-build)
string(REPLACE ";" "\\;" archs "${archs}")
diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros-stdout.txt b/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros-stdout.txt
new file mode 100644
index 0000000..d3f1afc
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros-stdout.txt
@@ -0,0 +1,5 @@
+^Not searching for unused variables given on the command line\.
+Available configure presets:
+
+ "Include"
+ "IncludeCommon"$
diff --git a/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros.json.in b/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros.json.in
new file mode 100644
index 0000000..c5693b5
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/IncludeExpansionOtherMacros.json.in
@@ -0,0 +1,10 @@
+{
+ "version": 9,
+ "include": ["${sourceDir}/IncludeCommon.json"],
+ "configurePresets": [
+ {
+ "name": "Include",
+ "inherits": ["IncludeCommon"]
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index 88027fb..42a4ed9 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -407,6 +407,7 @@ set(CMakePresets_EXTRA_FILES
set(ENV{TEST_ENV_INCLUDE_DIR} ${RunCMake_BINARY_DIR}/IncludeExpansion)
run_cmake_presets(IncludeExpansion --list-presets)
unset(ENV{TEST_ENV_INCLUDE_DIR})
+run_cmake_presets(IncludeExpansionOtherMacros --list-presets)
unset(CMakePresets_EXTRA_FILES)
run_cmake_presets(IncludeNotFound)
run_cmake_presets(IncludeCycle)
diff --git a/Tests/RunCMake/CPack/External/Prerequirements.cmake b/Tests/RunCMake/CPack/External/Prerequirements.cmake
index e69de29..dbaf682 100644
--- a/Tests/RunCMake/CPack/External/Prerequirements.cmake
+++ b/Tests/RunCMake/CPack/External/Prerequirements.cmake
@@ -0,0 +1,4 @@
+function(get_test_prerequirements found_var config_file)
+ file(WRITE "${config_file}" "")
+ set(${found_var} true PARENT_SCOPE)
+endfunction()
diff --git a/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-check.cmake b/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-check.cmake
new file mode 100644
index 0000000..a7a28ae
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-check.cmake
@@ -0,0 +1 @@
+include(${RunCMake_SOURCE_DIR}/cpack-check-common.cmake)
diff --git a/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-stdout.txt b/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-stdout.txt
new file mode 100644
index 0000000..2998440
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/3-AppWiX-cpack-WIX-stdout.txt
@@ -0,0 +1,11 @@
+CPack: Create package using WIX
+CPack: Install projects
+CPack: - Install project: CPackWiXGenerator \[Release\]
+CPack: - Install component: applications
+CPack: - Install component: applications2
+CPack: - Install component: extras
+CPack: - Install component: headers
+CPack: - Install component: libraries
+CPack: Create package
+CPack: - package: [^
+]*/Tests/RunCMake/CPack_WIX/3-AppWiX-build/MyLib-1\.0\.0-(win64|windows-arm64)\.msi generated\.
diff --git a/Tests/RunCMake/CPack_WIX/3-AppWiX-verify-stdout.txt b/Tests/RunCMake/CPack_WIX/3-AppWiX-verify-stdout.txt
new file mode 100644
index 0000000..4713447
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/3-AppWiX-verify-stdout.txt
@@ -0,0 +1,33 @@
+-- MyLib-1\.0\.0-(win64|windows-arm64)\.msi
+Component: 'CM_CP_applications.bin.my_libapp.exe' 'CM_DP_applications.bin'
+Component: 'CM_SHORTCUT_applications' 'PROGRAM_MENU_FOLDER'
+Component: 'CM_SHORTCUT_DESKTOP_applications' 'DesktopFolder'
+Component: 'CM_CP_applications2.bin.my_other_app.exe' 'CM_DP_applications2.bin'
+Component: 'CM_SHORTCUT_applications2' 'PROGRAM_MENU_FOLDER'
+Component: 'CM_SHORTCUT_DESKTOP_applications2' 'DesktopFolder'
+Component: 'CM_C_EMPTY_CM_DP_extras.extras.empty' 'CM_DP_extras.extras.empty'
+Component: 'CM_CP_headers.include.file_with_spaces.h' 'CM_DP_headers.include'
+Component: 'CM_CP_headers.include.mylib.h' 'CM_DP_headers.include'
+Component: 'CM_CP_libraries.lib.mylib.lib' 'CM_DP_libraries.lib'
+Directory: 'INSTALL_ROOT' 'ProgramFiles64Folder' '[^']*\|CPack Component Example'
+Directory: 'CM_DP_applications.bin' 'INSTALL_ROOT' 'bin'
+Directory: 'PROGRAM_MENU_FOLDER' 'ProgramMenuFolder' 'MyLib'
+Directory: 'DesktopFolder' 'TARGETDIR' 'Desktop'
+Directory: 'CM_DP_applications2.bin' 'INSTALL_ROOT' 'bin'
+Directory: 'CM_DP_extras.extras.empty' 'CM_DP_extras.extras' 'empty'
+Directory: 'CM_DP_headers.include' 'INSTALL_ROOT' 'include'
+Directory: 'CM_DP_libraries.lib' 'INSTALL_ROOT' 'lib'
+Directory: 'CM_DP_extras.extras' 'INSTALL_ROOT' 'extras'
+Directory: 'ProgramFiles64Folder' 'TARGETDIR' '.'
+Directory: 'TARGETDIR' '' 'SourceDir'
+Directory: 'ProgramMenuFolder' 'TARGETDIR' '.'
+File: 'CM_FP_applications.bin.my_libapp.exe' 'CM_CP_applications.bin.my_libapp.exe' '[^']*\|my-libapp.exe'
+File: 'CM_FP_applications2.bin.my_other_app.exe' 'CM_CP_applications2.bin.my_other_app.exe' '[^']*\|my-other-app.exe'
+File: 'CM_FP_headers.include.file_with_spaces.h' 'CM_CP_headers.include.file_with_spaces.h' '[^']*\|file with spaces.h'
+File: 'CM_FP_headers.include.mylib.h' 'CM_CP_headers.include.mylib.h' 'mylib.h'
+File: 'CM_FP_libraries.lib.mylib.lib' 'CM_CP_libraries.lib.mylib.lib' 'mylib.lib'
+Shortcut: 'CM_SP_applications.bin.my_libapp.exe' 'PROGRAM_MENU_FOLDER' '[^']*\|CPack WiX Test' 'CM_SHORTCUT_applications'
+Shortcut: 'CM_DSP_applications.bin.my_libapp.exe' 'DesktopFolder' '[^']*\|CPack WiX Test' 'CM_SHORTCUT_DESKTOP_applications'
+Shortcut: 'CM_SP_applications2.bin.my_other_app.exe' 'PROGRAM_MENU_FOLDER' '[^']*\|Second CPack WiX Test' 'CM_SHORTCUT_applications2'
+Shortcut: 'CM_DSP_applications2.bin.my_other_app.exe' 'DesktopFolder' '[^']*\|Second CPack WiX Test' 'CM_SHORTCUT_DESKTOP_applications2'
+--
diff --git a/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-check.cmake b/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-check.cmake
new file mode 100644
index 0000000..a7a28ae
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-check.cmake
@@ -0,0 +1 @@
+include(${RunCMake_SOURCE_DIR}/cpack-check-common.cmake)
diff --git a/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-stdout.txt b/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-stdout.txt
new file mode 100644
index 0000000..51f06ca
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/4-AppWiX-cpack-WIX-stdout.txt
@@ -0,0 +1,11 @@
+CPack: Create package using WIX
+CPack: Install projects
+CPack: - Install project: CPackWiXGenerator \[Release\]
+CPack: - Install component: applications
+CPack: - Install component: applications2
+CPack: - Install component: extras
+CPack: - Install component: headers
+CPack: - Install component: libraries
+CPack: Create package
+CPack: - package: [^
+]*/Tests/RunCMake/CPack_WIX/4-AppWiX-build/MyLib-1\.0\.0-(win64|windows-arm64)\.msi generated\.
diff --git a/Tests/RunCMake/CPack_WIX/4-AppWiX-verify-stdout.txt b/Tests/RunCMake/CPack_WIX/4-AppWiX-verify-stdout.txt
new file mode 100644
index 0000000..a379859
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/4-AppWiX-verify-stdout.txt
@@ -0,0 +1,34 @@
+-- MyLib-1\.0\.0-(win64|windows-arm64)\.msi
+Component: 'CM_CP_applications.bin.my_libapp.exe' 'CM_DP_applications.bin'
+Component: 'CM_SHORTCUT_applications' 'PROGRAM_MENU_FOLDER'
+Component: 'CM_SHORTCUT_DESKTOP_applications' 'DesktopFolder'
+Component: 'CM_CP_applications2.bin.my_other_app.exe' 'CM_DP_applications2.bin'
+Component: 'CM_SHORTCUT_applications2' 'PROGRAM_MENU_FOLDER'
+Component: 'CM_SHORTCUT_DESKTOP_applications2' 'DesktopFolder'
+Component: 'CM_C_EMPTY_CM_DP_extras.extras.empty' 'CM_DP_extras.extras.empty'
+Component: 'CM_CP_headers.include.file_with_spaces.h' 'CM_DP_headers.include'
+Component: 'CM_CP_headers.include.mylib.h' 'CM_DP_headers.include'
+Component: 'CM_CP_libraries.lib.mylib.lib' 'CM_DP_libraries.lib'
+Directory: 'INSTALL_ROOT' 'ProgramFiles6432Folder' '[^']*\|CPack Component Example'
+Directory: 'CM_DP_applications.bin' 'INSTALL_ROOT' 'bin'
+Directory: 'CM_DP_applications2.bin' 'INSTALL_ROOT' 'bin'
+Directory: 'CM_DP_extras.extras.empty' 'CM_DP_extras.extras' 'empty'
+Directory: 'CM_DP_extras.extras' 'INSTALL_ROOT' 'extras'
+Directory: 'CM_DP_headers.include' 'INSTALL_ROOT' 'include'
+Directory: 'CM_DP_libraries.lib' 'INSTALL_ROOT' 'lib'
+Directory: 'ProgramFiles6432Folder' 'ProgramFiles64Folder' '.'
+Directory: 'PROGRAM_MENU_FOLDER' 'ProgramMenuFolder' 'MyLib'
+Directory: 'ProgramMenuFolder' 'TARGETDIR' 'PMenu'
+Directory: 'ProgramFiles64Folder' 'TARGETDIR' 'PFiles64'
+Directory: 'TARGETDIR' '' 'SourceDir'
+Directory: 'DesktopFolder' 'TARGETDIR' 'Desktop'
+File: 'CM_FP_applications.bin.my_libapp.exe' 'CM_CP_applications.bin.my_libapp.exe' '[^']*\|my-libapp.exe'
+File: 'CM_FP_applications2.bin.my_other_app.exe' 'CM_CP_applications2.bin.my_other_app.exe' '[^']*\|my-other-app.exe'
+File: 'CM_FP_headers.include.file_with_spaces.h' 'CM_CP_headers.include.file_with_spaces.h' '[^']*\|file with spaces.h'
+File: 'CM_FP_headers.include.mylib.h' 'CM_CP_headers.include.mylib.h' 'mylib.h'
+File: 'CM_FP_libraries.lib.mylib.lib' 'CM_CP_libraries.lib.mylib.lib' 'mylib.lib'
+Shortcut: 'CM_SP_applications.bin.my_libapp.exe' 'PROGRAM_MENU_FOLDER' '[^']*\|CPack WiX Test' 'CM_SHORTCUT_applications'
+Shortcut: 'CM_DSP_applications.bin.my_libapp.exe' 'DesktopFolder' '[^']*\|CPack WiX Test' 'CM_SHORTCUT_DESKTOP_applications'
+Shortcut: 'CM_SP_applications2.bin.my_other_app.exe' 'PROGRAM_MENU_FOLDER' '[^']*\|Second CPack WiX Test' 'CM_SHORTCUT_applications2'
+Shortcut: 'CM_DSP_applications2.bin.my_other_app.exe' 'DesktopFolder' '[^']*\|Second CPack WiX Test' 'CM_SHORTCUT_DESKTOP_applications2'
+--
diff --git a/Tests/RunCMake/CPack_WIX/RunCMakeTest.cmake b/Tests/RunCMake/CPack_WIX/RunCMakeTest.cmake
new file mode 100644
index 0000000..816d949
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/RunCMakeTest.cmake
@@ -0,0 +1,24 @@
+include(RunCPack)
+
+set(env_PATH "$ENV{PATH}")
+
+set(RunCPack_GENERATORS WIX)
+set(RunCPack_GLOB *.msi)
+set(RunCPack_VERIFY powershell -ExecutionPolicy Bypass -File ${CMAKE_CURRENT_LIST_DIR}/print-msi.ps1)
+
+function(run_cpack_wix v)
+ set(RunCMake_TEST_OPTIONS -DCPACK_WIX_VERSION=${v})
+ run_cpack(${v}-AppWiX SAMPLE AppWiX BUILD)
+endfunction()
+
+if(CMake_TEST_CPACK_WIX3)
+ set(ENV{PATH} "${CMake_TEST_CPACK_WIX3};${env_PATH}")
+ run_cpack_wix(3)
+endif()
+
+if(CMake_TEST_CPACK_WIX4)
+ set(ENV{PATH} "${CMake_TEST_CPACK_WIX4};${env_PATH}")
+ set(ENV{WIX_EXTENSIONS} "${CMake_TEST_CPACK_WIX4}")
+ run_cpack_wix(4)
+ unset(ENV{WIX_EXTENSIONS})
+endif()
diff --git a/Tests/RunCMake/CPack_WIX/cpack-check-common.cmake b/Tests/RunCMake/CPack_WIX/cpack-check-common.cmake
new file mode 100644
index 0000000..2f16d71
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/cpack-check-common.cmake
@@ -0,0 +1,6 @@
+file(GLOB wix_log_file RELATIVE "${RunCMake_TEST_BINARY_DIR}" "${RunCMake_TEST_BINARY_DIR}/_CPack_Packages/*/WIX/wix.log")
+if(wix_log_file)
+ file(READ "${RunCMake_TEST_BINARY_DIR}/${wix_log_file}" wix_log)
+ string(REPLACE "\n" "\n wix-log> " wix_log " wix-log> ${wix_log}")
+ set(RunCMake_TEST_FAILURE_MESSAGE "${wix_log_file}:\n${wix_log}")
+endif()
diff --git a/Tests/RunCMake/CPack_WIX/print-msi.ps1 b/Tests/RunCMake/CPack_WIX/print-msi.ps1
new file mode 100644
index 0000000..01fdbc8
--- /dev/null
+++ b/Tests/RunCMake/CPack_WIX/print-msi.ps1
@@ -0,0 +1,29 @@
+# https://learn.microsoft.com/en-us/windows/win32/msi/database-tables
+
+param (
+ $file
+ )
+
+function printTable {
+ param (
+ $msi,
+ [string]$name,
+ [int[]]$columns = (1)
+ )
+
+ try {
+ $view = $msi.OpenView("select * from " + $name)
+ $view.Execute()
+ while ($record = $view.Fetch()) {
+ Write-Host ($name + ": " + ($columns | ForEach-Object {"'" + $record.StringData($_) + "'"}))
+ }
+ } catch {}
+}
+
+$installer = New-Object -ComObject WindowsInstaller.Installer
+$msi = $installer.OpenDatabase($file, 0)
+
+printTable -msi $msi -name "Component" -columns 1,3
+printTable -msi $msi -name "Directory" -columns 1,2,3
+printTable -msi $msi -name "File" -columns 1,2,3
+printTable -msi $msi -name "Shortcut" -columns 1,2,3,4
diff --git a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in
index 5437800..e4a6f5f 100644
--- a/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in
+++ b/Tests/RunCMake/CTestCommandLine/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5)
project(CTestCommandLine@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stdout.txt
new file mode 100644
index 0000000..be5d335
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-cmake.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stdout.txt
new file mode 100644
index 0000000..be5d335
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stdout.txt
new file mode 100644
index 0000000..be5d335
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF-env.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-OFF.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stdout.txt
new file mode 100644
index 0000000..fa95148
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-cmake.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stdout.txt
new file mode 100644
index 0000000..fa95148
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stdout.txt
new file mode 100644
index 0000000..fa95148
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON-env.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVerify-ON.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stdout.txt
new file mode 100644
index 0000000..e83d934
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-cmake.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stdout.txt
new file mode 100644
index 0000000..e83d934
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-result.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stderr.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stdout.txt b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stdout.txt
new file mode 100644
index 0000000..e83d934
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env-ctest-stdout.txt
@@ -0,0 +1 @@
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1-env.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1.cmake
new file mode 100644
index 0000000..e0368fc
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-TLSVersion-1.1.cmake
@@ -0,0 +1 @@
+include(FailDrop-common.cmake)
diff --git a/Tests/RunCMake/CTestCommandLine/FailDrop-common.cmake b/Tests/RunCMake/CTestCommandLine/FailDrop-common.cmake
new file mode 100644
index 0000000..134d26d
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/FailDrop-common.cmake
@@ -0,0 +1,3 @@
+set(SUBMIT_URL "https://badhostname.invalid")
+set(CTEST_SUBMIT_RETRY_COUNT 0 CACHE STRING "")
+include(CTest)
diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
index a9f392b..190c6c1 100644
--- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake
@@ -1,6 +1,10 @@
include(RunCMake)
include(RunCTest)
+# Do not use any proxy for lookup of an invalid site.
+# DNS failure by proxy looks different than DNS failure without proxy.
+set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid")
+
set(RunCMake_TEST_TIMEOUT 60)
run_cmake_command(repeat-opt-bad1
@@ -433,6 +437,8 @@ function(run_ShowOnly)
RESOURCE_GROUPS \"2,threads:2,gpus:4;gpus:2,threads:4\"
REQUIRED_FILES RequiredFileDoesNotExist
_BACKTRACE_TRIPLES \"file1;1;add_test;file0;;\"
+ USER_DEFINED_A \"User defined property A value\"
+ USER_DEFINED_B \"User defined property B value\"
)
add_test(ShowOnlyNotAvailable NOT_AVAILABLE)
")
@@ -482,6 +488,32 @@ run_NoTests()
# Check the configuration type variable is passed
run_ctest(check-configuration-type)
+function(run_FailDrop case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/FailDrop-${case}-build)
+ run_cmake_with_options(FailDrop-${case} ${ARGN})
+ unset(ENV{CMAKE_TLS_VERIFY}) # Test that env variable is saved in ctest config file.
+ unset(ENV{CMAKE_TLS_VERSION}) # Test that env variable is saved in ctest config file.
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(FailDrop-${case}-ctest
+ ${CMAKE_CTEST_COMMAND} -M Experimental -T Submit -VV
+ )
+endfunction()
+run_FailDrop(TLSVersion-1.1 -DCTEST_TLS_VERSION=1.1)
+run_FailDrop(TLSVersion-1.1-cmake -DCMAKE_TLS_VERSION=1.1) # Test fallback to CMake variable.
+set(ENV{CMAKE_TLS_VERSION} 1.1) # Test fallback to env variable.
+run_FailDrop(TLSVersion-1.1-env)
+unset(ENV{CMAKE_TLS_VERSION})
+run_FailDrop(TLSVerify-ON -DCTEST_TLS_VERIFY=ON)
+run_FailDrop(TLSVerify-ON-cmake -DCMAKE_TLS_VERIFY=ON) # Test fallback to CMake variable.
+set(ENV{CMAKE_TLS_VERIFY} 1) # Test fallback to env variable.
+run_FailDrop(TLSVerify-ON-env)
+unset(ENV{CMAKE_TLS_VERIFY})
+run_FailDrop(TLSVerify-OFF -DCTEST_TLS_VERIFY=OFF)
+run_FailDrop(TLSVerify-OFF-cmake -DCMAKE_TLS_VERIFY=OFF) # Test fallback to CMake variable.
+set(ENV{CMAKE_TLS_VERIFY} 0) # Test fallback to env variable.
+run_FailDrop(TLSVerify-OFF-env)
+unset(ENV{CMAKE_TLS_VERIFY})
+
run_cmake_command(EmptyDirCoverage-ctest
${CMAKE_CTEST_COMMAND} -C Debug -M Experimental -T Coverage
)
@@ -510,7 +542,7 @@ run_MemCheckSan(UndefinedBehavior "simulate_sanitizer=1")
run_cmake_command(test-dir-invalid-arg ${CMAKE_CTEST_COMMAND} --test-dir)
run_cmake_command(test-dir-non-existing-dir ${CMAKE_CTEST_COMMAND} --test-dir non-existing-dir)
-function(run_testDir)
+function(run_testDir testName testPreset)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/testDir)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
@@ -520,9 +552,16 @@ function(run_testDir)
add_test(Test1 \"${CMAKE_COMMAND}\" -E true)
add_test(Test2 \"${CMAKE_COMMAND}\" -E true)
")
- run_cmake_command(testDir ${CMAKE_CTEST_COMMAND} --test-dir "${RunCMake_TEST_BINARY_DIR}/sub")
+ if (testPreset)
+ set(presetCommandLine --preset=default)
+ configure_file(
+ ${RunCMake_SOURCE_DIR}/testDir-presets.json.in
+ ${RunCMake_TEST_BINARY_DIR}/CMakePresets.json)
+ endif()
+ run_cmake_command(${testName} ${CMAKE_CTEST_COMMAND} --test-dir "${RunCMake_TEST_BINARY_DIR}/sub" ${presetCommandLine})
endfunction()
-run_testDir()
+run_testDir(testDir 0)
+run_testDir(testDir-preset 1)
# Test --output-junit
function(run_output_junit)
@@ -543,6 +582,8 @@ set_tests_properties(test5 PROPERTIES SKIP_REGULAR_EXPRESSION \"please skip\")
endfunction()
run_output_junit()
+run_cmake_command(invalid-ctest-argument ${CMAKE_CTEST_COMMAND} --not-a-valid-ctest-argument)
+
if(WIN32)
block()
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TimeoutSignalWindows)
diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
index 918d242..53aa318 100644
--- a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
+++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake
@@ -1,6 +1,6 @@
file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml")
if(test_xml_file)
- file(READ "${test_xml_file}" test_xml LIMIT 4096)
+ file(READ "${test_xml_file}" test_xml LIMIT 8192)
if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]])
set(test_passed "${CMAKE_MATCH_1}")
set(test_failed "${CMAKE_MATCH_2}")
diff --git a/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-result.txt b/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-stderr.txt b/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-stderr.txt
new file mode 100644
index 0000000..3304a26
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/invalid-ctest-argument-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: Unknown argument: --not-a-valid-ctest-argument
+CMake Error: Run 'ctest --help' for all supported options.
diff --git a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
index b818650..f9667ae 100644
--- a/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
+++ b/Tests/RunCMake/CTestCommandLine/show-only_json-v1_check.py
@@ -144,13 +144,23 @@ def check_workingdir_property(p):
assert p["name"] == "WORKING_DIRECTORY"
assert p["value"].endswith("Tests/RunCMake/CTestCommandLine/ShowOnly")
+def check_defined_properties(p_list):
+ for property_id, p in zip(["A", "B"], p_list):
+ assert is_dict(p)
+ assert sorted(p.keys()) == ["name", "value"]
+ assert is_string(p["name"])
+ assert is_string(p["value"])
+ assert p["name"] == "USER_DEFINED_" + property_id
+ assert p["value"] == "User defined property " + property_id + " value"
+
def check_properties(p):
assert is_list(p)
- assert len(p) == 4
+ assert len(p) == 6
check_resource_groups_property(p[0])
check_reqfiles_property(p[1])
check_willfail_property(p[2])
check_workingdir_property(p[3])
+ check_defined_properties(p[4:5])
def check_tests(t):
assert is_list(t)
diff --git a/Tests/RunCMake/CTestCommandLine/testDir-presets.json.in b/Tests/RunCMake/CTestCommandLine/testDir-presets.json.in
new file mode 100644
index 0000000..46391f8
--- /dev/null
+++ b/Tests/RunCMake/CTestCommandLine/testDir-presets.json.in
@@ -0,0 +1,20 @@
+{
+ "version": 3,
+ "cmakeMinimumRequired": {
+ "major": 3,
+ "minor": 22,
+ "patch": 0
+ },
+ "configurePresets": [
+ {
+ "name": "default",
+ "binaryDir": "presetBinaryDir"
+ }
+ ],
+ "testPresets": [
+ {
+ "name": "default",
+ "configurePreset": "default"
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
index 42e13fc..3c3e88f 100644
--- a/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CTestResourceAllocation/RunCMakeTest.cmake
@@ -167,6 +167,16 @@ function(verify_ctest_resources)
endif()
endfunction()
+set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/invalid-build")
+set(RunCMake_TEST_NO_CLEAN 1)
+file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "add_test(true \"${CMAKE_COMMAND}\" -E true)\n")
+run_cmake_command(invalid-nofile-ctest ${CMAKE_CTEST_COMMAND} --resource-spec-file "${RunCMake_BINARY_DIR}/noexist.json")
+run_cmake_command(invalid-not-json-ctest ${CMAKE_CTEST_COMMAND} --resource-spec-file "${RunCMake_SOURCE_DIR}/invalid.json")
+unset(RunCMake_TEST_NO_CLEAN)
+unset(RunCMake_TEST_BINARY_DIR)
+
run_ctest_resource(lotsoftests 10 1 0)
run_ctest_resource(checkfree1 2 0 1)
run_ctest_resource(checkfree2 1 0 0)
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt
index 397ca38..0a927e7 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s-stderr.txt
@@ -1,3 +1,5 @@
^Error: a cycle exists in the test dependency graph for the test "GenerateSpecFile"\.
-Please fix the cycle and run ctest again.
-No tests were found!!!$
+Please fix the cycle and run ctest again\.
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt
index 06ea90f..533b07c 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^All tests that have RESOURCE_GROUPS must include the resource spec generator fixture in their FIXTURES_REQUIRED
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-circular-no-required-fixtures-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt
index 4e4c01c..d91d6dc 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^GENERATED_RESOURCE_SPEC_FILE test property cannot be used in conjunction with ResourceSpecFile option
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-conflicting-spec-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt
index 273cb80..def7a8b 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^Only one test may define the GENERATED_RESOURCE_SPEC_FILE property
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-generators-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt
index 39ee275..3301318 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^Test that defines GENERATED_RESOURCE_SPEC_FILE must have exactly one FIXTURES_SETUP
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-multiple-setup-fixtures-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt
index 06ea90f..a3c4d20 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^All tests that have RESOURCE_GROUPS must include the resource spec generator fixture in their FIXTURES_REQUIRED
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-required-fixture-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt
index 39ee275..92a93bb 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^Test that defines GENERATED_RESOURCE_SPEC_FILE must have exactly one FIXTURES_SETUP
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-no-setup-fixture-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt
index 2c4dff8..6829ffe 100644
--- a/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt
+++ b/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s-stderr.txt
@@ -1,2 +1,4 @@
^GENERATED_RESOURCE_SPEC_FILE must be an absolute path
-No tests were found!!!$
+CMake Error at [^
+]*/Tests/RunCMake/CTestResourceAllocation/dynamic-resource-relative-path-ctest-s/test\.cmake:[0-9]+ \(message\):
+ Tests did not pass$
diff --git a/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-result.txt b/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-stderr.txt
new file mode 100644
index 0000000..df1135e
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/invalid-nofile-ctest-stderr.txt
@@ -0,0 +1,8 @@
+^Could not read/parse resource spec file [^
+]*/Tests/RunCMake/CTestResourceAllocation/noexist\.json:[ ]
+File not found: [^
+]*/Tests/RunCMake/CTestResourceAllocation/noexist.json
+Errors while running CTest
+Output from these tests are in: [^
+]*/Tests/RunCMake/CTestResourceAllocation/invalid-build/Testing/Temporary/LastTest\.log
+Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely\.$
diff --git a/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-result.txt b/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-result.txt
new file mode 100644
index 0000000..45a4fb7
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-result.txt
@@ -0,0 +1 @@
+8
diff --git a/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-stderr.txt b/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-stderr.txt
new file mode 100644
index 0000000..5bd9d97
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/invalid-not-json-ctest-stderr.txt
@@ -0,0 +1,15 @@
+^Could not read/parse resource spec file [^
+]*/Tests/RunCMake/CTestResourceAllocation/invalid\.json:[ ]
+JSON Parse Error: [^
+]*/Tests/RunCMake/CTestResourceAllocation/invalid\.json:
+\* Line 1, Column 1
+ Syntax error: value, object or array expected\.
+(\* Line 1, Column 2
+ Extra non-whitespace after JSON value\.
+|\* Line 1, Column 1
+ A valid JSON document must be either an array or an object value\.
+)
+Errors while running CTest
+Output from these tests are in: [^
+]*/Tests/RunCMake/CTestResourceAllocation/invalid-build/Testing/Temporary/LastTest\.log
+Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely\.$
diff --git a/Tests/RunCMake/CTestResourceAllocation/invalid.json b/Tests/RunCMake/CTestResourceAllocation/invalid.json
new file mode 100644
index 0000000..4c861f8
--- /dev/null
+++ b/Tests/RunCMake/CTestResourceAllocation/invalid.json
@@ -0,0 +1 @@
+This is not a valid JSON file!
diff --git a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake
index d68775a..c754930 100644
--- a/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake
+++ b/Tests/RunCMake/CXXModules/CMP0155-NEW.cmake
@@ -1,3 +1,6 @@
+# Block making C++ `import std` targets.
+add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+
enable_language(CXX)
unset(CMAKE_CXX_SCANDEP_SOURCE)
diff --git a/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake b/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake
index 201598e..a994266 100644
--- a/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake
+++ b/Tests/RunCMake/CXXModules/CMP0155-OLD.cmake
@@ -1,3 +1,6 @@
+# Block making C++ `import std` targets.
+add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+
enable_language(CXX)
unset(CMAKE_CXX_SCANDEP_SOURCE)
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdConfig-result.txt b/Tests/RunCMake/CXXModules/CXXImportStdConfig-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdConfig-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdConfig-stderr.txt b/Tests/RunCMake/CXXModules/CXXImportStdConfig-stderr.txt
new file mode 100644
index 0000000..268099f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdConfig-stderr.txt
@@ -0,0 +1,3 @@
+CMake Error in CMakeLists.txt:
+ The "CXX_MODULE_STD" property on the target "nocxx23target" contains a
+ context-sensitive condition that is not supported.
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdConfig.cmake b/Tests/RunCMake/CXXModules/CXXImportStdConfig.cmake
new file mode 100644
index 0000000..0867082
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdConfig.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+
+set(CMAKE_CXX_MODULE_STD "$<CONFIG:Release>")
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-result.txt b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-stderr.txt b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-stderr.txt
new file mode 100644
index 0000000..a2cdb63
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<TARGET_PROPERTY:use_std_in_consumed>
+
+ \$<TARGET_PROPERTY:prop> may only be used with binary targets. It may not
+ be used with add_custom_command or add_custom_target. Specify the target
+ to read a property from using the \$<TARGET_PROPERTY:tgt,prop> signature
+ instead.
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget.cmake b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget.cmake
new file mode 100644
index 0000000..3eb2c68
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdHeadTarget.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+
+set(CMAKE_CXX_MODULE_STD "$<TARGET_PROPERTY:use_std_in_consumed>")
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdInvalidGenex.cmake b/Tests/RunCMake/CXXModules/CXXImportStdInvalidGenex.cmake
new file mode 100644
index 0000000..86230a4
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdInvalidGenex.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+set(CMAKE_CXX_SCANDEP_SOURCE "echo")
+
+set(CMAKE_CXX_MODULE_STD "$<STREQUAL:")
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-result.txt b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-stderr.txt b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-stderr.txt
new file mode 100644
index 0000000..21148a2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<LINK_LANGUAGE:CXX>
+
+ \$<LINK_LANGUAGE:...> may only be used with binary targets to specify link
+ libraries, link directories, link options and link depends.
diff --git a/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage.cmake b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage.cmake
new file mode 100644
index 0000000..e9b20c7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/CXXImportStdLinkLanguage.cmake
@@ -0,0 +1,10 @@
+enable_language(CXX)
+
+set(CMAKE_CXX_MODULE_STD "$<LINK_LANGUAGE:CXX>")
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake b/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake
index cac1777..64d69f3 100644
--- a/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake
+++ b/Tests/RunCMake/CXXModules/ImplicitCXX20.cmake
@@ -1,6 +1,9 @@
# Enable scanning by default for targets that explicitly use C++ 20.
cmake_policy(SET CMP0155 NEW)
+# Block making C++ `import std` targets.
+add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+
# Force CMAKE_CXX_STANDARD_DEFAULT to be C++ 20.
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${CMAKE_CXX20_STANDARD_COMPILE_OPTION}")
enable_language(CXX)
diff --git a/Tests/RunCMake/CXXModules/Inspect.cmake b/Tests/RunCMake/CXXModules/Inspect.cmake
index 612b01b..e648e8c 100644
--- a/Tests/RunCMake/CXXModules/Inspect.cmake
+++ b/Tests/RunCMake/CXXModules/Inspect.cmake
@@ -15,11 +15,28 @@ if (CMAKE_CXX_FLAGS MATCHES "-std=")
set(forced_cxx_standard 1)
endif ()
+macro (cxx_check_import_std version)
+ set(have_cxx${version}_import_std 0)
+ if ("${version}" IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD)
+ set(have_cxx${version}_import_std 1)
+ endif ()
+
+ if (TARGET "__CMAKE:CXX${version}" AND NOT have_cxx${version}_import_std)
+ message(FATAL_ERROR
+ "The toolchain's C++${version} target exists, but the user variable does "
+ "not indicate it.")
+ endif ()
+endmacro ()
+
+cxx_check_import_std(23)
+cxx_check_import_std(26)
+
# Forward information about the C++ compile features.
string(APPEND info "\
set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\")
set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\")
set(forced_cxx_standard \"${forced_cxx_standard}\")
+set(have_cxx23_import_std \"${have_cxx23_import_std}\")
set(CMAKE_CXX_COMPILER_VERSION \"${CMAKE_CXX_COMPILER_VERSION}\")
set(CMAKE_CXX_OUTPUT_EXTENSION \"${CMAKE_CXX_OUTPUT_EXTENSION}\")
set(CXXModules_default_build_type \"${CMAKE_BUILD_TYPE}\")
diff --git a/Tests/RunCMake/CXXModules/NoCXX20.cmake b/Tests/RunCMake/CXXModules/NoCXX20.cmake
index b7372e8..9710728 100644
--- a/Tests/RunCMake/CXXModules/NoCXX20.cmake
+++ b/Tests/RunCMake/CXXModules/NoCXX20.cmake
@@ -1,3 +1,6 @@
+# Block making C++ `import std` targets.
+add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+
enable_language(CXX)
add_library(nocxx20)
diff --git a/Tests/RunCMake/CXXModules/NoCXX23TargetNotRequired.cmake b/Tests/RunCMake/CXXModules/NoCXX23TargetNotRequired.cmake
new file mode 100644
index 0000000..2d9bffa
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX23TargetNotRequired.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+set(CMAKE_CXX_SCANDEP_SOURCE "echo")
+
+set(CMAKE_CXX_MODULE_STD 0)
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-result.txt b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-stderr.txt b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-stderr.txt
new file mode 100644
index 0000000..56468d0
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error in CMakeLists.txt:
+ The "CXX_MODULE_STD" property on the target "nocxx23target" requires that
+ the "__CMAKE::CXX23" target exist, but it was not provided by the
+ toolchain.
diff --git a/Tests/RunCMake/CXXModules/NoCXX23TargetRequired.cmake b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired.cmake
new file mode 100644
index 0000000..fac05e2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX23TargetRequired.cmake
@@ -0,0 +1,11 @@
+enable_language(CXX)
+set(CMAKE_CXX_SCANDEP_SOURCE "echo")
+
+set(CMAKE_CXX_MODULE_STD 1)
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/NoCXX23TargetUnset.cmake b/Tests/RunCMake/CXXModules/NoCXX23TargetUnset.cmake
new file mode 100644
index 0000000..8f6a656
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NoCXX23TargetUnset.cmake
@@ -0,0 +1,13 @@
+enable_language(CXX)
+set(CMAKE_CXX_SCANDEP_SOURCE "echo")
+
+# TODO(cxxmodules): Add instances of this test which test the policy
+# of the property's unset behavior.
+# set(CMAKE_CXX_MODULE_STD …)
+
+add_library(nocxx23target)
+target_sources(nocxx23target
+ PRIVATE
+ FILE_SET fs TYPE CXX_MODULES FILES
+ sources/module.cxx)
+target_compile_features(nocxx23target PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/NoScanningVariable.cmake b/Tests/RunCMake/CXXModules/NoScanningVariable.cmake
index 4bb6a70..950f1f3 100644
--- a/Tests/RunCMake/CXXModules/NoScanningVariable.cmake
+++ b/Tests/RunCMake/CXXModules/NoScanningVariable.cmake
@@ -1,6 +1,9 @@
# Enable scanning by default for targets that explicitly use C++ 20.
cmake_policy(SET CMP0155 NEW)
+# Block making C++ `import std` targets.
+add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+
enable_language(CXX)
# Hide any real scanning rule that may be available.
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 23c32c0..8c76afc 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -83,6 +83,20 @@ foreach (fileset_type IN LISTS fileset_types)
run_cmake("NotCXXSource${fileset_type}")
endforeach ()
+if ("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES)
+ run_cmake(CXXImportStdConfig)
+ run_cmake(CXXImportStdHeadTarget)
+ run_cmake(CXXImportStdLinkLanguage)
+ run_cmake(CXXImportStdInvalidGenex)
+endif ()
+
+if ("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES AND
+ NOT have_cxx23_import_std)
+ run_cmake(NoCXX23TargetUnset)
+ run_cmake(NoCXX23TargetNotRequired)
+ run_cmake(NoCXX23TargetRequired)
+endif ()
+
run_cmake(InstallBMI)
run_cmake(InstallBMIGenericArgs)
run_cmake(InstallBMIIgnore)
@@ -176,6 +190,7 @@ endfunction ()
# - `partitions`: module partitions are supported
# - `internal_partitions`: internal module partitions are supported
# - `bmionly`: the compiler supports BMI-only builds
+# - `import_std23`: the compiler supports `import std` for C++23
#
# Generator-based:
# - `compile_commands`: the generator supports `compile_commands.json`
@@ -222,6 +237,31 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(same-src-name)
run_cxx_module_test(scan_properties)
run_cxx_module_test(target-objects)
+
+ if ("cxx_std_23" IN_LIST CMAKE_CXX_COMPILE_FEATURES AND
+ "import_std23" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(import-std)
+ set(RunCMake_CXXModules_NO_TEST 1)
+ run_cxx_module_test(import-std-no-std-property)
+ unset(RunCMake_CXXModules_NO_TEST)
+ run_cxx_module_test(import-std-export-no-std-build)
+ set(RunCMake_CXXModules_INSTALL 1)
+ run_cxx_module_test(import-std-export-no-std-install)
+ unset(RunCMake_CXXModules_INSTALL)
+
+ if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION)
+ run_cxx_module_test(import-std-not-in-export-build)
+ run_cxx_module_test(import-std-transitive import-std-transitive-not-in-export-build "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/import-std-not-in-export-build-build")
+
+ set(RunCMake_CXXModules_INSTALL 1)
+ run_cxx_module_test(import-std-not-in-export-install)
+ unset(RunCMake_CXXModules_INSTALL)
+ run_cxx_module_test(import-std-transitive import-std-transitive-not-in-export-install "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/import-std-not-in-export-install-install")
+
+ run_cxx_module_test(import-std-transitive import-std-transitive-export-no-std-build "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/import-std-export-no-std-build-build" -DEXPORT_NO_STD=1)
+ run_cxx_module_test(import-std-transitive import-std-transitive-export-no-std-install "-DCMAKE_PREFIX_PATH=${RunCMake_BINARY_DIR}/examples/import-std-export-no-std-install-install" -DEXPORT_NO_STD=1)
+ endif ()
+ endif ()
endif ()
# Tests which require compile commands support.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/CMakeLists.txt
new file mode 100644
index 0000000..89350ef
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/CMakeLists.txt
@@ -0,0 +1,59 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std_export_no_std CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_NO_STD 1)
+
+add_library(import_std_export_no_std)
+target_sources(import_std_export_no_std
+ PRIVATE
+ uses-std.cxx
+ PUBLIC
+ FILE_SET use_std TYPE CXX_MODULES FILES
+ impl-uses-std.cxx)
+target_compile_features(import_std_export_no_std PUBLIC cxx_std_23)
+set_property(TARGET import_std_export_no_std
+ PROPERTY
+ CXX_MODULE_STD "$<BOOL:$<BUILD_LOCAL_INTERFACE:1>>")
+
+add_executable(main
+ main.cxx)
+target_link_libraries(main PRIVATE import_std_export_no_std)
+
+install(TARGETS import_std_export_no_std
+ EXPORT export
+ ARCHIVE DESTINATION "lib"
+ FILE_SET use_std DESTINATION "lib/cxx/miu")
+export(EXPORT export
+ NAMESPACE CXXModules::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/import_std_export_no_std-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/import_std_export_no_std-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/import_std_export_no_std-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+
+add_test(NAME main COMMAND main)
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME import_std_export_no_std_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-Dimport_std_export_no_std_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/impl-uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/impl-uses-std.cxx
new file mode 100644
index 0000000..ee19332
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/impl-uses-std.cxx
@@ -0,0 +1,3 @@
+export module uses_std;
+
+export int f();
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/main.cxx
new file mode 100644
index 0000000..a6dd8d8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/main.cxx
@@ -0,0 +1,6 @@
+import uses_std;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/test/CMakeLists.txt
new file mode 100644
index 0000000..e37f174
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/test/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_library NONE)
+
+find_package(import_std_export_no_std REQUIRED)
+
+if (NOT TARGET CXXModules::import_std_export_no_std)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+function (check_property expected property)
+ get_property(actual TARGET CXXModules::import_std_export_no_std
+ PROPERTY "${property}")
+ if (NOT DEFINED actual)
+ if (NOT expected STREQUAL "<UNDEF>")
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: NOT-DEFINED")
+ endif ()
+ elseif (NOT actual STREQUAL expected)
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: ${actual}")
+ endif ()
+endfunction ()
+
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES")
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS")
+check_property("cxx_std_23" "IMPORTED_CXX_MODULES_COMPILE_FEATURES")
+check_property("" "IMPORTED_CXX_MODULES_LINK_LIBRARIES")
+check_property("<UNDEF>" "INTERFACE_LINK_LIBRARIES")
+check_property("$<BOOL:>" "CXX_MODULE_STD")
+
+# Extract the export-dependent targets from the export file.
+file(STRINGS "${import_std_export_no_std_DIR}/import_std_export_no_std-targets.cmake" usage_dependent_targets
+ REGEX "foreach._target ")
+# Rudimentary argument splitting.
+string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}")
+# Remove exported "target" names.
+list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::")
+# Strip quotes.
+string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}")
+
+if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets)
+ message(SEND_ERROR
+ "The main export requires the '__CMAKE::CXX23' target")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/uses-std.cxx
new file mode 100644
index 0000000..bd91093
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-build/uses-std.cxx
@@ -0,0 +1,8 @@
+module uses_std;
+
+import std;
+
+int f()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/CMakeLists.txt
new file mode 100644
index 0000000..62d9d91
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/CMakeLists.txt
@@ -0,0 +1,61 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std_export_no_std CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(import_std_export_no_std)
+target_sources(import_std_export_no_std
+ PRIVATE
+ uses-std.cxx
+ PUBLIC
+ FILE_SET use_std TYPE CXX_MODULES FILES
+ impl-uses-std.cxx)
+target_compile_features(import_std_export_no_std PUBLIC cxx_std_23)
+set_property(TARGET import_std_export_no_std
+ PROPERTY
+ CXX_MODULE_STD "$<BOOL:$<BUILD_LOCAL_INTERFACE:1>>")
+
+add_executable(main
+ main.cxx)
+target_link_libraries(main PRIVATE import_std_export_no_std)
+
+install(TARGETS import_std_export_no_std
+ EXPORT export
+ ARCHIVE DESTINATION "lib"
+ FILE_SET use_std DESTINATION "lib/cxx/miu")
+install(
+ EXPORT export
+ NAMESPACE CXXModules::
+ DESTINATION "lib/cmake/import_std_export_no_std"
+ FILE "import_std_export_no_std-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/import_std_export_no_std-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/import_std_export_no_std-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/import_std_export_no_std-config.cmake"
+ DESTINATION "lib/cmake/import_std_export_no_std")
+
+add_test(NAME main COMMAND main)
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME import_std_export_no_std_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
+ "-Dimport_std_export_no_std_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/import_std_export_no_std"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/impl-uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/impl-uses-std.cxx
new file mode 100644
index 0000000..ee19332
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/impl-uses-std.cxx
@@ -0,0 +1,3 @@
+export module uses_std;
+
+export int f();
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/main.cxx
new file mode 100644
index 0000000..a6dd8d8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/main.cxx
@@ -0,0 +1,6 @@
+import uses_std;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/test/CMakeLists.txt
new file mode 100644
index 0000000..e37f174
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/test/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_library NONE)
+
+find_package(import_std_export_no_std REQUIRED)
+
+if (NOT TARGET CXXModules::import_std_export_no_std)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+function (check_property expected property)
+ get_property(actual TARGET CXXModules::import_std_export_no_std
+ PROPERTY "${property}")
+ if (NOT DEFINED actual)
+ if (NOT expected STREQUAL "<UNDEF>")
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: NOT-DEFINED")
+ endif ()
+ elseif (NOT actual STREQUAL expected)
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: ${actual}")
+ endif ()
+endfunction ()
+
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES")
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS")
+check_property("cxx_std_23" "IMPORTED_CXX_MODULES_COMPILE_FEATURES")
+check_property("" "IMPORTED_CXX_MODULES_LINK_LIBRARIES")
+check_property("<UNDEF>" "INTERFACE_LINK_LIBRARIES")
+check_property("$<BOOL:>" "CXX_MODULE_STD")
+
+# Extract the export-dependent targets from the export file.
+file(STRINGS "${import_std_export_no_std_DIR}/import_std_export_no_std-targets.cmake" usage_dependent_targets
+ REGEX "foreach._target ")
+# Rudimentary argument splitting.
+string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}")
+# Remove exported "target" names.
+list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::")
+# Strip quotes.
+string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}")
+
+if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets)
+ message(SEND_ERROR
+ "The main export requires the '__CMAKE::CXX23' target")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/uses-std.cxx
new file mode 100644
index 0000000..6b7e814
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-export-no-std-install/uses-std.cxx
@@ -0,0 +1,9 @@
+module uses_std;
+import std;
+
+int f()
+{
+ std::string str = "hello!";
+ std::cout << "program: " << str << std::endl;
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-result.txt b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-stdout.txt
new file mode 100644
index 0000000..d473333
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-build-stdout.txt
@@ -0,0 +1 @@
+((Clang)?module 'std' not found|(MSVC)?could not find module 'std')
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/CMakeLists.txt
new file mode 100644
index 0000000..a605e95
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/CMakeLists.txt
@@ -0,0 +1,13 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std_no_std_property CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_MODULE_STD 0)
+
+add_executable(main
+ main.cxx)
+target_compile_features(main PRIVATE cxx_std_23)
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/main.cxx
new file mode 100644
index 0000000..fee84f1
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-no-std-property/main.cxx
@@ -0,0 +1,6 @@
+import std;
+
+int main(int argc, char* argv[])
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/CMakeLists.txt
new file mode 100644
index 0000000..3112002
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/CMakeLists.txt
@@ -0,0 +1,54 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std_not_in_export CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_MODULE_STD 1)
+
+add_library(import_std_not_in_export)
+target_sources(import_std_not_in_export
+ PUBLIC
+ FILE_SET use_std TYPE CXX_MODULES FILES
+ uses-std.cxx)
+target_compile_features(import_std_not_in_export PUBLIC cxx_std_23)
+
+add_executable(main
+ main.cxx)
+target_link_libraries(main PRIVATE import_std_not_in_export)
+
+install(TARGETS import_std_not_in_export
+ EXPORT export
+ ARCHIVE DESTINATION "lib"
+ FILE_SET use_std DESTINATION "lib/cxx/miu")
+export(EXPORT export
+ NAMESPACE CXXModules::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/import_std_not_in_export-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/import_std_not_in_export-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/import_std_not_in_export-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+
+add_test(NAME main COMMAND main)
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME import_std_not_in_export_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_CURRENT_SOURCE_DIR}"
+ "-Dimport_std_not_in_export_DIR=${CMAKE_CURRENT_BINARY_DIR}"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/main.cxx
new file mode 100644
index 0000000..a6dd8d8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/main.cxx
@@ -0,0 +1,6 @@
+import uses_std;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/test/CMakeLists.txt
new file mode 100644
index 0000000..4e994d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/test/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_library NONE)
+
+find_package(import_std_not_in_export REQUIRED)
+
+if (NOT TARGET CXXModules::import_std_not_in_export)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+function (check_property expected property)
+ get_property(actual TARGET CXXModules::import_std_not_in_export
+ PROPERTY "${property}")
+ if (NOT DEFINED actual)
+ if (NOT expected STREQUAL "<UNDEF>")
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: NOT-DEFINED")
+ endif ()
+ elseif (NOT actual STREQUAL expected)
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: ${actual}")
+ endif ()
+endfunction ()
+
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES")
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS")
+check_property("cxx_std_23" "IMPORTED_CXX_MODULES_COMPILE_FEATURES")
+check_property("" "IMPORTED_CXX_MODULES_LINK_LIBRARIES")
+check_property("<UNDEF>" "INTERFACE_LINK_LIBRARIES")
+check_property("1" "CXX_MODULE_STD")
+
+# Extract the export-dependent targets from the export file.
+file(STRINGS "${import_std_not_in_export_DIR}/import_std_not_in_export-targets.cmake" usage_dependent_targets
+ REGEX "foreach._target ")
+# Rudimentary argument splitting.
+string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}")
+# Remove exported "target" names.
+list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::")
+# Strip quotes.
+string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}")
+
+if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets)
+ message(SEND_ERROR
+ "The main export requires the '__CMAKE::CXX23' target")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/uses-std.cxx
new file mode 100644
index 0000000..aa45dd1
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-build/uses-std.cxx
@@ -0,0 +1,7 @@
+export module uses_std;
+import std;
+
+export int f()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/CMakeLists.txt
new file mode 100644
index 0000000..788ea84
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/CMakeLists.txt
@@ -0,0 +1,58 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std_not_in_export CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_MODULE_STD 1)
+
+add_library(import_std_not_in_export)
+target_sources(import_std_not_in_export
+ PUBLIC
+ FILE_SET use_std TYPE CXX_MODULES FILES
+ uses-std.cxx)
+target_compile_features(import_std_not_in_export PUBLIC cxx_std_23)
+
+add_executable(main
+ main.cxx)
+target_link_libraries(main PRIVATE import_std_not_in_export)
+
+install(TARGETS import_std_not_in_export
+ EXPORT export
+ ARCHIVE DESTINATION "lib"
+ FILE_SET use_std DESTINATION "lib/cxx/miu")
+install(
+ EXPORT export
+ NAMESPACE CXXModules::
+ DESTINATION "lib/cmake/import_std_not_in_export"
+ FILE "import_std_not_in_export-targets.cmake")
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/import_std_not_in_export-config.cmake"
+ "include(\"\${CMAKE_CURRENT_LIST_DIR}/import_std_not_in_export-targets.cmake\")
+set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND 1)
+")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/import_std_not_in_export-config.cmake"
+ DESTINATION "lib/cmake/import_std_not_in_export")
+
+add_test(NAME main COMMAND main)
+
+set(generator
+ -G "${CMAKE_GENERATOR}")
+if (CMAKE_GENERATOR_TOOLSET)
+ list(APPEND generator
+ -T "${CMAKE_GENERATOR_TOOLSET}")
+endif ()
+if (CMAKE_GENERATOR_PLATFORM)
+ list(APPEND generator
+ -A "${CMAKE_GENERATOR_PLATFORM}")
+endif ()
+
+add_test(NAME import_std_not_in_export_build
+ COMMAND
+ "${CMAKE_COMMAND}"
+ "-Dexpected_dir=${CMAKE_INSTALL_PREFIX}/lib/cxx/miu"
+ "-Dimport_std_not_in_export_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/import_std_not_in_export"
+ ${generator}
+ -S "${CMAKE_CURRENT_SOURCE_DIR}/test"
+ -B "${CMAKE_CURRENT_BINARY_DIR}/test")
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/main.cxx
new file mode 100644
index 0000000..a6dd8d8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/main.cxx
@@ -0,0 +1,6 @@
+import uses_std;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/test/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/test/CMakeLists.txt
new file mode 100644
index 0000000..4e994d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/test/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_library NONE)
+
+find_package(import_std_not_in_export REQUIRED)
+
+if (NOT TARGET CXXModules::import_std_not_in_export)
+ message(FATAL_ERROR
+ "Missing imported target")
+endif ()
+
+function (check_property expected property)
+ get_property(actual TARGET CXXModules::import_std_not_in_export
+ PROPERTY "${property}")
+ if (NOT DEFINED actual)
+ if (NOT expected STREQUAL "<UNDEF>")
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: NOT-DEFINED")
+ endif ()
+ elseif (NOT actual STREQUAL expected)
+ message(SEND_ERROR
+ "Mismatch for ${property}:\n expected: ${expected}\n actual: ${actual}")
+ endif ()
+endfunction ()
+
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES")
+check_property("<UNDEF>" "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS")
+check_property("cxx_std_23" "IMPORTED_CXX_MODULES_COMPILE_FEATURES")
+check_property("" "IMPORTED_CXX_MODULES_LINK_LIBRARIES")
+check_property("<UNDEF>" "INTERFACE_LINK_LIBRARIES")
+check_property("1" "CXX_MODULE_STD")
+
+# Extract the export-dependent targets from the export file.
+file(STRINGS "${import_std_not_in_export_DIR}/import_std_not_in_export-targets.cmake" usage_dependent_targets
+ REGEX "foreach._target ")
+# Rudimentary argument splitting.
+string(REPLACE " " ";" usage_dependent_targets "${usage_dependent_targets}")
+# Remove exported "target" names.
+list(FILTER usage_dependent_targets EXCLUDE REGEX "CXXModules::")
+# Strip quotes.
+string(REPLACE "\"" "" usage_dependent_targets "${usage_dependent_targets}")
+
+if ("__CMAKE::CXX23" IN_LIST usage_dependent_targets)
+ message(SEND_ERROR
+ "The main export requires the '__CMAKE::CXX23' target")
+endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/uses-std.cxx b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/uses-std.cxx
new file mode 100644
index 0000000..aa45dd1
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-not-in-export-install/uses-std.cxx
@@ -0,0 +1,7 @@
+export module uses_std;
+import std;
+
+export int f()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-build-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-build-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-build-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-install-stderr.txt b/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-install-stderr.txt
new file mode 100644
index 0000000..3589448
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-transitive-not-in-export-install-stderr.txt
@@ -0,0 +1,8 @@
+CMake Warning \(dev\) at .*/Modules/Compiler/CMakeCommonCompilerMacros.cmake:[0-9]* \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ .*/Modules/CMakeDetermineCompilerSupport.cmake:[0-9]* \(cmake_create_cxx_import_std\)
+ .*/Modules/CMakeTestCXXCompiler.cmake:[0-9]* \(CMAKE_DETERMINE_COMPILER_SUPPORT\)
+ CMakeLists.txt:[0-9]* \(project\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-transitive/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std-transitive/CMakeLists.txt
new file mode 100644
index 0000000..2894d67
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-transitive/CMakeLists.txt
@@ -0,0 +1,28 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+
+if (EXPORT_NO_STD)
+ # Block making C++ `import std` targets.
+ add_library(__CMAKE::CXX23 IMPORTED INTERFACE)
+endif ()
+
+project(cxx_modules_import_std_transitive CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+if (EXPORT_NO_STD)
+ set(package "import_std_export_no_std")
+else ()
+ set(package "import_std_not_in_export")
+endif ()
+find_package("${package}" REQUIRED)
+
+set(CMAKE_CXX_MODULE_STD 0)
+
+add_executable(main
+ main.cxx)
+target_link_libraries(main PRIVATE "CXXModules::${package}")
+
+add_test(NAME main COMMAND main)
diff --git a/Tests/RunCMake/CXXModules/examples/import-std-transitive/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std-transitive/main.cxx
new file mode 100644
index 0000000..a6dd8d8
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std-transitive/main.cxx
@@ -0,0 +1,6 @@
+import uses_std;
+
+int main(int argc, char* argv[])
+{
+ return f();
+}
diff --git a/Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt
new file mode 100644
index 0000000..bffcd66
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std/CMakeLists.txt
@@ -0,0 +1,15 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_minimum_required(VERSION 3.29)
+project(cxx_modules_import_std CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_MODULE_STD 1)
+
+add_executable(main
+ main.cxx)
+target_compile_features(main PRIVATE cxx_std_23)
+
+add_test(NAME main COMMAND main)
diff --git a/Tests/RunCMake/CXXModules/examples/import-std/main.cxx b/Tests/RunCMake/CXXModules/examples/import-std/main.cxx
new file mode 100644
index 0000000..6dafd01
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-std/main.cxx
@@ -0,0 +1,10 @@
+import std;
+
+int main(int argc, char* argv[])
+{
+ if (argc > 0 && argv[0]) {
+ std::string argv0 = argv[0];
+ std::cout << "program: " << argv0 << std::endl;
+ }
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt
index 0d18a66..c5958df 100644
--- a/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt
+++ b/Tests/RunCMake/CXXModules/examples/vs-without-flags/CMakeLists.txt
@@ -3,7 +3,7 @@ project(cxx_modules_vs_without_flags CXX)
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
-set(CMAKE_CXX_STANDARD 23)
+set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_SCAN_FOR_MODULES ON)
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
index 2bbe1c8..0c2a951 100644
--- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
+++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt
@@ -1 +1 @@
-^{"debugger":(true|false),"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":7}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$
+^{"debugger":(true|false),"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":7}]},{"kind":"configureLog","version":\[{"major":1,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":1}]},{"kind":"toolchains","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":false,"tls":(true|false),"version":{.*}}$
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch-stderr.txt b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch-stderr.txt
index 320c2ba..4b3774f 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch-stderr.txt
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnMatch-stderr.txt
@@ -1,3 +1,14 @@
+^CMake Deprecation Warning at CMP0128WarnMatch-(C|CXX)\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0128 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0128 is not set: Selection of language standard and extension
flags improved\. Run "cmake --help-policy CMP0128" for policy details\. Use
diff --git a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset-stderr.txt b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset-stderr.txt
index 068cba9..37a0767 100644
--- a/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset-stderr.txt
+++ b/Tests/RunCMake/CompileFeatures/CMP0128WarnUnset-stderr.txt
@@ -1,3 +1,14 @@
+^CMake Deprecation Warning at CMP0128WarnUnset-(C|CXX)\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0128 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
CMake Warning \(dev\) in CMakeLists\.txt:
Policy CMP0128 is not set: Selection of language standard and extension
flags improved\. Run "cmake --help-policy CMP0128" for policy details\. Use
diff --git a/Tests/RunCMake/CompileFeatures/compiler_introspection.cmake b/Tests/RunCMake/CompileFeatures/compiler_introspection.cmake
index f3360c7..1cfa27e 100644
--- a/Tests/RunCMake/CompileFeatures/compiler_introspection.cmake
+++ b/Tests/RunCMake/CompileFeatures/compiler_introspection.cmake
@@ -40,6 +40,6 @@ set(${lang}${standard}_EXT_FLAG ${CMAKE_${lang}${standard}_EXTENSION_COMPILE_OPT
endforeach()
endmacro()
-info(C 90 99 11 17 23)
-info(CXX 98 11 14 17 20 23)
+info(C 90 99 11 17 23 26)
+info(CXX 98 11 14 17 20 23 26)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")
diff --git a/Tests/RunCMake/Configure/RunCMakeTest.cmake b/Tests/RunCMake/Configure/RunCMakeTest.cmake
index 842a005..00d3272 100644
--- a/Tests/RunCMake/Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Configure/RunCMakeTest.cmake
@@ -4,51 +4,50 @@ run_cmake(ContinueAfterError)
run_cmake(CopyFileABI)
run_cmake(CustomTargetAfterError)
-# Use a single build tree for a few tests without cleaning.
-set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build)
-set(RunCMake_TEST_NO_CLEAN 1)
-file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
-file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-set(input "${RunCMake_TEST_BINARY_DIR}/CustomCMakeInput.txt")
-set(stamp "${RunCMake_TEST_BINARY_DIR}/CustomCMakeStamp.txt")
-set(depend "${RunCMake_TEST_BINARY_DIR}/CustomCMakeDepend.txt")
-set(output "${RunCMake_TEST_BINARY_DIR}/CustomCMakeOutput.txt")
-set(error "${RunCMake_TEST_BINARY_DIR}/CustomCMakeError.txt")
-file(WRITE "${input}" "1")
-file(WRITE "${depend}" "1")
-run_cmake(RerunCMake)
-execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
-file(WRITE "${input}" "2")
-run_cmake_command(RerunCMake-build1 ${CMAKE_COMMAND} --build .)
-file(WRITE "${depend}" "2")
-run_cmake_command(RerunCMake-build2 ${CMAKE_COMMAND} --build .)
-execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
-file(WRITE "${depend}" "3")
-file(WRITE "${error}" "3")
-set(RunCMake_TEST_OUTPUT_MERGE 1)
-run_cmake_command(RerunCMake-build3 ${CMAKE_COMMAND} --build .)
-if(MSVC_IDE)
- # Make sure that for Visual Studio the error occurs from within the build
- # system.
- file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/generate.stamp.list")
- file(WRITE "${error}" "4")
- # With Visual Studio the error must be on stdout, otherwise the error was not
- # emitted by ZERO_CHECK.
- set(RunCMake_TEST_OUTPUT_MERGE 0)
- run_cmake_command(RerunCMake-build4 ${CMAKE_COMMAND} --build .)
-endif()
-unset(RunCMake_TEST_OUTPUT_MERGE)
-unset(RunCMake_TEST_BINARY_DIR)
-unset(RunCMake_TEST_NO_CLEAN)
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RerunCMake-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ set(input "${RunCMake_TEST_BINARY_DIR}/CustomCMakeInput.txt")
+ set(stamp "${RunCMake_TEST_BINARY_DIR}/CustomCMakeStamp.txt")
+ set(depend "${RunCMake_TEST_BINARY_DIR}/CustomCMakeDepend.txt")
+ set(output "${RunCMake_TEST_BINARY_DIR}/CustomCMakeOutput.txt")
+ set(error "${RunCMake_TEST_BINARY_DIR}/CustomCMakeError.txt")
+ file(WRITE "${input}" "1")
+ file(WRITE "${depend}" "1")
+ run_cmake(RerunCMake)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
+ file(WRITE "${input}" "2")
+ run_cmake_command(RerunCMake-build1 ${CMAKE_COMMAND} --build .)
+ file(WRITE "${depend}" "2")
+ run_cmake_command(RerunCMake-build2 ${CMAKE_COMMAND} --build .)
+ execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1) # handle 1s resolution
+ file(WRITE "${depend}" "3")
+ file(WRITE "${error}" "3")
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(RerunCMake-build3 ${CMAKE_COMMAND} --build .)
+ if(MSVC_IDE)
+ # Make sure that for Visual Studio the error occurs from within the build
+ # system.
+ file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/generate.stamp.list")
+ file(WRITE "${error}" "4")
+ # With Visual Studio the error must be on stdout, otherwise the error was not
+ # emitted by ZERO_CHECK.
+ set(RunCMake_TEST_OUTPUT_MERGE 0)
+ run_cmake_command(RerunCMake-build4 ${CMAKE_COMMAND} --build .)
+ endif()
+endblock()
-# Use a single build tree for a few tests without cleaning.
-set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build)
-set(RunCMake_TEST_NO_CLEAN 1)
-file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
-file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-run_cmake(RemoveCache)
-file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
-run_cmake(RemoveCache)
+block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/RemoveCache-build)
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-step1")
+ run_cmake(RemoveCache)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ set(RunCMake_TEST_VARIANT_DESCRIPTION "-step2")
+ run_cmake(RemoveCache)
+endblock()
if(NOT RunCMake_GENERATOR MATCHES "^Ninja Multi-Config$")
run_cmake(NoCMAKE_CROSS_CONFIGS)
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index ffaa46c..f16e479 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -15,6 +15,9 @@ endif()
run_cmake(BadIndependentStep1)
run_cmake(BadIndependentStep2)
+run_cmake(TLSVersionBadArg)
+run_cmake(TLSVersionBadVar)
+run_cmake(TLSVersionBadEnv)
run_cmake(NoOptions)
run_cmake(SourceEmpty)
run_cmake(SourceMissing)
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadArg-result.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadArg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadArg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadArg-stderr.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadArg-stderr.txt
new file mode 100644
index 0000000..1231797
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadArg-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\):
+ TLS_VERSION 'bad-arg' not known
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_get_tls_version\)
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_add_download_command\)
+ TLSVersionBadArg\.cmake:[0-9]+ \(ExternalProject_Add\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadArg.cmake b/Tests/RunCMake/ExternalProject/TLSVersionBadArg.cmake
new file mode 100644
index 0000000..d212982
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadArg.cmake
@@ -0,0 +1,4 @@
+include(ExternalProject)
+set(ENV{CMAKE_TLS_VERSION} bad-env)
+set(CMAKE_TLS_VERSION bad-var)
+ExternalProject_Add(MyProj GIT_REPOSITORY "fake" TLS_VERSION bad-arg)
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-result.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-stderr.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-stderr.txt
new file mode 100644
index 0000000..38b0fb8
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\):
+ ENV{CMAKE_TLS_VERSION} 'bad-env' not known
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_get_tls_version\)
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_add_download_command\)
+ TLSVersionBadEnv\.cmake:[0-9]+ \(ExternalProject_Add\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadEnv.cmake b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv.cmake
new file mode 100644
index 0000000..8018642
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadEnv.cmake
@@ -0,0 +1,3 @@
+include(ExternalProject)
+set(ENV{CMAKE_TLS_VERSION} bad-env)
+ExternalProject_Add(MyProj GIT_REPOSITORY "fake")
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadVar-result.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadVar-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadVar-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadVar-stderr.txt b/Tests/RunCMake/ExternalProject/TLSVersionBadVar-stderr.txt
new file mode 100644
index 0000000..aaec60b
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadVar-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Error at [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(message\):
+ CMAKE_TLS_VERSION 'bad-var' not known
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_get_tls_version\)
+ [^
+]*/Modules/ExternalProject\.cmake:[0-9]+ \(_ep_add_download_command\)
+ TLSVersionBadVar\.cmake:[0-9]+ \(ExternalProject_Add\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/ExternalProject/TLSVersionBadVar.cmake b/Tests/RunCMake/ExternalProject/TLSVersionBadVar.cmake
new file mode 100644
index 0000000..f52dd2e
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/TLSVersionBadVar.cmake
@@ -0,0 +1,4 @@
+include(ExternalProject)
+set(ENV{CMAKE_TLS_VERSION} bad-env)
+set(CMAKE_TLS_VERSION bad-var)
+ExternalProject_Add(MyProj GIT_REPOSITORY "fake")
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
index 4c739d8..3ae1ba7 100644
--- a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
+++ b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
@@ -2,6 +2,6 @@ CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\)
The argument for FOUND_VAR is "badfoundvar_FOUND", but only
"BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names.
Call Stack \(most recent call first\):
- FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\)
- BadFoundVar.cmake:3 \(find_package\)
- CMakeLists.txt:3 \(include\)
+ FindBadFoundVar.cmake:[0-9]+ \(find_package_handle_standard_args\)
+ BadFoundVar.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FPHSA/BeforeProject-Error-result.txt b/Tests/RunCMake/FPHSA/BeforeProject-Error-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BeforeProject-Error-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FPHSA/BeforeProject-Error-stderr.txt b/Tests/RunCMake/FPHSA/BeforeProject-Error-stderr.txt
new file mode 100644
index 0000000..c8e53fc
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BeforeProject-Error-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at [^
+]*/Modules/FindPackageHandleStandardArgs\.cmake:[0-9]+ \(message\):
+ Could NOT find BeforeProject \(missing: SOME_VAR\)
+
+ Hint: The project\(\) command has not yet been called\. It sets up
+ system-specific search paths\.
+Call Stack \(most recent call first\):
+ [^
+]*/Modules/FindPackageHandleStandardArgs\.cmake:[0-9]+ \(_FPHSA_FAILURE_MESSAGE\)
+ FindBeforeProject\.cmake:[0-9]+ \(find_package_handle_standard_args\)
+ BeforeProject-Error\.cmake:[0-9]+ \(find_package\)
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/FPHSA/BeforeProject-Error.cmake b/Tests/RunCMake/FPHSA/BeforeProject-Error.cmake
new file mode 100644
index 0000000..53a8073
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BeforeProject-Error.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_package(BeforeProject REQUIRED)
diff --git a/Tests/RunCMake/FPHSA/BeforeProject-Missing-stdout.txt b/Tests/RunCMake/FPHSA/BeforeProject-Missing-stdout.txt
new file mode 100644
index 0000000..05df0b0
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BeforeProject-Missing-stdout.txt
@@ -0,0 +1,2 @@
+-- Could NOT find BeforeProject \(missing: SOME_VAR\)[ ]*
+Hint: The project\(\) command has not yet been called\. It sets up system-specific search paths\.
diff --git a/Tests/RunCMake/FPHSA/BeforeProject-Missing.cmake b/Tests/RunCMake/FPHSA/BeforeProject-Missing.cmake
new file mode 100644
index 0000000..8d44ca9
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BeforeProject-Missing.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+find_package(BeforeProject)
diff --git a/Tests/RunCMake/FPHSA/CMakeLists.txt b/Tests/RunCMake/FPHSA/CMakeLists.txt
index 93ee9df..dc34259 100644
--- a/Tests/RunCMake/FPHSA/CMakeLists.txt
+++ b/Tests/RunCMake/FPHSA/CMakeLists.txt
@@ -1,3 +1,8 @@
cmake_minimum_required(VERSION 3.5)
+if(RunCMake_TEST MATCHES "^BeforeProject")
+ include(${RunCMake_TEST}.cmake)
+ project(${RunCMake_TEST} NONE)
+ return()
+endif()
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FPHSA/FindBeforeProject.cmake b/Tests/RunCMake/FPHSA/FindBeforeProject.cmake
new file mode 100644
index 0000000..6bf49f1
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/FindBeforeProject.cmake
@@ -0,0 +1,3 @@
+set(SOME_VAR FALSE)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(BeforeProject REQUIRED_VARS SOME_VAR)
diff --git a/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt b/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
index 722b50b..8ee6ec1 100644
--- a/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
+++ b/Tests/RunCMake/FPHSA/NameMismatch-stderr.txt
@@ -5,9 +5,9 @@ CMake Warning \(dev\) at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \
`find_package` result variables \(e.g., `_FOUND`\) to follow a certain
pattern.
Call Stack \(most recent call first\):
- FindNameMismatch.cmake:3 \(find_package_handle_standard_args\)
- NameMismatch.cmake:3 \(find_package\)
- CMakeLists.txt:3 \(include\)
+ FindNameMismatch.cmake:[0-9]+ \(find_package_handle_standard_args\)
+ NameMismatch.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning \(dev\) at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
@@ -17,7 +17,7 @@ CMake Warning \(dev\) at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \
`find_package` result variables \(e.g., `_FOUND`\) to follow a certain
pattern.
Call Stack \(most recent call first\):
- FindNameMismatchOld.cmake:3 \(find_package_handle_standard_args\)
- NameMismatch.cmake:4 \(find_package\)
- CMakeLists.txt:3 \(include\)
+ FindNameMismatchOld.cmake:[0-9]+ \(find_package_handle_standard_args\)
+ NameMismatch.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
index 3b095a6..be9b127 100644
--- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -1,6 +1,8 @@
include(RunCMake)
run_cmake(BadFoundVar)
+run_cmake(BeforeProject-Error)
+run_cmake(BeforeProject-Missing)
run_cmake(NameMismatch)
# The pseudo module will "find" a package with the given version. Check if the
diff --git a/Tests/RunCMake/FetchContent/VarPassthroughs.cmake b/Tests/RunCMake/FetchContent/VarPassthroughs.cmake
index ad743d8..279c127 100644
--- a/Tests/RunCMake/FetchContent/VarPassthroughs.cmake
+++ b/Tests/RunCMake/FetchContent/VarPassthroughs.cmake
@@ -5,6 +5,7 @@ set(CMAKE_TLS_VERIFY BBBB)
set(CMAKE_TLS_CAINFO CCCC)
set(CMAKE_NETRC DDDD)
set(CMAKE_NETRC_FILE EEEE)
+set(CMAKE_TLS_VERSION FFFF)
FetchContent_Declare(PassThrough
DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed"
@@ -21,6 +22,10 @@ if(NOT contents MATCHES "CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY \\[==\\[AAAA\\]==\\
message(FATAL_ERROR "Missing CMAKE_EP_GIT_REMOTE_UPDATE_STRATEGY")
endif()
+if(NOT contents MATCHES "CMAKE_TLS_VERSION \\[==\\[FFFF\\]==\\]")
+ message(FATAL_ERROR "Missing CMAKE_TLS_VERSION")
+endif()
+
if(NOT contents MATCHES "CMAKE_TLS_VERIFY \\[==\\[BBBB\\]==\\]")
message(FATAL_ERROR "Missing CMAKE_TLS_VERIFY")
endif()
diff --git a/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py b/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
index 49dfe87..9410c7e 100644
--- a/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
+++ b/Tests/RunCMake/FileAPI/cmakeFiles-v1-check.py
@@ -3,7 +3,7 @@ from check_index import *
def check_objects(o):
assert is_list(o)
assert len(o) == 1
- check_index_object(o[0], "cmakeFiles", 1, 0, check_object_cmakeFiles)
+ check_index_object(o[0], "cmakeFiles", 1, 1, check_object_cmakeFiles)
def check_input(actual, expected):
assert is_dict(actual)
@@ -23,8 +23,27 @@ def check_input(actual, expected):
assert sorted(actual.keys()) == sorted(expected_keys)
+def check_glob_dependent(actual, expected):
+ assert is_dict(actual)
+
+ if "followSymlinks" in expected:
+ assert is_bool(actual["followSymlinks"], expected["followSymlinks"])
+
+ if "listDirectories" in expected:
+ assert is_bool(actual["listDirectories"], expected["listDirectories"])
+
+ if "recurse" in expected:
+ assert is_bool(actual["recurse"], expected["recurse"])
+
+ if "relative" in expected:
+ assert matches(actual["relative"], expected["relative"])
+
+ check_list_match(lambda a, e: matches(a, e), actual["paths"], expected["paths"], allow_extra=True)
+
+ assert sorted(actual.keys()) == sorted(expected.keys())
+
def check_object_cmakeFiles(o):
- assert sorted(o.keys()) == ["inputs", "kind", "paths", "version"]
+ assert sorted(o.keys()) == ["globsDependent", "inputs", "kind", "paths", "version"]
# The "kind" and "version" members are handled by check_index_object.
assert is_dict(o["paths"])
assert sorted(o["paths"].keys()) == ["build", "source"]
@@ -82,12 +101,33 @@ def check_object_cmakeFiles(o):
},
]
+ expected_globs = [
+ {
+ "expression": "^.*/Tests/RunCMake/FileAPI/dir/\\*$",
+ "paths": [
+ "^.*/Tests/RunCMake/FileAPI/dir/dir$",
+ "^.*/Tests/RunCMake/FileAPI/dir/dirtest\\.cmake$"
+ ],
+ "listDirectories": True,
+ },
+ {
+ "expression": "^.*/Tests/RunCMake/FileAPI/dir/\\*\\.cmake$",
+ "paths": [
+ "^dir/dirtest\\.cmake$"
+ ],
+ "followSymlinks": True,
+ "recurse": True,
+ "relative": "^.*/Tests/RunCMake/FileAPI$"
+ }
+ ]
+
inSource = os.path.dirname(o["paths"]["build"]) == o["paths"]["source"]
if inSource:
for e in expected:
e["path"] = e["path"].replace("^.*/Tests/RunCMake/FileAPI/", "^", 1)
check_list_match(lambda a, e: matches(a["path"], e["path"]), o["inputs"], expected, check=check_input, allow_extra=True)
+ check_list_match(lambda a, e: matches(a["expression"], e["expression"]), o["globsDependent"], expected_globs, check=check_glob_dependent, allow_extra=True)
assert is_dict(index)
assert sorted(index.keys()) == ["cmake", "objects", "reply"]
diff --git a/Tests/RunCMake/FileAPI/cmakeFiles-v1.cmake b/Tests/RunCMake/FileAPI/cmakeFiles-v1.cmake
index 4d4d757..b98a283 100644
--- a/Tests/RunCMake/FileAPI/cmakeFiles-v1.cmake
+++ b/Tests/RunCMake/FileAPI/cmakeFiles-v1.cmake
@@ -5,4 +5,14 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/generated.cmake" "")
include("${CMAKE_CURRENT_BINARY_DIR}/generated.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/../FileAPIDummyFile.cmake")
+file(GLOB var
+ CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/dir/*")
+
+file(GLOB_RECURSE var
+ FOLLOW_SYMLINKS
+ RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
+ CONFIGURE_DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/dir/*.cmake")
+
add_subdirectory(dir)
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
index 5f211eb..670bdda 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt
@@ -1 +1,2 @@
--- g_ir_scanner: .*/g-ir-scanner
+-- g_ir_scanner: [^
+]*g-ir-scanner
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_MULTIPLE_VALUES.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_MULTIPLE_VALUES.cmake
new file mode 100644
index 0000000..19ee908
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_MULTIPLE_VALUES.cmake
@@ -0,0 +1,31 @@
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
+if(WIN32)
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bletch")
+else()
+ set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bletch")
+endif()
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(BLETCH QUIET bletch)
+
+if (NOT BLETCH_FOUND)
+ message(FATAL_ERROR "Failed to find embedded package bletch via CMAKE_PREFIX_PATH")
+endif ()
+
+set(expected_value "item1;item2;item3;item with spaces")
+pkg_get_variable(bletchvar1 bletch multiple_values1)
+pkg_get_variable(bletchvar2 bletch multiple_values2)
+
+string(FIND "${bletchvar1}" ";" IS_VARIABLE_A_LIST1)
+string(FIND "${bletchvar2}" ";" IS_VARIABLE_A_LIST2)
+
+if (IS_VARIABLE_A_LIST1 EQUAL -1 OR IS_VARIABLE_A_LIST2 EQUAL -1)
+ message(FATAL_ERROR "Failed to fetch variable multiple_values from embedded package bletch as a list")
+endif()
+
+if (NOT (bletchvar1 STREQUAL expected_value AND bletchvar2 STREQUAL expected_value))
+ message(NOTICE "multiple_values1=${bletchvar1} and expected_value=${expected_value}")
+ message(NOTICE "multiple_values2=${bletchvar2} and expected_value=${expected_value}")
+ message(FATAL_ERROR "Failed to fetch variable multiple_values from embedded package bletch with escaped spaces")
+endif()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index 7af425a..3466636 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -54,6 +54,7 @@ Libs: -L\${libdir}
run_cmake(FindPkgConfig_GET_VARIABLE_DEFINE_VARIABLES)
run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH)
run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH)
+ run_cmake(FindPkgConfig_GET_VARIABLE_MULTIPLE_VALUES)
run_cmake(FindPkgConfig_cache_variables)
run_cmake(FindPkgConfig_IMPORTED_TARGET)
run_cmake(FindPkgConfig_VERSION_OPERATORS)
diff --git a/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc
index 04d2c1b..87c3613 100644
--- a/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc
+++ b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc
@@ -4,9 +4,11 @@ libdir=${exec_prefix}/lib
includedir=${prefix}/include
jackpot=bletch-lives
+multiple_values1="item1 item2 item3 item\ with\ spaces"
+multiple_values2='item1 item2 item3 item\ with\ spaces'
Name: Bletch
-Description: Dummy packaget to test variable support
+Description: Dummy package to test variable support
Version: 1.0
Libs: -L${libdir} -lbletch
Cflags: -Dbletch_version=1
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
index 32d92d8..5791993 100644
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/CMakeLists.txt
@@ -1,6 +1,6 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.17)
if(RunCMake_TEST STREQUAL "LOCATION")
cmake_minimum_required(VERSION 2.8.12) # Leave CMP0026 unset.
endif()
project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
index b613ad1..07052eb 100644
--- a/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/RunCMakeTest.cmake
@@ -13,6 +13,9 @@ run_cmake(LinkImplementationCycle5)
run_cmake(LinkImplementationCycle6)
run_cmake(LOCATION)
run_cmake(SOURCES)
+run_cmake(TransitiveBuild)
+run_cmake(TransitiveLink-CMP0166-OLD)
+run_cmake(TransitiveLink-CMP0166-NEW)
block()
run_cmake(Scope)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild-check.cmake
new file mode 100644
index 0000000..65adfaf
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild-check.cmake
@@ -0,0 +1,25 @@
+set(expect [[
+# file\(GENERATE\) produced:
+main INCLUDE_DIRECTORIES: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dirM;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dir1'
+main SYSTEM_INCLUDE_DIRECTORIES: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/sys1'
+main COMPILE_DEFINITIONS: 'DEFM;DEF1'
+main COMPILE_FEATURES: 'cxx_std_20;cxx_std_11'
+main COMPILE_OPTIONS: '-optM;-opt1'
+main PRECOMPILE_HEADERS: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.h;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.h'
+main SOURCES: 'main.c;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.c'
+main AUTOMOC_MACRO_NAMES: 'MOCM;MOC1'
+main AUTOUIC_OPTIONS: '-uicM;-uic1'
+]])
+
+string(REGEX REPLACE "\r\n" "\n" expect "${expect}")
+string(REGEX REPLACE "\n+$" "" expect "${expect}")
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/out.txt" actual)
+string(REGEX REPLACE "\r\n" "\n" actual "${actual}")
+string(REGEX REPLACE "\n+$" "" actual "${actual}")
+
+if(NOT actual MATCHES "^${expect}$")
+ string(REPLACE "\n" "\n expect> " expect " expect> ${expect}")
+ string(REPLACE "\n" "\n actual> " actual " actual> ${actual}")
+ message(FATAL_ERROR "Expected file(GENERATE) output:\n${expect}\ndoes not match actual output:\n${actual}")
+endif()
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild.cmake
new file mode 100644
index 0000000..8f8eb96
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveBuild.cmake
@@ -0,0 +1,66 @@
+enable_language(C)
+set(CMAKE_PCH_EXTENSION "") # suppress cmake_pch from SOURCES
+
+add_library(foo1 STATIC empty.c)
+target_link_libraries(foo1 PRIVATE foo2 foo3)
+target_include_directories(foo1 INTERFACE dir1)
+target_compile_definitions(foo1 INTERFACE DEF1)
+target_compile_features(foo1 INTERFACE cxx_std_11)
+target_compile_options(foo1 INTERFACE -opt1)
+target_precompile_headers(foo1 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty1.h")
+target_sources(foo1 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty1.c")
+set_target_properties(foo1 PROPERTIES
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/sys1"
+ INTERFACE_AUTOMOC_MACRO_NAMES "MOC1"
+ INTERFACE_AUTOUIC_OPTIONS "-uic1"
+ )
+
+add_library(foo2 STATIC empty.c)
+target_include_directories(foo2 INTERFACE dir2)
+target_compile_definitions(foo2 INTERFACE DEF2)
+target_compile_features(foo2 INTERFACE cxx_std_14)
+target_compile_options(foo2 INTERFACE -opt2)
+target_precompile_headers(foo2 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty2.h")
+target_sources(foo2 INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/empty2.c")
+set_target_properties(foo2 PROPERTIES
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/sys2"
+ INTERFACE_AUTOMOC_MACRO_NAMES "MOC2"
+ INTERFACE_AUTOUIC_OPTIONS "-uic2"
+ )
+
+add_library(foo3 STATIC empty.c)
+target_include_directories(foo3 PRIVATE dir3)
+target_compile_definitions(foo3 PRIVATE DEF3)
+target_compile_features(foo3 PRIVATE cxx_std_17)
+target_compile_options(foo3 PRIVATE -opt3)
+target_precompile_headers(foo3 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/empty3.h")
+target_sources(foo3 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/empty3.c")
+set_target_properties(foo3 PROPERTIES
+ SYSTEM_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/sys3"
+ AUTOMOC_MACRO_NAMES "MOC3"
+ AUTOUIC_OPTIONS "-uic3"
+ )
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE foo1)
+target_include_directories(main PRIVATE dirM)
+target_compile_definitions(main PRIVATE DEFM)
+target_compile_features(main PRIVATE cxx_std_20)
+target_compile_options(main PRIVATE -optM)
+target_precompile_headers(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/empty.h")
+set_target_properties(main PROPERTIES
+ AUTOMOC_MACRO_NAMES "MOCM"
+ AUTOUIC_OPTIONS "-uicM"
+ )
+
+file(GENERATE OUTPUT out.txt CONTENT "# file(GENERATE) produced:
+main INCLUDE_DIRECTORIES: '$<TARGET_PROPERTY:main,INCLUDE_DIRECTORIES>'
+main SYSTEM_INCLUDE_DIRECTORIES: '$<TARGET_PROPERTY:main,SYSTEM_INCLUDE_DIRECTORIES>'
+main COMPILE_DEFINITIONS: '$<TARGET_PROPERTY:main,COMPILE_DEFINITIONS>'
+main COMPILE_FEATURES: '$<TARGET_PROPERTY:main,COMPILE_FEATURES>'
+main COMPILE_OPTIONS: '$<TARGET_PROPERTY:main,COMPILE_OPTIONS>'
+main PRECOMPILE_HEADERS: '$<TARGET_PROPERTY:main,PRECOMPILE_HEADERS>'
+main SOURCES: '$<TARGET_PROPERTY:main,SOURCES>'
+main AUTOMOC_MACRO_NAMES: '$<TARGET_PROPERTY:main,AUTOMOC_MACRO_NAMES>'
+main AUTOUIC_OPTIONS: '$<TARGET_PROPERTY:main,AUTOUIC_OPTIONS>'
+")
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-check.cmake
new file mode 100644
index 0000000..7ea95b8
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-check.cmake
@@ -0,0 +1,8 @@
+set(expect [[
+# file\(GENERATE\) produced:
+main LINK_LIBRARIES: 'foo1' # not transitive
+main LINK_DIRECTORIES: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dirM;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dir1;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dir2'
+main LINK_OPTIONS: '-optM;-opt1;-opt2'
+main LINK_DEPENDS: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-build/depM;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-build/dep1;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW-build/dep2'
+]])
+include(${CMAKE_CURRENT_LIST_DIR}/TransitiveLink-check-common.cmake)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW.cmake
new file mode 100644
index 0000000..658dd84
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0166 NEW)
+include(TransitiveLink-common.cmake)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-check.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-check.cmake
new file mode 100644
index 0000000..2d430c2
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-check.cmake
@@ -0,0 +1,8 @@
+set(expect [[
+# file\(GENERATE\) produced:
+main LINK_LIBRARIES: 'foo1' # not transitive
+main LINK_DIRECTORIES: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dirM;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/dir1'
+main LINK_OPTIONS: '-optM;-opt1'
+main LINK_DEPENDS: '[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-build/depM;[^';]*/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD-build/dep1'
+]])
+include(${CMAKE_CURRENT_LIST_DIR}/TransitiveLink-check-common.cmake)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD.cmake
new file mode 100644
index 0000000..a4a4599
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-CMP0166-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0166 OLD)
+include(TransitiveLink-common.cmake)
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-check-common.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-check-common.cmake
new file mode 100644
index 0000000..42e63bc
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-check-common.cmake
@@ -0,0 +1,12 @@
+string(REGEX REPLACE "\r\n" "\n" expect "${expect}")
+string(REGEX REPLACE "\n+$" "" expect "${expect}")
+
+file(READ "${RunCMake_TEST_BINARY_DIR}/out.txt" actual)
+string(REGEX REPLACE "\r\n" "\n" actual "${actual}")
+string(REGEX REPLACE "\n+$" "" actual "${actual}")
+
+if(NOT actual MATCHES "^${expect}$")
+ string(REPLACE "\n" "\n expect> " expect " expect> ${expect}")
+ string(REPLACE "\n" "\n actual> " actual " actual> ${actual}")
+ message(FATAL_ERROR "Expected file(GENERATE) output:\n${expect}\ndoes not match actual output:\n${actual}")
+endif()
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-common.cmake b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-common.cmake
new file mode 100644
index 0000000..c120366
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/TransitiveLink-common.cmake
@@ -0,0 +1,42 @@
+enable_language(C)
+
+add_library(foo1 STATIC empty.c)
+target_link_libraries(foo1 PRIVATE foo2 foo3)
+target_link_directories(foo1 INTERFACE dir1)
+target_link_options(foo1 INTERFACE -opt1)
+set_target_properties(foo1 PROPERTIES
+ INTERFACE_LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep1"
+ )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep1" "")
+
+add_library(foo2 STATIC empty.c)
+target_link_directories(foo2 INTERFACE dir2)
+target_link_options(foo2 INTERFACE -opt2)
+set_target_properties(foo2 PROPERTIES
+ INTERFACE_LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep2"
+ )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep2" "")
+
+add_library(foo3 STATIC empty.c)
+target_link_directories(foo3 PRIVATE dir3)
+target_link_options(foo3 PRIVATE -opt3)
+set_target_properties(foo3 PROPERTIES
+ LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dep3"
+ )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep3" "")
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE foo1)
+target_link_directories(main PRIVATE dirM)
+target_link_options(main PRIVATE -optM)
+set_target_properties(main PROPERTIES
+ LINK_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/depM"
+ )
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/depM" "")
+
+file(GENERATE OUTPUT out.txt CONTENT "# file(GENERATE) produced:
+main LINK_LIBRARIES: '$<TARGET_PROPERTY:main,LINK_LIBRARIES>' # not transitive
+main LINK_DIRECTORIES: '$<TARGET_PROPERTY:main,LINK_DIRECTORIES>'
+main LINK_OPTIONS: '$<TARGET_PROPERTY:main,LINK_OPTIONS>'
+main LINK_DEPENDS: '$<TARGET_PROPERTY:main,LINK_DEPENDS>'
+")
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.h b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty.h
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.c b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.c
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.h b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty1.h
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.h b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty2.h
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.h b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/empty3.h
diff --git a/Tests/RunCMake/GenEx-TARGET_PROPERTY/main.c b/Tests/RunCMake/GenEx-TARGET_PROPERTY/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/GenEx-TARGET_PROPERTY/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h
index dac4fda..e0e423d 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h
index b6e2a4a..cfc1187 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h
index 0b1dcba..e2c132d 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h
index 5e3ac9f..b54eef5 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h
index 3ba2d2e..6013dcd 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h
index 3c7e093..7a5a573 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h
index 11f8042..388dbc9 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h
index b6e2a4a..cfc1187 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h
index 1481acd..97b988d 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h
index b6e2a4a..cfc1187 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h
index 3ba2d2e..6013dcd 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h
index 3c7e093..7a5a573 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h
index 3ba2d2e..6013dcd 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h
index 3c7e093..7a5a573 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h
index bf9163e..e64c45f 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h
@@ -33,6 +33,7 @@
# define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSHARED_NO_DEPRECATED
# define LIBSHARED_NO_DEPRECATED
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h
index 5e3ac9f..b54eef5 100644
--- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h
+++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h
@@ -33,6 +33,7 @@
# define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED
#endif
+/* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef LIBSTATIC_NO_DEPRECATED
# define LIBSTATIC_NO_DEPRECATED
diff --git a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
index 6e064a7..17f4c86 100644
--- a/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GoogleTest/RunCMakeTest.cmake
@@ -134,7 +134,7 @@ function(run_GoogleTestLauncher DISCOVERY_MODE)
${CMAKE_CTEST_COMMAND}
-C Debug
-V
- --no-label-sumary
+ --no-label-summary
)
endfunction()
@@ -197,7 +197,7 @@ function(run_GoogleTest_discovery_timeout DISCOVERY_MODE)
${CMAKE_CTEST_COMMAND}
-C Debug
-R discovery_timeout_test
- --no-label-sumary
+ --no-label-summary
)
endfunction()
diff --git a/Tests/RunCMake/IAR/RunCMakeTest.cmake b/Tests/RunCMake/IAR/RunCMakeTest.cmake
index 2049740..2fefa6a 100644
--- a/Tests/RunCMake/IAR/RunCMakeTest.cmake
+++ b/Tests/RunCMake/IAR/RunCMakeTest.cmake
@@ -8,6 +8,13 @@ if(RunCMake_GENERATOR MATCHES "Makefile|Ninja")
endif()
endif()
+function(run_toolchain case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
+ run_cmake_with_options(${case} ${ARGN})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .)
+endfunction()
+
foreach(_iar_toolchain IN LISTS _iar_toolchains)
message(STATUS "Found IAR toolchain: ${_iar_toolchain}")
cmake_path(GET _iar_toolchain PARENT_PATH BIN_DIR)
@@ -15,16 +22,22 @@ foreach(_iar_toolchain IN LISTS _iar_toolchains)
cmake_path(GET TOOLKIT_DIR FILENAME ARCH)
# Sets the minimal requirements for linking each target architecture
- if(ARCH STREQUAL rl78)
- set(LINK_OPTS
-"--config_def _STACK_SIZE=256 \
---config_def _NEAR_HEAP_SIZE=0x400 \
---config_def _FAR_HEAP_SIZE=4096 \
---config_def _HUGE_HEAP_SIZE=0 \
---config_def _NEAR_CONST_LOCATION_START=0x2000 \
---config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 \
---define_symbol _NEAR_CONST_LOCATION=0 \
---config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf" )
+ if(ARCH STREQUAL "avr")
+ string(CONCAT LINK_OPTS
+ "-I${TOOLKIT_DIR}/lib "
+ "-f ${TOOLKIT_DIR}/src/template/lnk3s.xcl "
+ )
+ elseif(ARCH STREQUAL "rl78")
+ string(CONCAT LINK_OPTS
+ "--config_def _STACK_SIZE=256 "
+ "--config_def _NEAR_HEAP_SIZE=0x400 "
+ "--config_def _FAR_HEAP_SIZE=4096 "
+ "--config_def _HUGE_HEAP_SIZE=0 "
+ "--config_def _NEAR_CONST_LOCATION_START=0x2000 "
+ "--config_def _NEAR_CONST_LOCATION_SIZE=0x6F00 "
+ "--define_symbol _NEAR_CONST_LOCATION=0 "
+ "--config ${TOOLKIT_DIR}/config/lnkrl78_s3.icf "
+ )
else()
set(LINK_OPTS "")
endif()
@@ -35,30 +48,26 @@ foreach(_iar_toolchain IN LISTS _iar_toolchains)
PATHS ${BIN_DIR}
REQUIRED )
- set(RunCMake_TEST_OPTIONS
+ run_toolchain(iar-c
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_C_COMPILER=${_iar_toolchain}
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
)
- run_cmake(iar-c)
- set(RunCMake_TEST_OPTIONS
+ run_toolchain(iar-cxx
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_CXX_COMPILER=${_iar_toolchain}
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
)
- run_cmake(iar-cxx)
- set(RunCMake_TEST_OPTIONS
+ run_toolchain(iar-asm
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_ASM_COMPILER=${IAR_ASSEMBLER}
- )
- run_cmake(iar-asm)
+ )
- set(RunCMake_TEST_OPTIONS
+ run_toolchain(iar-lib
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_C_COMPILER=${_iar_toolchain}
-DCMAKE_EXE_LINKER_FLAGS=${LINK_OPTS}
- )
- run_cmake(iar-lib)
+ )
endforeach()
diff --git a/Tests/RunCMake/IAR/iar-asm.cmake b/Tests/RunCMake/IAR/iar-asm.cmake
index 7ff64f6..1c19182 100644
--- a/Tests/RunCMake/IAR/iar-asm.cmake
+++ b/Tests/RunCMake/IAR/iar-asm.cmake
@@ -1,5 +1,4 @@
enable_language(ASM)
-add_executable(exec-asm)
-target_sources(exec-asm PRIVATE module.asm)
+add_executable(exec-asm module.asm)
target_link_options(exec-asm PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-c.cmake b/Tests/RunCMake/IAR/iar-c.cmake
index a36f096..5e7e740 100644
--- a/Tests/RunCMake/IAR/iar-c.cmake
+++ b/Tests/RunCMake/IAR/iar-c.cmake
@@ -1,5 +1,5 @@
enable_language(C)
-add_executable(exec-c)
-target_sources(exec-c PRIVATE module.c)
+add_executable(exec-c module.c)
+target_compile_options(exec-c PRIVATE -e)
target_link_options(exec-c PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-cxx.cmake b/Tests/RunCMake/IAR/iar-cxx.cmake
index 6b005b5..6056d32 100644
--- a/Tests/RunCMake/IAR/iar-cxx.cmake
+++ b/Tests/RunCMake/IAR/iar-cxx.cmake
@@ -1,5 +1,5 @@
enable_language(CXX)
-add_executable(exec-cxx)
-target_sources(exec-cxx PRIVATE module.cxx)
+add_executable(exec-cxx module.cxx)
+target_compile_options(exec-cxx PRIVATE -e)
target_link_options(exec-cxx PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/IAR/iar-lib.cmake b/Tests/RunCMake/IAR/iar-lib.cmake
index 78b3136..17e6c95 100644
--- a/Tests/RunCMake/IAR/iar-lib.cmake
+++ b/Tests/RunCMake/IAR/iar-lib.cmake
@@ -1,10 +1,9 @@
enable_language(C)
-add_library(iar-test-lib)
-target_sources(iar-test-lib PRIVATE libmod.c)
+add_library(iar-test-lib libmod.c)
-add_executable(exec-lib-c)
-target_sources(exec-lib-c PRIVATE module.c)
+add_executable(exec-lib-c module.c)
+target_compile_options(exec-lib-c PRIVATE -e)
target_compile_definitions(exec-lib-c PRIVATE __USE_LIBFUN)
-target_link_libraries(exec-lib-c LINK_PUBLIC iar-test-lib)
+target_link_libraries(exec-lib-c PRIVATE iar-test-lib)
target_link_options(exec-lib-c PRIVATE ${LINKER_OPTS})
diff --git a/Tests/RunCMake/LanguageStandards/CMakeLists.txt b/Tests/RunCMake/LanguageStandards/CMakeLists.txt
new file mode 100644
index 0000000..94e43ba
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.29)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/LanguageStandards/Inspect.cmake b/Tests/RunCMake/LanguageStandards/Inspect.cmake
new file mode 100644
index 0000000..b0f2e60
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/Inspect.cmake
@@ -0,0 +1,14 @@
+enable_language(C)
+enable_language(CXX)
+
+set(info "")
+foreach(var
+ CMAKE_C_STANDARD_DEFAULT
+ CMAKE_CXX_STANDARD_DEFAULT
+ )
+ if(DEFINED ${var})
+ string(APPEND info "set(${var} \"${${var}}\")\n")
+ endif()
+endforeach()
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")
diff --git a/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake b/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake
new file mode 100644
index 0000000..bc9dfd4
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/RunCMakeTest.cmake
@@ -0,0 +1,32 @@
+include(RunCMake)
+
+# Detect information from the toolchain:
+# - CMAKE_C_STANDARD_DEFAULT
+# - CMAKE_CXX_STANDARD_DEFAULT
+run_cmake(Inspect)
+include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
+
+function(run_StdLatest lang)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/StdLatest-${lang}-build)
+ run_cmake(StdLatest-${lang})
+ set(RunCMake_TEST_NO_CLEAN 1)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(StdLatest-${lang}-build ${CMAKE_COMMAND} --build . --config Debug)
+endfunction()
+
+if(NOT CMake_NO_C_STANDARD AND DEFINED CMAKE_C_STANDARD_DEFAULT)
+ run_StdLatest(C)
+endif()
+if(NOT CMake_NO_CXX_STANDARD AND DEFINED CMAKE_CXX_STANDARD_DEFAULT)
+ run_StdLatest(CXX)
+endif()
+if(CMake_TEST_CUDA)
+ run_StdLatest(CUDA)
+endif()
+if(CMake_TEST_HIP)
+ run_StdLatest(HIP)
+endif()
+if(CMake_TEST_OBJC)
+ run_StdLatest(OBJC)
+ run_StdLatest(OBJCXX)
+endif()
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt
new file mode 100644
index 0000000..57aad4d
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-C-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_C_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C.c b/Tests/RunCMake/LanguageStandards/StdLatest-C.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-C.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake
new file mode 100644
index 0000000..54f5a19
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-C.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+message(STATUS "CMAKE_C_STANDARD_LATEST='${CMAKE_C_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-C.c)
+target_compile_features(StdLatest PRIVATE c_std_${CMAKE_C_STANDARD_LATEST})
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt
new file mode 100644
index 0000000..207541a
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_CUDA_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake
new file mode 100644
index 0000000..496abb0
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cmake
@@ -0,0 +1,4 @@
+enable_language(CUDA)
+message(STATUS "CMAKE_CUDA_STANDARD_LATEST='${CMAKE_CUDA_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-CUDA.cu)
+target_compile_features(StdLatest PRIVATE cuda_std_${CMAKE_CUDA_STANDARD_LATEST})
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CUDA.cu
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt
new file mode 100644
index 0000000..db83723
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_CXX_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake
new file mode 100644
index 0000000..34aba55
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cmake
@@ -0,0 +1,5 @@
+enable_language(CXX)
+set(CMAKE_CXX_SCAN_FOR_MODULES OFF) # In case C++20 or higher is the latest.
+message(STATUS "CMAKE_CXX_STANDARD_LATEST='${CMAKE_CXX_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-CXX.cxx)
+target_compile_features(StdLatest PRIVATE cxx_std_${CMAKE_CXX_STANDARD_LATEST})
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-CXX.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt
new file mode 100644
index 0000000..681ea9e
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_HIP_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake
new file mode 100644
index 0000000..4eaa56c
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.cmake
@@ -0,0 +1,4 @@
+enable_language(HIP)
+message(STATUS "CMAKE_HIP_STANDARD_LATEST='${CMAKE_HIP_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-HIP.hip)
+target_compile_features(StdLatest PRIVATE hip_std_${CMAKE_HIP_STANDARD_LATEST})
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-HIP.hip
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt
new file mode 100644
index 0000000..577c126
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_OBJC_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake
new file mode 100644
index 0000000..6d05ab6
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.cmake
@@ -0,0 +1,4 @@
+enable_language(OBJC)
+message(STATUS "CMAKE_OBJC_STANDARD_LATEST='${CMAKE_OBJC_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-OBJC.m)
+set_property(TARGET StdLatest PROPERTY OBJC_STANDARD "${CMAKE_OBJC_STANDARD_LATEST}")
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJC.m
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt
new file mode 100644
index 0000000..0c5567b
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX-stdout.txt
@@ -0,0 +1 @@
+-- CMAKE_OBJCXX_STANDARD_LATEST='[0-9][0-9]'
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake
new file mode 100644
index 0000000..c7418d0
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.cmake
@@ -0,0 +1,4 @@
+enable_language(OBJCXX)
+message(STATUS "CMAKE_OBJCXX_STANDARD_LATEST='${CMAKE_OBJCXX_STANDARD_LATEST}'")
+add_executable(StdLatest StdLatest-OBJCXX.mm)
+set_property(TARGET StdLatest PROPERTY OBJCXX_STANDARD "${CMAKE_OBJCXX_STANDARD_LATEST}")
diff --git a/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/RunCMake/LanguageStandards/StdLatest-OBJCXX.mm
@@ -0,0 +1,4 @@
+int main()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/README.rst b/Tests/RunCMake/README.rst
index d8cae8b..8850d7a 100644
--- a/Tests/RunCMake/README.rst
+++ b/Tests/RunCMake/README.rst
@@ -32,6 +32,16 @@ but do not actually build anything. To add a test:
and create ``test.cmake.in``, ``CTestConfig.cmake.in``, and
``CMakeLists.txt.in`` files to be configured for each case.
+ Alternatively, if the test is to cover running ``cpack -G`` then use::
+
+ include(RunCPack)
+ run_cpack(Sample1)
+ ...
+ run_cpack(SampleN)
+
+ where ``Sample1`` through ``SampleN`` are sample project directories
+ in the ``RunCPack/`` directory adjacent to this file.
+
4. Create file ``<Test>/CMakeLists.txt`` in the directory containing::
cmake_minimum_required(...)
@@ -71,6 +81,8 @@ but do not actually build anything. To add a test:
Top of test binary tree
and an failure must store a message in ``RunCMake_TEST_FAILED``.
+ The check script may optionally set ``RunCMake_TEST_FAILURE_MESSAGE``
+ with additional text to be included in the message if the test fails.
To speed up local testing, you can choose to run only a subset of
``run_cmake()`` tests in a ``RunCMakeTest.cmake`` script by using the
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 9bc510b..ea3099f 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -217,6 +217,7 @@ function(run_cmake test)
"|[^\n]*offset in archive not a multiple of 8"
"|[^\n]*from Time Machine by path"
"|[^\n]*Bullseye Testing Technology"
+ ${RunCMake_TEST_EXTRA_IGNORE_LINE_REGEX}
")[^\n]*\n)+"
)
if(RunCMake_IGNORE_POLICY_VERSION_DEPRECATION)
@@ -247,6 +248,7 @@ function(run_cmake test)
endif()
endforeach()
unset(RunCMake_TEST_FAILED)
+ unset(RunCMake_TEST_FAILURE_MESSAGE)
if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file})
include(${top_src}/${RunCMake-check-file})
else()
@@ -277,6 +279,9 @@ function(run_cmake test)
string(APPEND msg "Actual ${o}:\n${actual_${o}}\n")
endif()
endforeach()
+ if(RunCMake_TEST_FAILURE_MESSAGE)
+ string(APPEND msg "${RunCMake_TEST_FAILURE_MESSAGE}")
+ endif()
message(SEND_ERROR "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - FAILED:\n${msg}")
else()
message(STATUS "${test}${RunCMake_TEST_VARIANT_DESCRIPTION} - PASSED")
diff --git a/Tests/RunCMake/RunCPack.cmake b/Tests/RunCMake/RunCPack.cmake
new file mode 100644
index 0000000..b21eb26
--- /dev/null
+++ b/Tests/RunCMake/RunCPack.cmake
@@ -0,0 +1,112 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+include(RunCMake)
+
+#[[
+set(RunPack_GENERATORS ...)
+run_cpack(<case>
+ # general options
+ [CONFIG <config>] # Build/package given configuration (default "Release").
+ [GENERATORS <gen>...] # Tell cpack to use the given generator(s).
+ [SAMPLE <sample>] # Use RunCPack/<sample> project (default <case>).
+
+ # build step
+ [BUILD] # Build the test project before packaging.
+
+ # package,cpack-<gen> steps
+ [PACKAGE] # Run cpack via buildsystem "package" target.
+ [NO_CPACK] # Do not run cpack directly.
+
+ # verify step
+ [NO_VERIFY] # Do not run verify step.
+ [GLOB <glob>...] # Match expected package files with globbing patterns.
+ [VERIFY <command>...] # Run custom verification command on each package file.
+ )
+#]]
+function(run_cpack case)
+ cmake_parse_arguments(PARSE_ARGV 1 run_cpack
+ # Zero-value
+ "BUILD;PACKAGE;NO_CPACK;NO_VERIFY"
+ # One-value
+ "CONFIG;SAMPLE"
+ # Multi-value
+ "GENERATORS;GLOB;VERIFY"
+ )
+
+ if(DEFINED RunCPack_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments:\n ${RunCPack_UNPARSED_ARGUMENTS}")
+ endif()
+ if(DEFINED RunCPack_KEYWORDS_MISSING_VALUES)
+ message(FATAL_ERROR "Keywords missing values:\n ${RunCPack_KEYWORDS_MISSING_VALUES}")
+ endif()
+
+ if(run_cpack_GENERATORS)
+ set(RunCPack_GENERATORS "${run_cpack_GENERATORS}")
+ elseif(NOT RunCPack_GENERATORS)
+ message(FATAL_ERROR "RunCPack_GENERATORS not defined by caller!")
+ endif()
+
+ if(run_cpack_CONFIG)
+ set(RunCPack_CONFIG "${run_cpack_CONFIG}")
+ elseif(NOT RunCPack_CONFIG)
+ set(RunCPack_CONFIG "Release")
+ endif()
+
+ if(run_cpack_SAMPLE)
+ set(RunCPack_SAMPLE "${run_cpack_SAMPLE}")
+ else()
+ set(RunCPack_SAMPLE "${case}")
+ endif()
+
+ if(run_cpack_GLOB)
+ set(RunCPack_GLOB "${run_cpack_GLOB}")
+ endif()
+
+ if(run_cpack_VERIFY)
+ set(RunCPack_VERIFY ${run_cpack_VERIFY})
+ endif()
+
+ # Configure the sample project.
+ set(RunCMake_TEST_SOURCE_DIR ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/RunCPack/${RunCPack_SAMPLE})
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
+ string(APPEND RunCMake_TEST_RAW_ARGS " \"-DCPACK_GENERATOR=${RunCPack_GENERATORS}\"")
+ if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ list(APPEND RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=${RunCPack_CONFIG})
+ endif()
+ run_cmake(${case}-cmake)
+ unset(RunCMake_TEST_RAW_ARGS)
+ set(RunCMake_TEST_NO_CLEAN 1)
+
+ # Optionally build the project.
+ if(run_cpack_BUILD)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(${case}-build
+ "${CMAKE_COMMAND}" --build . --config "${RunCPack_CONFIG}")
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+ endif()
+
+ # Optionally package through the build system.
+ if(run_cpack_PACKAGE)
+ set(RunCMake_TEST_OUTPUT_MERGE 1)
+ run_cmake_command(${case}-package
+ "${CMAKE_COMMAND}" --build . --config "${RunCPack_CONFIG}" --target package)
+ unset(RunCMake_TEST_OUTPUT_MERGE)
+ endif()
+
+ # Run cpack with each generator.
+ if(NOT run_cpack_NO_CPACK)
+ foreach(RunCPack_GENERATOR IN LISTS RunCPack_GENERATORS)
+ run_cmake_command(${case}-cpack-${RunCPack_GENERATOR}
+ "${CMAKE_CPACK_COMMAND}" -C "${RunCPack_CONFIG}" -G "${RunCPack_GENERATOR}")
+ endforeach()
+ endif()
+
+ # Verify the resulting package files.
+ if(NOT run_cpack_NO_VERIFY)
+ set(RunCMake_TEST_RAW_ARGS " \"-Dglob=${RunCPack_GLOB}\" \"-Dverify=${RunCPack_VERIFY}\" -P \"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/RunCPack/verify.cmake\"")
+ run_cmake_command(${case}-verify
+ "${CMAKE_COMMAND}" -Ddir=${RunCMake_TEST_BINARY_DIR})
+ unset(RunCMake_TEST_RAW_ARGS)
+ endif()
+endfunction()
diff --git a/Tests/CPackWiXGenerator/CMakeLists.txt b/Tests/RunCMake/RunCPack/AppWiX/CMakeLists.txt
index 33fdc5e..affd4d4 100644
--- a/Tests/CPackWiXGenerator/CMakeLists.txt
+++ b/Tests/RunCMake/RunCPack/AppWiX/CMakeLists.txt
@@ -46,6 +46,11 @@ set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example")
+if(CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64")
+ set(CPACK_WIX_ARCHITECTURE arm64)
+ set(CPACK_SYSTEM_NAME windows-arm64)
+endif()
+
set(CPACK_WIX_UPGRADE_GUID "BF20CE5E-7F7C-401D-8F7C-AB45E8D170E6")
set(CPACK_WIX_UNINSTALL "1")
diff --git a/Tests/RunCMake/RunCPack/AppWiX/file with spaces.h b/Tests/RunCMake/RunCPack/AppWiX/file with spaces.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/RunCPack/AppWiX/file with spaces.h
diff --git a/Tests/CPackWiXGenerator/license.txt b/Tests/RunCMake/RunCPack/AppWiX/license.txt
index 7942783..7942783 100644
--- a/Tests/CPackWiXGenerator/license.txt
+++ b/Tests/RunCMake/RunCPack/AppWiX/license.txt
diff --git a/Tests/CPackWiXGenerator/mylib.cpp b/Tests/RunCMake/RunCPack/AppWiX/mylib.cpp
index 8d63071..8d63071 100644
--- a/Tests/CPackWiXGenerator/mylib.cpp
+++ b/Tests/RunCMake/RunCPack/AppWiX/mylib.cpp
diff --git a/Tests/CPackWiXGenerator/mylib.h b/Tests/RunCMake/RunCPack/AppWiX/mylib.h
index 5d0a822..5d0a822 100644
--- a/Tests/CPackWiXGenerator/mylib.h
+++ b/Tests/RunCMake/RunCPack/AppWiX/mylib.h
diff --git a/Tests/CPackWiXGenerator/mylibapp.cpp b/Tests/RunCMake/RunCPack/AppWiX/mylibapp.cpp
index a438ac7..a438ac7 100644
--- a/Tests/CPackWiXGenerator/mylibapp.cpp
+++ b/Tests/RunCMake/RunCPack/AppWiX/mylibapp.cpp
diff --git a/Tests/CPackWiXGenerator/myotherapp.cpp b/Tests/RunCMake/RunCPack/AppWiX/myotherapp.cpp
index 5047a34..5047a34 100644
--- a/Tests/CPackWiXGenerator/myotherapp.cpp
+++ b/Tests/RunCMake/RunCPack/AppWiX/myotherapp.cpp
diff --git a/Tests/CPackWiXGenerator/patch.xml b/Tests/RunCMake/RunCPack/AppWiX/patch.xml
index 13c392d..13c392d 100644
--- a/Tests/CPackWiXGenerator/patch.xml
+++ b/Tests/RunCMake/RunCPack/AppWiX/patch.xml
diff --git a/Tests/RunCMake/RunCPack/verify.cmake b/Tests/RunCMake/RunCPack/verify.cmake
new file mode 100644
index 0000000..26a52bc
--- /dev/null
+++ b/Tests/RunCMake/RunCPack/verify.cmake
@@ -0,0 +1,14 @@
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+if(glob)
+ list(TRANSFORM glob PREPEND "${dir}/")
+ file(GLOB files RELATIVE "${dir}" ${glob})
+ foreach(file IN LISTS files)
+ message(STATUS "${file}")
+ if(verify)
+ execute_process(COMMAND ${verify} ${file} COMMAND_ERROR_IS_FATAL ANY)
+ endif()
+ endforeach()
+ message(STATUS "")
+endif()
diff --git a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
index 8e5b97c..ccd8aee 100644
--- a/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
+++ b/Tests/RunCMake/Swift/IncrementalSwift-second-stdout.txt
@@ -1,3 +1,3 @@
-.*Building Swift object A.swiftmodule CMakeFiles(/|\\)A.dir(/|\\)a.swift.o(bj)?
-.*Building Swift object B.swiftmodule CMakeFiles(/|\\)B.dir(/|\\)b.swift.o(bj)?
+.*Building Swift Module 'A' with 1 source
+.*Building Swift Module 'B' with 1 source
FAILED: B.swiftmodule CMakeFiles(/|\\)B.dir(/|\\)b.swift.o(bj)?
diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
index 6b462d0..415f404 100644
--- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
+++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt
@@ -42,6 +42,7 @@
\* CMP0156
\* CMP0157
\* CMP0160
+ \* CMP0162
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
index 689b35f..b5b195a 100644
--- a/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
+++ b/Tests/RunCMake/VS10Project/RuntimeLibrary-check.cmake
@@ -9,7 +9,7 @@ macro(RuntimeLibrary_check tgt rtl_expect)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
- if(line MATCHES "^ *<RuntimeLibrary>([^<>]+)</RuntimeLibrary>")
+ if(line MATCHES "^ *<RuntimeLibrary>([^<>]*)</RuntimeLibrary>")
set(rtl_actual "${CMAKE_MATCH_1}")
if(NOT "${rtl_actual}" STREQUAL "${rtl_expect}")
set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has RuntimeLibrary '${rtl_actual}', not '${rtl_expect}'.")
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
index 22a3df0..ad585d5 100644
--- a/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsCustomProps-check.cmake
@@ -1,25 +1,30 @@
-set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
-if(NOT EXISTS "${vcProjectFile}")
- set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
- return()
-endif()
+macro(check_custom_prop suffix)
+ set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj${suffix}")
+ if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+ return()
+ endif()
-set(importFound FALSE)
+ set(importFound FALSE)
-set(props_file "${RunCMake_SOURCE_DIR}/my.props")
-file(TO_NATIVE_PATH "${props_file}" check_file)
-file(STRINGS "${vcProjectFile}" lines)
-foreach(line IN LISTS lines)
- if(line MATCHES "^ *<Import Project=\"([^\"]+)\".*Label=\"([^\"]+)\".*$")
- if("${CMAKE_MATCH_1}" STREQUAL "${check_file}" AND
- "${CMAKE_MATCH_2}" STREQUAL "LocalAppDataPlatform")
- message(STATUS "foo.vcxproj is importing ${check_file}")
- set(importFound TRUE)
+ set(props_file "${RunCMake_SOURCE_DIR}/my.props")
+ file(TO_NATIVE_PATH "${props_file}" check_file)
+ file(STRINGS "${vcProjectFile}" lines)
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<Import Project=\"([^\"]+)\".*Label=\"([^\"]+)\".*$")
+ if("${CMAKE_MATCH_1}" STREQUAL "${check_file}" AND
+ "${CMAKE_MATCH_2}" STREQUAL "LocalAppDataPlatform")
+ message(STATUS "foo.vcxproj${suffix} is importing ${check_file}")
+ set(importFound TRUE)
+ endif()
endif()
+ endforeach()
+
+ if(NOT importFound)
+ set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
+ return()
endif()
-endforeach()
+endmacro()
-if(NOT importFound)
- set(RunCMake_TEST_FAILED "Import of custom .props file not found.")
- return()
-endif()
+check_custom_prop("")
+check_custom_prop(".filters")
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps.cmake b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
index fbbcfcf..d6c905f 100644
--- a/Tests/RunCMake/VS10Project/VsCustomProps.cmake
+++ b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
@@ -4,4 +4,5 @@ add_library(foo foo.cpp)
set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props")
set_target_properties(foo PROPERTIES
- VS_USER_PROPS "${props_file}")
+ VS_USER_PROPS "${props_file}"
+ VS_FILTER_PROPS "${props_file}")
diff --git a/Tests/RunCMake/VS10Project/VsJustMyCode-check.cmake b/Tests/RunCMake/VS10Project/VsJustMyCode-check.cmake
index 7119976..e76d931 100644
--- a/Tests/RunCMake/VS10Project/VsJustMyCode-check.cmake
+++ b/Tests/RunCMake/VS10Project/VsJustMyCode-check.cmake
@@ -9,7 +9,7 @@ macro(VsJustMyCode_check tgt jmc_expect)
file(STRINGS "${vcProjectFile}" lines)
foreach(line IN LISTS lines)
- if(line MATCHES "^ *<SupportJustMyCode>([^<>]+)</SupportJustMyCode>")
+ if(line MATCHES "^ *<SupportJustMyCode>([^<>]*)</SupportJustMyCode>")
set(jmc_actual "${CMAKE_MATCH_1}")
if(NOT "${jmc_actual}" STREQUAL "${jmc_expect}")
set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has <SupportJustMyCode> '${jmc_actual}', not '${jmc_expect}'.")
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake
new file mode 100644
index 0000000..2ab8960
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-check.cmake
@@ -0,0 +1,8 @@
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
+
+UseDebugLibraries_check(default "true" "false")
+UseDebugLibraries_check(defaultCLR "true" "false")
+UseDebugLibraries_check(defaultUtil "true" "false")
+UseDebugLibraries_check(defaultRTL "true" "false")
+UseDebugLibraries_check(ALL_BUILD "true" "false")
+UseDebugLibraries_check(ZERO_CHECK "true" "false")
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt
new file mode 100644
index 0000000..9d1b69e
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0091-OLD\.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0091 will be removed from a future version
+ of CMake\.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances\. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake
new file mode 100644
index 0000000..d8142ee
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMP0091-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0091 OLD)
+include(Default-CMP0162-NEW.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt
new file mode 100644
index 0000000..392312d
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.29)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake
new file mode 100644
index 0000000..b5e6fae
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW-check.cmake
@@ -0,0 +1,8 @@
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
+
+UseDebugLibraries_check(default "true" "false")
+UseDebugLibraries_check(defaultCLR "true" "false")
+UseDebugLibraries_check(defaultUtil "true" "false")
+UseDebugLibraries_check(defaultRTL "false" "false")
+UseDebugLibraries_check(ALL_BUILD "true" "false")
+UseDebugLibraries_check(ZERO_CHECK "true" "false")
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake
new file mode 100644
index 0000000..be6869d
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0162 NEW)
+include(Default-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake
new file mode 100644
index 0000000..673144e
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN-check.cmake
@@ -0,0 +1,8 @@
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
+
+UseDebugLibraries_check(default "" "")
+UseDebugLibraries_check(defaultCLR "" "")
+UseDebugLibraries_check(defaultUtil "" "")
+UseDebugLibraries_check(defaultRTL "" "")
+UseDebugLibraries_check(ALL_BUILD "" "")
+UseDebugLibraries_check(ZERO_CHECK "" "")
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake
new file mode 100644
index 0000000..7696944
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-CMP0162-WARN.cmake
@@ -0,0 +1,2 @@
+# Leave CMP0162 unset.
+include(Default-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake
new file mode 100644
index 0000000..6afcfb6
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Default-common.cmake
@@ -0,0 +1,10 @@
+set(CMAKE_CONFIGURATION_TYPES Debug Release)
+enable_language(CXX)
+
+# Test several generator code paths covering different target types.
+add_library(default empty.cxx)
+add_library(defaultCLR empty.cxx)
+set_property(TARGET defaultCLR PROPERTY COMMON_LANGUAGE_RUNTIME "")
+add_library(defaultRTL empty.cxx)
+set_property(TARGET defaultRTL PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
+add_custom_target(defaultUtil)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake
new file mode 100644
index 0000000..832a7f3
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW-check.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Explicit-check-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake
new file mode 100644
index 0000000..a5f8d4a
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0162 NEW)
+include(Explicit-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake
new file mode 100644
index 0000000..832a7f3
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD-check.cmake
@@ -0,0 +1 @@
+include(${CMAKE_CURRENT_LIST_DIR}/Explicit-check-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake
new file mode 100644
index 0000000..1e60c52
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-CMP0162-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0162 OLD)
+include(Explicit-common.cmake)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake
new file mode 100644
index 0000000..385b798
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-check-common.cmake
@@ -0,0 +1,10 @@
+include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake)
+
+UseDebugLibraries_check(empty "" "")
+UseDebugLibraries_check(emptyCLR "" "")
+UseDebugLibraries_check(emptyUtil "" "")
+UseDebugLibraries_check(genex "true" "false")
+UseDebugLibraries_check(genexCLR "true" "false")
+UseDebugLibraries_check(genexUtil "true" "false")
+UseDebugLibraries_check(ALL_BUILD "false" "false")
+UseDebugLibraries_check(ZERO_CHECK "false" "false")
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake
new file mode 100644
index 0000000..3433745
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/Explicit-common.cmake
@@ -0,0 +1,20 @@
+set(CMAKE_CONFIGURATION_TYPES Debug Release)
+enable_language(CXX)
+
+# An empty string suppresses generation of the setting.
+set(CMAKE_VS_USE_DEBUG_LIBRARIES "")
+add_library(empty empty.cxx)
+add_library(emptyCLR empty.cxx)
+set_property(TARGET emptyCLR PROPERTY COMMON_LANGUAGE_RUNTIME "")
+add_custom_target(emptyUtil)
+
+# A generator expression can encode per-config values.
+set(CMAKE_VS_USE_DEBUG_LIBRARIES "$<CONFIG:Debug>")
+add_library(genex empty.cxx)
+add_library(genexCLR empty.cxx)
+set_property(TARGET genexCLR PROPERTY COMMON_LANGUAGE_RUNTIME "")
+add_custom_target(genexUtil)
+
+# The last setting in the top-level directcory affects
+# the builtin targets like ALL_BUILD and ZERO_CHECK.
+set(CMAKE_VS_USE_DEBUG_LIBRARIES 0)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake
new file mode 100644
index 0000000..57402eb
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.29)
+include(RunCMake)
+
+run_cmake(CMP0091-OLD)
+run_cmake(Default-CMP0162-NEW)
+run_cmake(Default-CMP0162-WARN)
+run_cmake(Explicit-CMP0162-NEW)
+run_cmake(Explicit-CMP0162-OLD)
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake b/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake
new file mode 100644
index 0000000..311c8a7
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/check-common.cmake
@@ -0,0 +1,42 @@
+cmake_policy(SET CMP0140 NEW)
+function(UseDebugLibraries_check tgt udl_expect_debug udl_expect_release)
+ set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/${tgt}.vcxproj")
+ if(NOT EXISTS "${vcProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not exist.")
+ return()
+ endif()
+
+ set(have_udl_debug 0)
+ set(have_udl_release 0)
+ set(inConfig "")
+
+ file(STRINGS "${vcProjectFile}" lines)
+ foreach(line IN LISTS lines)
+ if(line MATCHES [[^ *<PropertyGroup Condition="'\$\(Configuration\)\|\$\(Platform\)'=='([^"|]+)\|[^"]+" Label="Configuration">.*$]])
+ string(TOLOWER "${CMAKE_MATCH_1}" inConfig)
+ elseif(inConfig)
+ if(line MATCHES "^ *</PropertyGroup>.*$")
+ set(inConfig "")
+ elseif(line MATCHES "^ *<UseDebugLibraries>([^<>]+)</UseDebugLibraries>")
+ set(udl_actual "${CMAKE_MATCH_1}")
+ set(have_udl_${inConfig} 1)
+ if (NOT "${udl_expect_${inConfig}}" STREQUAL "")
+ if(NOT "${udl_actual}" STREQUAL "${udl_expect_${inConfig}}")
+ string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has ${inConfig} UseDebugLibraries '${udl_actual}', not '${udl_expect_${inConfig}}'.\n")
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj has ${inConfig} UseDebugLibraries '${udl_actual}', but should not have one.\n")
+ endif()
+ unset(udl_actual)
+ endif()
+ endif()
+ endforeach()
+
+ if(NOT have_udl_debug AND NOT "${udl_expect_debug}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a debug UseDebugLibraries field, but should have one.\n")
+ endif()
+ if(NOT have_udl_release AND NOT "${udl_expect_release}" STREQUAL "")
+ string(APPEND RunCMake_TEST_FAILED "Project file ${tgt}.vcxproj does not have a release UseDebugLibraries field, but should have one.\n")
+ endif()
+ return(PROPAGATE RunCMake_TEST_FAILED)
+endfunction()
diff --git a/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx b/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/VS10ProjectUseDebugLibraries/empty.cxx
diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
index 4d5508d..081e09a 100644
--- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
+++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets-check.cmake
@@ -9,7 +9,7 @@ function(check_file target filename)
if(filename MATCHES "^(.*)(\\.[a-z]+)$")
set(header_filename "${CMAKE_MATCH_1}")
endif()
- set(expected_contents "#include <${header_filename}> // IWYU pragma: associated\n")
+ set(expected_contents "/* NOLINTNEXTLINE(misc-header-include-cycle,misc-include-cleaner) */\n#include <${header_filename}> /* IWYU pragma: associated */\n")
file(READ "${full_filename}" actual_contents)
if(NOT actual_contents STREQUAL expected_contents)
diff --git a/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake
index 1847bc9..48b4680 100644
--- a/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeFileType-check.cmake
@@ -1,4 +1,4 @@
-set(expect-default "explicitFileType = sourcecode")
+set(expect-default "explicitFileType = default")
set(expect-explicit "explicitFileType = sourcecode.c.h")
set(expect-lastKnown "lastKnownFileType = sourcecode.c.h")
foreach(src default explicit lastKnown)
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaGeneration-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaGeneration-check.cmake
new file mode 100644
index 0000000..4e139d4
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaGeneration-check.cmake
@@ -0,0 +1,19 @@
+
+set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaGeneration.xcodeproj/xcshareddata/xcschemes/foo.xcscheme")
+
+if(NOT EXISTS "${schema}")
+ set(RunCMake_TEST_FAILED "Generated schema ${schema} does not exist.")
+ return()
+endif()
+
+execute_process(COMMAND
+ /usr/bin/xmllint --xpath "//Scheme/ProfileAction/BuildableProductRunnable" ${schema}
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ RESULT_VARIABLE exit_code
+ ERROR_STRIP_TRAILING_WHITESPACE
+)
+if(exit_code)
+ set(RunCMake_TEST_FAILED "Failed to find BuildableProductRunnable for profile action: ${stderr}")
+ return()
+endif()
diff --git a/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt b/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt
index bf49657..76708c4 100644
--- a/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt
+++ b/Tests/RunCMake/add_custom_command/CommentGenex-build-stdout.txt
@@ -1 +1 @@
-lorem ipsum, 01
+"lorem ipsum, 01"
diff --git a/Tests/RunCMake/add_custom_command/CommentGenex.cmake b/Tests/RunCMake/add_custom_command/CommentGenex.cmake
index f517392..b3931f4 100644
--- a/Tests/RunCMake/add_custom_command/CommentGenex.cmake
+++ b/Tests/RunCMake/add_custom_command/CommentGenex.cmake
@@ -3,7 +3,7 @@ set_property(TARGET helper PROPERTY MY_TEXT "lorem ipsum")
add_custom_command(
OUTPUT out.txt
COMMAND ${CMAKE_COMMAND} -E echo true
- COMMENT "$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>"
+ COMMENT "$<QUOTE>$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>$<QUOTE>"
)
set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
add_custom_target(main ALL DEPENDS out.txt)
diff --git a/Tests/RunCMake/add_library/RunCMakeTest.cmake b/Tests/RunCMake/add_library/RunCMakeTest.cmake
index 3283625..26b94f8 100644
--- a/Tests/RunCMake/add_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_library/RunCMakeTest.cmake
@@ -22,3 +22,7 @@ run_cmake(STATICwithNoSourcesButLinkObjects)
run_cmake(SHAREDwithNoSourcesButLinkObjects)
run_cmake(MODULEwithNoSourcesButLinkObjects)
run_cmake(UNKNOWNwithNoSourcesButLinkObjects)
+
+run_cmake(TARGET_SUPPORTS_SHARED_LIBS_CMP0164_OLD)
+run_cmake(TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW)
+run_cmake(TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN)
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-result.txt b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-stderr.txt b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-stderr.txt
new file mode 100644
index 0000000..2a13236
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW.cmake:[0-9]+ \(add_library\):
+ ADD_LIBRARY called with SHARED option but the target platform does not
+ support dynamic linking.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW.cmake b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW.cmake
new file mode 100644
index 0000000..0f4d34b
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_NEW.cmake
@@ -0,0 +1,4 @@
+enable_language(CXX)
+cmake_policy(SET CMP0164 NEW)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+add_library(someLib SHARED test.cpp)
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_OLD.cmake b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_OLD.cmake
new file mode 100644
index 0000000..3c90403
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_OLD.cmake
@@ -0,0 +1,9 @@
+enable_language(CXX)
+cmake_policy(SET CMP0164 OLD)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+
+add_library(someLib SHARED test.cpp)
+get_target_property(someLibType someLib TYPE)
+if(NOT someLibType STREQUAL "STATIC_LIBRARY")
+ message(FATAL_ERROR "expected type does not match")
+endif()
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN-stderr.txt b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN-stderr.txt
new file mode 100644
index 0000000..89a61c0
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Warning \(dev\) at TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN.cmake:[0-9]+ \(add_library\):
+ ADD_LIBRARY called with SHARED option but the target platform does not
+ support dynamic linking. Building a STATIC library instead. This may lead
+ to problems.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN.cmake b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN.cmake
new file mode 100644
index 0000000..1f5cc84
--- /dev/null
+++ b/Tests/RunCMake/add_library/TARGET_SUPPORTS_SHARED_LIBS_CMP0164_WARN.cmake
@@ -0,0 +1,3 @@
+enable_language(CXX)
+set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+add_library(someLib SHARED test.cpp)
diff --git a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set-stderr.txt b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set-stderr.txt
new file mode 100644
index 0000000..bddd3ab
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at Experimental/CxxImportStd-set.cmake:4 \(cmake_language\):
+ CMake's support for `import std;` in C\+\+23 and newer is experimental. It
+ is meant only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake
new file mode 100644
index 0000000..a002297
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-set.cmake
@@ -0,0 +1,11 @@
+set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD
+ "0e5b6991-d74f-4b3d-a41c-cf096e0b2508")
+
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "CxxImportStd"
+ feature_present)
+
+if (NOT feature_present STREQUAL "TRUE")
+ message(FATAL_ERROR
+ "Expected the `CxxImportStd` feature to be enabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-unset.cmake b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-unset.cmake
new file mode 100644
index 0000000..be758c2
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/CxxImportStd-unset.cmake
@@ -0,0 +1,8 @@
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "CxxImportStd"
+ feature_present)
+
+if (NOT feature_present STREQUAL "FALSE")
+ message(FATAL_ERROR
+ "Expected the `CxxImportStd` feature to be disabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set-stderr.txt b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set-stderr.txt
new file mode 100644
index 0000000..0207835
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at Experimental/ExportPackageDependencies-set.cmake:4 \(cmake_language\):
+ CMake's EXPORT_PACKAGE_DEPENDENCIES support is experimental. It is meant
+ only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set.cmake b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set.cmake
new file mode 100644
index 0000000..74b3f93
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-set.cmake
@@ -0,0 +1,11 @@
+set(CMAKE_EXPERIMENTAL_EXPORT_PACKAGE_DEPENDENCIES
+ "1942b4fa-b2c5-4546-9385-83f254070067")
+
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "ExportPackageDependencies"
+ feature_present)
+
+if (NOT feature_present STREQUAL "TRUE")
+ message(FATAL_ERROR
+ "Expected the `ExportPackageDependencies` feature to be enabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-unset.cmake b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-unset.cmake
new file mode 100644
index 0000000..c60595f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/ExportPackageDependencies-unset.cmake
@@ -0,0 +1,8 @@
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "ExportPackageDependencies"
+ feature_present)
+
+if (NOT feature_present STREQUAL "FALSE")
+ message(FATAL_ERROR
+ "Expected the `ExportPackageDependencies` feature to be disabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/Unknown-result.txt b/Tests/RunCMake/cmake_language/Experimental/Unknown-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/Unknown-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/cmake_language/Experimental/Unknown-stderr.txt b/Tests/RunCMake/cmake_language/Experimental/Unknown-stderr.txt
new file mode 100644
index 0000000..ca7c058
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/Unknown-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at Experimental/Unknown.cmake:1 \(cmake_language\):
+ cmake_language Experimental feature name "Unknown" does not exist.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/cmake_language/Experimental/Unknown.cmake b/Tests/RunCMake/cmake_language/Experimental/Unknown.cmake
new file mode 100644
index 0000000..d5e3047
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/Unknown.cmake
@@ -0,0 +1,8 @@
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "Unknown"
+ feature_present)
+
+if (NOT feature_present STREQUAL "")
+ message(FATAL_ERROR
+ "Got a result for the `Unknown` experimental feature.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set-stderr.txt b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set-stderr.txt
new file mode 100644
index 0000000..d6f8788
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set-stderr.txt
@@ -0,0 +1,6 @@
+CMake Warning \(dev\) at Experimental/WindowsKernelModeDriver-set.cmake:4 \(cmake_language\):
+ CMake's Windows kernel-mode driver support is experimental. It is meant
+ only for experimentation and feedback to CMake developers.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake
new file mode 100644
index 0000000..f942d95
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-set.cmake
@@ -0,0 +1,11 @@
+set(CMAKE_EXPERIMENTAL_WINDOWS_KERNEL_MODE_DRIVER
+ "5c2d848d-4efa-4529-a768-efd57171bf68")
+
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "WindowsKernelModeDriver"
+ feature_present)
+
+if (NOT feature_present STREQUAL "TRUE")
+ message(FATAL_ERROR
+ "Expected the `WindowsKernelModeDriver` feature to be enabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-unset.cmake b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-unset.cmake
new file mode 100644
index 0000000..7aee0d3
--- /dev/null
+++ b/Tests/RunCMake/cmake_language/Experimental/WindowsKernelModeDriver-unset.cmake
@@ -0,0 +1,8 @@
+cmake_language(GET_EXPERIMENTAL_FEATURE_ENABLED
+ "WindowsKernelModeDriver"
+ feature_present)
+
+if (NOT feature_present STREQUAL "FALSE")
+ message(FATAL_ERROR
+ "Expected the `WindowsKernelModeDriver` feature to be disabled.")
+endif ()
diff --git a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
index 5fb2de6..fe3da79 100644
--- a/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
+++ b/Tests/RunCMake/cmake_language/RunCMakeTest.cmake
@@ -156,3 +156,11 @@ run_cmake_command(
-DCMAKE_MESSAGE_LOG_LEVEL=TRACE
-P ${RunCMake_SOURCE_DIR}/get_message_log_level.cmake
)
+
+run_cmake(Experimental/CxxImportStd-set)
+run_cmake(Experimental/CxxImportStd-unset)
+run_cmake(Experimental/ExportPackageDependencies-set)
+run_cmake(Experimental/ExportPackageDependencies-unset)
+run_cmake(Experimental/WindowsKernelModeDriver-set)
+run_cmake(Experimental/WindowsKernelModeDriver-unset)
+run_cmake(Experimental/Unknown)
diff --git a/Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in b/Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in
index 1babd72..da7ec1a 100644
--- a/Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_cmake_error/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5)
project(CTestCoverage@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/ctest_fixtures/cyclicCleanup-stderr.txt b/Tests/RunCMake/ctest_fixtures/cyclicCleanup-stderr.txt
index 1a45994..1973b2a 100644
--- a/Tests/RunCMake/ctest_fixtures/cyclicCleanup-stderr.txt
+++ b/Tests/RunCMake/ctest_fixtures/cyclicCleanup-stderr.txt
@@ -1,3 +1,2 @@
-Error: a cycle exists in the test dependency graph for the test "cyclicCleanup".
-Please fix the cycle and run ctest again.
-No tests were found!!!
+^Error: a cycle exists in the test dependency graph for the test "cyclicCleanup"\.
+Please fix the cycle and run ctest again\.$
diff --git a/Tests/RunCMake/ctest_fixtures/cyclicSetup-stderr.txt b/Tests/RunCMake/ctest_fixtures/cyclicSetup-stderr.txt
index 2aba6c9..aee735a 100644
--- a/Tests/RunCMake/ctest_fixtures/cyclicSetup-stderr.txt
+++ b/Tests/RunCMake/ctest_fixtures/cyclicSetup-stderr.txt
@@ -1,3 +1,2 @@
-Error: a cycle exists in the test dependency graph for the test "cyclicSetup".
-Please fix the cycle and run ctest again.
-No tests were found!!!$
+^Error: a cycle exists in the test dependency graph for the test "cyclicSetup"\.
+Please fix the cycle and run ctest again\.$
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt
index a8f10b5..74f37c0 100644
--- a/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitHeaders-stderr.txt
@@ -1 +1 @@
- *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt
index 4825d7a..ad6dcf4 100644
--- a/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitQuiet-stderr.txt
@@ -1,3 +1,3 @@
*Error when uploading file: .*/Configure.xml
- *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
*Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
index a8f10b5..74f37c0 100644
--- a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stderr.txt
@@ -1 +1 @@
- *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
index 11a4edf..d0c4e1a 100644
--- a/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
+++ b/Tests/RunCMake/ctest_submit/CDashSubmitVerbose-stdout.txt
@@ -1 +1 @@
-Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___Configure.xml&build=test-build-name&site=test-site&stamp=.*-Experimental&subproject=mysubproj&MD5=.* Size: .*
+Upload file: .* to http:\/\/badhostname.invalid\?FileName=test-site___test-build-name___.*-Experimental___XML___Configure.xml&build=test-build-name&site=test-site&stamp=.*-Experimental&subproject=mysubproj&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_submit/CMakeLists.txt.in b/Tests/RunCMake/ctest_submit/CMakeLists.txt.in
index 96e6c13..5ee64be 100644
--- a/Tests/RunCMake/ctest_submit/CMakeLists.txt.in
+++ b/Tests/RunCMake/ctest_submit/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5)
project(CTestSubmit@CASE_NAME@ NONE)
include(CTest)
add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version)
diff --git a/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in b/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in
index c35397c..140e4be 100644
--- a/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in
+++ b/Tests/RunCMake/ctest_submit/CTestConfig.cmake.in
@@ -3,7 +3,3 @@
# so that any ctest_submit calls fail with an error message.
set(CTEST_DROP_METHOD "@CASE_DROP_METHOD@")
set(CTEST_DROP_SITE "@CASE_DROP_SITE@")
-
-# do not use proxy for lookup of invalid site (DNS failure by proxy looks
-# different than DNS failure without proxy)
-set(ENV{no_proxy} "$ENV{no_proxy},@CASE_DROP_SITE@")
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
index a8f10b5..74f37c0 100644
--- a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stderr.txt
@@ -1 +1 @@
- *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
diff --git a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
index 929b254..a8f4759 100644
--- a/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
+++ b/Tests/RunCMake/ctest_submit/FILESNoBuildId-stdout.txt
@@ -1 +1 @@
-Upload file: .* to http:\/\/-no-site-\?FileName=test-site___test-build-name___.*-Experimental___XML___RunCMakeTest.cmake&MD5=.* Size: .*
+Upload file: .* to http:\/\/badhostname.invalid\?FileName=test-site___test-build-name___.*-Experimental___XML___RunCMakeTest.cmake&MD5=.* Size: .*
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stdout.txt
new file mode 100644
index 0000000..4f5120e
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-cmake-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:OFF
+SetCTestConfiguration:TLSVerify:OFF
+.*
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stdout.txt
new file mode 100644
index 0000000..582030a
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-env-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from ENV{CMAKE_TLS_VERIFY}:TLSVerify:OFF
+SetCTestConfiguration:TLSVerify:OFF
+.*
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stdout.txt
new file mode 100644
index 0000000..9053f6c
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-OFF-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfigurationFromCMakeVariable:TLSVerify:CTEST_TLS_VERIFY
+SetCTestConfiguration:TLSVerify:OFF
+.*
+ Set CURLOPT_SSL_VERIFYPEER to off
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stdout.txt
new file mode 100644
index 0000000..015728c
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-cmake-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from CMAKE_TLS_VERIFY:TLSVerify:ON
+SetCTestConfiguration:TLSVerify:ON
+.*
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stdout.txt
new file mode 100644
index 0000000..add2b4c
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-env-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from ENV{CMAKE_TLS_VERIFY}:TLSVerify:ON
+SetCTestConfiguration:TLSVerify:ON
+.*
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stdout.txt
new file mode 100644
index 0000000..c2764c3
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVerify-ON-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfigurationFromCMakeVariable:TLSVerify:CTEST_TLS_VERIFY
+SetCTestConfiguration:TLSVerify:ON
+.*
+ Set CURLOPT_SSL_VERIFYPEER to on
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stdout.txt
new file mode 100644
index 0000000..ed3677a
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-cmake-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from CMAKE_TLS_VERSION:TLSVersion:1\.1
+SetCTestConfiguration:TLSVersion:1\.1
+.*
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stdout.txt
new file mode 100644
index 0000000..c31b4bc
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-env-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfiguration from ENV{CMAKE_TLS_VERSION}:TLSVersion:1\.1
+SetCTestConfiguration:TLSVersion:1\.1
+.*
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-result.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-result.txt
new file mode 100644
index 0000000..b57e2de
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-result.txt
@@ -0,0 +1 @@
+(-1|255)
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stderr.txt
new file mode 100644
index 0000000..e3df62f
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stderr.txt
@@ -0,0 +1,2 @@
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+ Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stdout.txt
new file mode 100644
index 0000000..be83798
--- /dev/null
+++ b/Tests/RunCMake/ctest_submit/FailDrop-TLSVersion-1.1-stdout.txt
@@ -0,0 +1,4 @@
+SetCTestConfigurationFromCMakeVariable:TLSVersion:CTEST_TLS_VERSION
+SetCTestConfiguration:TLSVersion:1\.1
+.*
+ Set CURLOPT_SSLVERSION to CURL_SSLVERSION_TLSv1_1
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt
index f52d2d8..b83da8d 100644
--- a/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stderr.txt
@@ -1,2 +1,2 @@
-Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt
index c9111b0..bd7d6b6 100644
--- a/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt
+++ b/Tests/RunCMake/ctest_submit/FailDrop-http-stdout.txt
@@ -1,2 +1,2 @@
Submit files
- SubmitURL: http://-no-site-
+ SubmitURL: http://badhostname.invalid
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt
index 259f7d0..e3df62f 100644
--- a/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stderr.txt
@@ -1,2 +1,2 @@
-Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
+Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?|The requested URL returned error:|Protocol "https" (not supported or disabled|not supported|disabled)|.* was built with SSL disabled).*
Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt b/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt
index 2c67eb9..f97f63c 100644
--- a/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt
+++ b/Tests/RunCMake/ctest_submit/FailDrop-https-stdout.txt
@@ -1,2 +1,2 @@
Submit files
- SubmitURL: https://-no-site-
+ SubmitURL: https://badhostname.invalid
diff --git a/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt b/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt
index 0020a0f..86cd817 100644
--- a/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt
+++ b/Tests/RunCMake/ctest_submit/PARTSDone-stderr.txt
@@ -1,3 +1,3 @@
*Error when uploading file: .*/Done.xml
- *Error message was: ([Cc]ould *n.t resolve host:? '?-no-site-'?.*|The requested URL returned error:.*)
+ *Error message was: ([Cc]ould *n.t resolve host:? '?badhostname.invalid'?.*|The requested URL returned error:.*)
*Problems when submitting via HTTP
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index 78856b4..3c77ddb 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -2,9 +2,13 @@ include(RunCTest)
# Default case parameters.
set(CASE_DROP_METHOD "http")
-set(CASE_DROP_SITE "-no-site-")
+set(CASE_DROP_SITE "badhostname.invalid")
set(CASE_CTEST_SUBMIT_ARGS "")
+set(CASE_TEST_PREFIX_CODE "")
+# Do not use any proxy for lookup of an invalid site.
+# DNS failure by proxy looks different than DNS failure without proxy.
+set(ENV{no_proxy} "$ENV{no_proxy},badhostname.invalid")
function(run_ctest_submit CASE_NAME)
set(CASE_CTEST_SUBMIT_ARGS "${ARGN}")
@@ -51,3 +55,30 @@ endfunction()
run_ctest_submit_FailDrop(http)
run_ctest_submit_FailDrop(https)
+block()
+ set(CASE_DROP_METHOD "https")
+ set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERSION 1.1)")
+ run_ctest(FailDrop-TLSVersion-1.1 -VV)
+ set(CASE_TEST_PREFIX_CODE "set(CMAKE_TLS_VERSION 1.1)") # Test fallback to CMake variable.
+ run_ctest(FailDrop-TLSVersion-1.1-cmake -VV)
+ set(ENV{CMAKE_TLS_VERSION} 1.1) # Test fallback to env variable.
+ set(CASE_TEST_PREFIX_CODE "")
+ run_ctest(FailDrop-TLSVersion-1.1-env -VV)
+ unset(ENV{CMAKE_TLS_VERSION})
+ set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERIFY ON)")
+ run_ctest(FailDrop-TLSVerify-ON -VV)
+ set(CASE_TEST_PREFIX_CODE "set(CMAKE_TLS_VERIFY ON)") # Test fallback to CMake variable.
+ run_ctest(FailDrop-TLSVerify-ON-cmake -VV)
+ set(ENV{CMAKE_TLS_VERIFY} ON) # Test fallback to env variable.
+ set(CASE_TEST_PREFIX_CODE "")
+ run_ctest(FailDrop-TLSVerify-ON-env -VV)
+ unset(ENV{CMAKE_TLS_VERIFY})
+ set(CASE_TEST_PREFIX_CODE "set(CTEST_TLS_VERIFY OFF)")
+ run_ctest(FailDrop-TLSVerify-OFF -VV)
+ set(CASE_TEST_PREFIX_CODE "set(CMAKE_TLS_VERIFY OFF)") # Test fallback to CMake variable.
+ run_ctest(FailDrop-TLSVerify-OFF-cmake -VV)
+ set(ENV{CMAKE_TLS_VERIFY} OFF) # Test fallback to env variable.
+ set(CASE_TEST_PREFIX_CODE "")
+ run_ctest(FailDrop-TLSVerify-OFF-env -VV)
+ unset(ENV{CMAKE_TLS_VERIFY})
+endblock()
diff --git a/Tests/RunCMake/ctest_submit/test.cmake.in b/Tests/RunCMake/ctest_submit/test.cmake.in
index 0f4885f..6026c35 100644
--- a/Tests/RunCMake/ctest_submit/test.cmake.in
+++ b/Tests/RunCMake/ctest_submit/test.cmake.in
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.5)
+@CASE_TEST_PREFIX_CODE@
set(CTEST_SITE "test-site")
set(CTEST_BUILD_NAME "test-build-name")
diff --git a/Tests/RunCMake/ctest_upload/UploadQuiet-check.cmake b/Tests/RunCMake/ctest_upload/UploadQuiet-check.cmake
new file mode 100644
index 0000000..e45aa73
--- /dev/null
+++ b/Tests/RunCMake/ctest_upload/UploadQuiet-check.cmake
@@ -0,0 +1,12 @@
+file(GLOB upload_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Upload.xml")
+if(upload_xml_file)
+ file(READ "${upload_xml_file}" upload_xml LIMIT 4096)
+ if(NOT upload_xml MATCHES "<Time>")
+ string(REPLACE "\n" "\n " upload_xml " ${upload_xml}")
+ set(RunCMake_TEST_FAILED
+ "Upload.xml does not contain a <Time> attribute:\n${upload_xml}"
+ )
+ endif()
+else()
+ set(RunCMake_TEST_FAILED "Upload.xml not found")
+endif()
diff --git a/Tests/RunCMake/detect_jobserver.c b/Tests/RunCMake/detect_jobserver.c
index 8cbfe2e..67cc7db 100644
--- a/Tests/RunCMake/detect_jobserver.c
+++ b/Tests/RunCMake/detect_jobserver.c
@@ -118,7 +118,6 @@ int posix(const char* jobserver, char* message)
{
int read_fd;
int write_fd;
- const char* path;
// First try to parse as "R,W" file descriptors
if (sscanf(jobserver, "%d,%d", &read_fd, &write_fd) == 2) {
@@ -127,7 +126,7 @@ int posix(const char* jobserver, char* message)
// Then try to parse as "fifo:PATH"
if (strncmp(jobserver, "fifo:", 5) == 0) {
- path = jobserver + 5;
+ const char* path = jobserver + 5;
read_fd = open(path, O_RDONLY);
write_fd = open(path, O_WRONLY);
return test_fd(read_fd, write_fd, message);
diff --git a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
index d757eea..33f519f 100644
--- a/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-DOWNLOAD/RunCMakeTest.cmake
@@ -11,6 +11,7 @@ run_cmake(httpheader-not-set)
run_cmake(netrc-bad)
run_cmake(tls-cainfo-not-set)
run_cmake(tls-verify-not-set)
+run_cmake(TLS_VERSION-missing)
run_cmake(pass-not-set)
run_cmake(no-save-hash)
@@ -25,7 +26,12 @@ if(NOT CMake_TEST_NO_NETWORK)
run_cmake(bad-hostname)
endif()
+run_cmake_with_options(TLS_VERSION-bad)
+
if(CMake_TEST_TLS_VERIFY_URL)
run_cmake(TLS_VERIFY-bad)
run_cmake_with_options(TLS_VERIFY-good -Durl=${CMake_TEST_TLS_VERIFY_URL})
+ if(CMake_TEST_TLS_VERSION)
+ run_cmake_with_options(TLS_VERSION-good -Durl=${CMake_TEST_TLS_VERIFY_URL} -Dtls_version=${CMake_TEST_TLS_VERSION})
+ endif()
endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt
index 8f5d437..fbff3b9 100644
--- a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad-stdout.txt
@@ -1 +1,7 @@
--- (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error")
+-- def-0: 0;"No error"
+-- env-0: 0;"No error"
+-- env-1: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error")
+-- var-0: 0;"No error"
+-- var-1: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error")
+-- opt-0: 0;"No error"
+-- opt-1: (60;"SSL peer certificate or SSH remote key was not OK"|35;"SSL connect error")
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake
index 333f990..a90c2f4 100644
--- a/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERIFY-bad.cmake
@@ -1,6 +1,34 @@
-file(DOWNLOAD https://expired.badssl.com TLS_VERIFY 1 STATUS status LOG log)
-message(STATUS "${status}")
-list(GET status 0 code)
-if(NOT code MATCHES "^(35|60)$")
- message("${log}")
-endif()
+function(download case)
+ file(DOWNLOAD https://expired.badssl.com ${ARGN} STATUS status LOG log)
+ message(STATUS "${case}: ${status}")
+ if(case MATCHES "1$" AND NOT status MATCHES "^(35|60);")
+ message("${log}")
+ endif()
+endfunction()
+
+# The default is OFF.
+unset(ENV{CMAKE_TLS_VERIFY})
+unset(CMAKE_TLS_VERIFY)
+download(def-0)
+
+# The environment variable overrides the default.
+set(ENV{CMAKE_TLS_VERIFY} 0)
+download(env-0)
+set(ENV{CMAKE_TLS_VERIFY} 1)
+download(env-1)
+
+# The cmake variable overrides the environment variable.
+set(ENV{CMAKE_TLS_VERIFY} 1)
+set(CMAKE_TLS_VERIFY 0)
+download(var-0)
+set(ENV{CMAKE_TLS_VERIFY} 0)
+set(CMAKE_TLS_VERIFY 1)
+download(var-1)
+
+# The explicit argument overrides the cmake variable and the environment variable.
+set(ENV{CMAKE_TLS_VERIFY} 1)
+set(CMAKE_TLS_VERIFY 1)
+download(opt-0 TLS_VERIFY 0)
+set(ENV{CMAKE_TLS_VERIFY} 0)
+set(CMAKE_TLS_VERIFY 0)
+download(opt-1 TLS_VERIFY 1)
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt
new file mode 100644
index 0000000..421c8cf
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad-stderr.txt
@@ -0,0 +1,14 @@
+^CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD given unknown TLS/SSL version bad-env
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD given unknown TLS/SSL version bad-var
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
++
+CMake Error at TLS_VERSION-bad\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD given unknown TLS/SSL version bad-arg
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake
new file mode 100644
index 0000000..51ae4a2
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-bad.cmake
@@ -0,0 +1,10 @@
+# The environment variable provides a default.
+set(ENV{CMAKE_TLS_VERSION} bad-env)
+file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log)
+
+# The cmake variable overrides the environment variable.
+set(CMAKE_TLS_VERSION bad-var)
+file(DOWNLOAD "" TLS_VERIFY 1 STATUS status LOG log)
+
+# The explicit argument overrides the cmake variable.
+file(DOWNLOAD "" TLS_VERSION bad-arg TLS_VERIFY 1 STATUS status LOG log)
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-good.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-good.cmake
new file mode 100644
index 0000000..fcbf650
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-good.cmake
@@ -0,0 +1,6 @@
+file(DOWNLOAD ${url} TLS_VERSION "${tls_version}" TLS_VERIFY 1 STATUS status LOG log)
+message(STATUS "${status}")
+list(GET status 0 code)
+if(NOT code EQUAL 0)
+ message("${log}")
+endif()
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-result.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-stderr.txt b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-stderr.txt
new file mode 100644
index 0000000..05d9d90
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TLS_VERSION-missing\.cmake:[0-9]+ \(file\):
+ file DOWNLOAD missing value for TLS_VERSION\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing.cmake b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing.cmake
new file mode 100644
index 0000000..29fcd96
--- /dev/null
+++ b/Tests/RunCMake/file-DOWNLOAD/TLS_VERSION-missing.cmake
@@ -0,0 +1 @@
+file(DOWNLOAD "" "" TLS_VERSION)
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
index a68607e..f7ede51 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
@@ -42,6 +42,7 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
run_install_test(macos-unresolved)
run_install_test(macos-conflict)
run_install_test(macos-notfile)
+ run_install_test(macos-parent-rpath-propagation)
run_install_test(file-filter)
endif()
run_cmake(project)
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-parent-rpath-propagation.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-parent-rpath-propagation.cmake
new file mode 100644
index 0000000..43df621
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-parent-rpath-propagation.cmake
@@ -0,0 +1,44 @@
+enable_language(C)
+
+# bin/exe (RPATH = "lib1:lib2:lib3")
+# ^
+# |
+# lib1/libone.dylib (RPATH erased)
+# ^
+# |
+# lib2/libtwo.dylib (RPATH erased)
+# ^
+# |
+# lib3/libthree.dylib (RPATH erased)
+# GET_RUNTIME_DEPENDENCIES(bin/exe) should resolve all three libraries
+
+set(TEST_SOURCE_DIR "macos/parent-rpath-propagation")
+
+add_library(three SHARED "${TEST_SOURCE_DIR}/three.c")
+
+add_library(two SHARED "${TEST_SOURCE_DIR}/two.c")
+target_link_libraries(two PRIVATE three)
+
+add_library(one SHARED "${TEST_SOURCE_DIR}/one.c")
+target_link_libraries(one PRIVATE two)
+
+add_executable(exe "${TEST_SOURCE_DIR}/main.c")
+target_link_libraries(exe PUBLIC one)
+
+set_property(TARGET exe PROPERTY INSTALL_RPATH
+ @loader_path/../lib1
+ @loader_path/../lib2
+ @loader_path/../lib3
+)
+
+install(TARGETS exe DESTINATION bin)
+install(TARGETS one DESTINATION lib1)
+install(TARGETS two DESTINATION lib2)
+install(TARGETS three DESTINATION lib3)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>"
+ )
+ ]])
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/main.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/main.c
new file mode 100644
index 0000000..fc02afa
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/main.c
@@ -0,0 +1,8 @@
+extern void one(void);
+
+int main(void)
+{
+ one();
+
+ return 0;
+}
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/one.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/one.c
new file mode 100644
index 0000000..0c480cc
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/one.c
@@ -0,0 +1,6 @@
+extern void two(void);
+
+void one(void)
+{
+ two();
+}
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/three.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/three.c
new file mode 100644
index 0000000..0be5f47
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/three.c
@@ -0,0 +1,3 @@
+void three(void)
+{
+}
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/two.c b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/two.c
new file mode 100644
index 0000000..370baf7
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos/parent-rpath-propagation/two.c
@@ -0,0 +1,6 @@
+extern void three(void);
+
+void two(void)
+{
+ three();
+}
diff --git a/Tests/RunCMake/file-RPATH/CMakeLists.txt b/Tests/RunCMake/file-RPATH/CMakeLists.txt
new file mode 100644
index 0000000..94e43ba
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.29)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/file-RPATH/LargeELF.c b/Tests/RunCMake/file-RPATH/LargeELF.c
new file mode 100644
index 0000000..263c2f3
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/LargeELF.c
@@ -0,0 +1,26 @@
+/* Create more than 65536 ELF sections. */
+
+/* clang-format off */
+#define C0(i) int v##i __attribute__((section("s" #i)))
+#define C1(i) C0(i##0); C0(i##1); C0(i##2); C0(i##3); C0(i##4); \
+ C0(i##5); C0(i##6); C0(i##7); C0(i##8); C0(i##9)
+#define C2(i) C1(i##0); C1(i##1); C1(i##2); C1(i##3); C1(i##4); \
+ C1(i##5); C1(i##6); C1(i##7); C1(i##8); C1(i##9)
+#define C3(i) C2(i##0); C2(i##1); C2(i##2); C2(i##3); C2(i##4); \
+ C2(i##5); C2(i##6); C2(i##7); C2(i##8); C2(i##9)
+#define C4(i) C3(i##0); C3(i##1); C3(i##2); C3(i##3); C3(i##4); \
+ C3(i##5); C3(i##6); C3(i##7); C3(i##8); C3(i##9)
+/* clang-format on */
+
+C4(1);
+C4(2);
+C4(3);
+C4(4);
+C4(5);
+C4(6);
+C4(7);
+
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/file-RPATH/LargeELF.cmake b/Tests/RunCMake/file-RPATH/LargeELF.cmake
new file mode 100644
index 0000000..2eb813e
--- /dev/null
+++ b/Tests/RunCMake/file-RPATH/LargeELF.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+
+add_executable(LargeELF LargeELF.c)
+set_property(TARGET LargeELF PROPERTY INSTALL_RPATH "/test")
+install(TARGETS LargeELF)
diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
index 525df09..028fa11 100644
--- a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake
@@ -16,3 +16,15 @@ run_cmake_command(TextSet ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSet.cma
run_cmake_command(TextSetEmpty ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextSetEmpty.cmake)
run_cmake_command(TextRemove ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/TextRemove.cmake)
+
+# Test install RPATH for ELF files with more than 65536 sections.
+# This is supported only by certain platforms/toolchains, so run
+# this case only if explicitly enabled.
+if(CMake_TEST_ELF_LARGE)
+ block()
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/LargeELF-build)
+ run_cmake_with_options(LargeELF -DCMAKE_INSTALL_PREFIX=${RunCMake_TEST_BINARY_DIR}/root)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ run_cmake_command(LargeELF-build ${CMAKE_COMMAND} --build . --target install)
+ endblock()
+endif()
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index c75e062..be8ee7c 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -12,6 +12,7 @@ run_cmake(UPLOAD-httpheader-not-set)
run_cmake(UPLOAD-netrc-bad)
run_cmake(UPLOAD-tls-cainfo-not-set)
run_cmake(UPLOAD-tls-verify-not-set)
+run_cmake(UPLOAD-TLS_VERSION-missing)
run_cmake(UPLOAD-pass-not-set)
run_cmake(INSTALL-DIRECTORY)
run_cmake(INSTALL-FILES_FROM_DIR)
diff --git a/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-result.txt b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-stderr.txt b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-stderr.txt
new file mode 100644
index 0000000..d61aba7
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at UPLOAD-TLS_VERSION-missing\.cmake:[0-9]+ \(file\):
+ file UPLOAD missing value for TLS_VERSION\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing.cmake b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing.cmake
new file mode 100644
index 0000000..dff9a9c
--- /dev/null
+++ b/Tests/RunCMake/file/UPLOAD-TLS_VERSION-missing.cmake
@@ -0,0 +1 @@
+file(UPLOAD "" "" TLS_VERSION)
diff --git a/Tests/RunCMake/property_init/CompileSources.cmake b/Tests/RunCMake/property_init/CompileSources.cmake
index e8c5554..22b8f3f 100644
--- a/Tests/RunCMake/property_init/CompileSources.cmake
+++ b/Tests/RunCMake/property_init/CompileSources.cmake
@@ -100,6 +100,7 @@ set(properties
"C_LINKER_LAUNCHER" "ccache" "<SAME>"
### C++
"CXX_LINKER_LAUNCHER" "ccache" "<SAME>"
+ "CXX_MODULE_STD" "ON" "<SAME>"
### CUDA
"CUDA_RESOLVE_DEVICE_SYMBOLS" "ON" "<SAME>"
"CUDA_RUNTIME_LIBRARY" "Static" "<SAME>"
diff --git a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake
index bdf5810..cbd44bf 100644
--- a/Tests/RunCMake/separate_arguments/ProgramCommand.cmake
+++ b/Tests/RunCMake/separate_arguments/ProgramCommand.cmake
@@ -4,12 +4,11 @@ if (out)
message (SEND_ERROR "unexpected result with nonexistent program")
endif()
-set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe")
-file(MAKE_DIRECTORY "${TEST_EXE_DIR}")
-file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}")
-cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe)
+get_filename_component(cmake_command "${CMAKE_COMMAND}" ABSOLUTE)
+cmake_path (GET cmake_command FILENAME cmake_exe)
+cmake_path (GET cmake_command PARENT_PATH cmake_dir)
-set (ENV{PATH} "${TEST_EXE_DIR}")
+set (ENV{PATH} "${cmake_dir}")
separate_arguments (out UNIX_COMMAND PROGRAM "${cmake_exe}")
@@ -22,8 +21,8 @@ if (NOT length EQUAL 2)
endif()
list(GET out 0 cmake)
list(GET out 1 args)
-if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}")
- message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'")
+if (NOT cmake STREQUAL "${cmake_dir}/${cmake_exe}")
+ message (SEND_ERROR "bad path for program: '${cmake}' instead of '${cmake_dir}/${cmake_exe}'")
endif()
if (NOT args STREQUAL "")
message (SEND_ERROR "bad value for args: '${args}' instead of ''")
@@ -40,8 +39,8 @@ if (NOT length EQUAL 2)
endif()
list(GET out 0 cmake)
list(GET out 1 args)
-if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}")
- message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'")
+if (NOT cmake STREQUAL "${cmake_dir}/${cmake_exe}")
+ message (SEND_ERROR "bad path for program: '${cmake}' instead of '${cmake_dir}/${cmake_exe}'")
endif()
if (NOT args STREQUAL " a b c")
message (SEND_ERROR "bad value for args: '${args}' instead of ' a b c'")
diff --git a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake
index 2826cc9..b93b42c 100644
--- a/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake
+++ b/Tests/RunCMake/separate_arguments/ProgramCommandWithSeparateArgs.cmake
@@ -4,12 +4,11 @@ if (out)
message (SEND_ERROR "unexpected result with nonexistent program")
endif()
-set (TEST_EXE_DIR "${CMAKE_CURRENT_BINARY_DIR}/TestExe")
-file(MAKE_DIRECTORY "${TEST_EXE_DIR}")
-file(COPY "${CMAKE_COMMAND}" DESTINATION "${TEST_EXE_DIR}")
-cmake_path (GET CMAKE_COMMAND FILENAME cmake_exe)
+get_filename_component(cmake_command "${CMAKE_COMMAND}" ABSOLUTE)
+cmake_path (GET cmake_command FILENAME cmake_exe)
+cmake_path (GET cmake_command PARENT_PATH cmake_dir)
-set (ENV{PATH} "${TEST_EXE_DIR}")
+set (ENV{PATH} "${cmake_dir}")
separate_arguments (out UNIX_COMMAND PROGRAM SEPARATE_ARGS "${cmake_exe} a b c")
list (LENGTH out length)
@@ -20,8 +19,8 @@ if (NOT length EQUAL 4)
message(FATAL_ERROR "unexpected arguments")
endif()
list(POP_FRONT out cmake)
-if (NOT cmake STREQUAL "${TEST_EXE_DIR}/${cmake_exe}")
- message (SEND_ERROR "bad path for program: '${cmake}' instead of '${TEST_EXE_DIR}/${cmake_exe}'")
+if (NOT cmake STREQUAL "${cmake_dir}/${cmake_exe}")
+ message (SEND_ERROR "bad path for program: '${cmake}' instead of '${cmake_dir}/${cmake_exe}'")
endif()
if (NOT out STREQUAL "a;b;c")
message (SEND_ERROR "bad path for args: '${out}' instead of 'a;b;c'")
diff --git a/Tests/SwiftOnly/CMakeLists.txt b/Tests/SwiftOnly/CMakeLists.txt
index c5a4b83..de4c82f 100644
--- a/Tests/SwiftOnly/CMakeLists.txt
+++ b/Tests/SwiftOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0126)
cmake_policy(SET CMP0126 NEW)
endif()
@@ -57,16 +57,7 @@ add_dependencies(P SwiftOnly)
add_library(SwiftIface INTERFACE)
target_link_libraries(SwiftOnly PRIVATE SwiftIface)
-# @_alwaysEmitIntoClient ensures that the function body is inserted into the
-# swiftmodule instead of as a symbol in the binary itself. I'm doing this to
-# avoid having to link the executable. There are some flags required in order to
-# link an executable into a library that I didn't see CMake emitting for Swift
-# on macOS. AEIC is the easiest workaround that still tests this functionality.
-# Unfortunately, AEIC was only added recently (~Swift 5.2), so we need to check
-# that it is available before using it.
-if(CMAKE_Swift_COMPILER_VERSION VERSION_GREATER_EQUAL 5.2)
- add_subdirectory("SwiftPlugin")
-endif()
+add_subdirectory("SwiftPlugin")
function(test_cmp0157_default mode)
if(POLICY CMP0157)
diff --git a/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
index 4069f16..2bfbc8a 100644
--- a/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
+++ b/Tests/SwiftOnly/SwiftPlugin/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(main main.swift)
set_target_properties(main PROPERTIES ENABLE_EXPORTS TRUE)
-add_library(plugin plugin.swift)
+add_library(plugin MODULE plugin.swift)
target_link_libraries(plugin PRIVATE main)
diff --git a/Tests/SwiftOnly/SwiftPlugin/main.swift b/Tests/SwiftOnly/SwiftPlugin/main.swift
index f5aac51..caba1fb 100644
--- a/Tests/SwiftOnly/SwiftPlugin/main.swift
+++ b/Tests/SwiftOnly/SwiftPlugin/main.swift
@@ -1,4 +1,3 @@
-@_alwaysEmitIntoClient
-public func exported() -> Int { 32 }
+public func exported() -> Int { return 32 }
print(exported())
diff --git a/Tests/SwiftOnly/SwiftPlugin/plugin.swift b/Tests/SwiftOnly/SwiftPlugin/plugin.swift
index e84f248..d00ca33 100644
--- a/Tests/SwiftOnly/SwiftPlugin/plugin.swift
+++ b/Tests/SwiftOnly/SwiftPlugin/plugin.swift
@@ -1,3 +1,3 @@
import main
-public func importing() -> Int { main.exported() + 1 }
+public func importing() -> Int { return main.exported() + 1 }
diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt
index f77370c..c7b58a9 100644
--- a/Tests/TestsWorkingDirectory/CMakeLists.txt
+++ b/Tests/TestsWorkingDirectory/CMakeLists.txt
@@ -7,30 +7,32 @@ enable_testing()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
-add_test(NAME WorkingDirectory0 COMMAND WorkingDirectory "${CMAKE_BINARY_DIR}")
+file(REAL_PATH "${CMAKE_BINARY_DIR}" _real_binary_dir)
-add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory "${CMAKE_BINARY_DIR}")
+add_test(NAME WorkingDirectory0 COMMAND WorkingDirectory "${_real_binary_dir}")
+
+add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory "${_real_binary_dir}")
set_tests_properties(WorkingDirectory1 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_binary_dir}")
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory "${_parent_dir}")
set_tests_properties(WorkingDirectory2 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.."
)
-set(_default_cwd "${CMAKE_BINARY_DIR}")
+set(_default_cwd "${_real_binary_dir}")
# FIXME: How to deal with /debug, /release, etc. with VS or Xcode?
if(${CMAKE_GENERATOR} MATCHES "Makefiles")
add_test(WorkingDirectory3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd})
endif()
-add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory ${CMAKE_BINARY_DIR})
+add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory ${_real_binary_dir})
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_binary_dir}")
add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir})
diff --git a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
index c16b1db..a7f32b8 100644
--- a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
+++ b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
@@ -1,27 +1,29 @@
-add_test(NAME WorkingDirectory-Subdir0 COMMAND WorkingDirectory "${CMAKE_CURRENT_BINARY_DIR}")
+file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}" _real_current_binary_dir)
-add_test(NAME WorkingDirectory-Subdir1 COMMAND WorkingDirectory "${CMAKE_CURRENT_BINARY_DIR}")
+add_test(NAME WorkingDirectory-Subdir0 COMMAND WorkingDirectory "${_real_current_binary_dir}")
+
+add_test(NAME WorkingDirectory-Subdir1 COMMAND WorkingDirectory "${_real_current_binary_dir}")
set_tests_properties(WorkingDirectory-Subdir1 PROPERTIES
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_CURRENT_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_current_binary_dir}")
add_test(NAME WorkingDirectory-Subdir2 COMMAND WorkingDirectory "${_parent_dir}")
set_tests_properties(WorkingDirectory-Subdir2 PROPERTIES
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
)
-set(_default_cwd "${CMAKE_CURRENT_BINARY_DIR}")
+set(_default_cwd "${_real_current_binary_dir}")
# FIXME: How to deal with /debug, /release, etc. with VS or Xcode?
if(${CMAKE_GENERATOR} MATCHES "Makefiles")
add_test(WorkingDirectory-Subdir3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd})
endif()
-add_test(NAME WorkingDirectory-Subdir4 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND WorkingDirectory ${CMAKE_CURRENT_BINARY_DIR})
+add_test(NAME WorkingDirectory-Subdir4 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND WorkingDirectory ${_real_current_binary_dir})
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_CURRENT_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_current_binary_dir}")
add_test(NAME WorkingDirectory-Subdir5 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir})
diff --git a/Tests/VSAndroid/CMakeLists.txt b/Tests/VSAndroid/CMakeLists.txt
index 73b1e07..774ffc0 100644
--- a/Tests/VSAndroid/CMakeLists.txt
+++ b/Tests/VSAndroid/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.3)
project(VSAndroid C CXX)
set(CMAKE_ANDROID_ARCH armv7-a)
-set(CMAKE_ANDROID_STL_TYPE stlport_shared)
+set(CMAKE_ANDROID_STL_TYPE c++_shared)
set(CMAKE_ANDROID_API_MIN 9)
set(CMAKE_ANDROID_API 15)
set(CMAKE_ANDROID_GUI 1)
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 2a8c855..5e6ef0a 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -13,7 +13,7 @@ else()
add_subdirectory(Sphinx)
endif()
-if(WIX_CUSTOM_ACTION_ENABLED)
+if(CMake_BUILD_WIX_CUSTOM_ACTION)
add_subdirectory(Release/WiX)
endif()
diff --git a/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx b/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
index 37ecd70..9ec8e5f 100644
--- a/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
+++ b/Utilities/ClangTidyModule/UsePragmaOnceCheck.cxx
@@ -55,10 +55,10 @@ public:
, FID(FID)
{
SourceManager& SM = this->PP->getSourceManager();
- const FileEntry* Entry = SM.getFileEntryForID(FID);
+ OptionalFileEntryRef Entry = SM.getFileEntryRefForID(FID);
assert(Entry && "Invalid FileID given");
- Lexer MyLexer(FID, SM.getMemoryBufferForFileOrFake(Entry), SM,
+ Lexer MyLexer(FID, SM.getMemoryBufferForFileOrFake(*Entry), SM,
this->PP->getLangOpts());
Token Tok;
@@ -157,9 +157,10 @@ public:
// guards.
SourceManager& SM = this->PP->getSourceManager();
if (Reason == EnterFile && FileType == SrcMgr::C_User) {
- if (const FileEntry* FE = SM.getFileEntryForID(SM.getFileID(Loc))) {
+ if (OptionalFileEntryRef FE =
+ SM.getFileEntryRefForID(SM.getFileID(Loc))) {
std::string FileName = cleanPath(FE->getName());
- this->Files[FileName] = FE;
+ this->Files.try_emplace(FileName, *FE);
}
}
}
@@ -205,9 +206,9 @@ public:
continue;
}
- const FileEntry* FE =
- SM.getFileEntryForID(SM.getFileID(MI->getDefinitionLoc()));
- std::string FileName = cleanPath(FE->getName());
+ FileEntryRef FE =
+ *SM.getFileEntryRefForID(SM.getFileID(MI->getDefinitionLoc()));
+ std::string FileName = cleanPath(FE.getName());
this->Files.erase(FileName);
// Look up Locations for this guard.
@@ -290,7 +291,7 @@ private:
}
std::vector<std::pair<Token, const MacroInfo*>> Macros;
- llvm::StringMap<const FileEntry*> Files;
+ llvm::StringMap<FileEntryRef> Files;
std::map<const IdentifierInfo*, std::pair<SourceLocation, SourceLocation>>
Ifndefs;
std::map<SourceLocation, SourceLocation> EndIfs;
diff --git a/Utilities/Doxygen/CMakeLists.txt b/Utilities/Doxygen/CMakeLists.txt
index 52a31eb..8bf591b 100644
--- a/Utilities/Doxygen/CMakeLists.txt
+++ b/Utilities/Doxygen/CMakeLists.txt
@@ -3,7 +3,7 @@
if(NOT CMake_SOURCE_DIR)
set(CMakeDeveloperReference_STANDALONE 1)
- cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.13...3.28 FATAL_ERROR)
get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
diff --git a/Utilities/Release/WiX/WIX.template.in b/Utilities/Release/WiX/WIX.template.in
index 1f8953b..fb8fa59 100644
--- a/Utilities/Release/WiX/WIX.template.in
+++ b/Utilities/Release/WiX/WIX.template.in
@@ -12,7 +12,7 @@
Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
- <Package InstallerVersion="301" Compressed="yes" InstallScope="perMachine"/>
+ <Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine"/>
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
@@ -39,16 +39,14 @@
<?endif?>
<DirectoryRef Id="TARGETDIR">
- <Component Id="CMakeRegistry">
- <RegistryKey Root="HKLM" Key="Software\Kitware\CMake">
- <RegistryValue Type="string" Name="InstallDir"
- Value="[INSTALL_ROOT]" KeyPath="yes"/>
- </RegistryKey>
+ <Component Id="CMakeRegistry_InstallDir">
+ <RegistryValue Root="HKLM" Key="Software\Kitware\CMake" Name="InstallDir" Type="string" Value="[INSTALL_ROOT]" />
</Component>
</DirectoryRef>
<FeatureRef Id="ProductFeature">
- <ComponentRef Id="CMakeRegistry"/>
+ <ComponentRef Id="CMakeRegistry_InstallDir" />
+ <ComponentRef Id="CMakeRegistry_InstallInPATH" />
</FeatureRef>
<UIRef Id="$(var.CPACK_WIX_UI_REF)" />
diff --git a/Utilities/Release/WiX/cmake_extra_dialog.wxs b/Utilities/Release/WiX/cmake_extra_dialog.wxs
deleted file mode 100644
index 0ee3d99..0000000
--- a/Utilities/Release/WiX/cmake_extra_dialog.wxs
+++ /dev/null
@@ -1,36 +0,0 @@
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <UI>
- <Property Id="ADD_CMAKE_TO_PATH" Value="None"/>
- <Dialog Id="CMakeExtraDialog" Width="370" Height="270" Title="Install Options">
-
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"/>
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
-
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
-
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Choose options for installing CMake [ProductVersion]"/>
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Install Options"/>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)"/>
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0"/>
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0"/>
-
- <Control Id="Hint" Type="Text" X="26" Y="60" Width="250" Height="16" Transparent="yes" Text="By default CMake does not add its directory to the system PATH."/>
-
- <Control Id="ADD_CMAKE_TO_PATHOption" Type="RadioButtonGroup" X="26" Y="100" Width="305" Height="65" Property="ADD_CMAKE_TO_PATH">
- <RadioButtonGroup Property="ADD_CMAKE_TO_PATH">
- <RadioButton Value="None" X="0" Y="0" Width="295" Height="16" Text="Do not add CMake to the system PATH"/>
- <RadioButton Value="System" X="0" Y="20" Width="295" Height="16" Text="Add CMake to the system PATH for all users"/>
- <RadioButton Value="User" X="0" Y="40" Width="295" Height="16" Text="Add CMake to the system PATH for the current user"/>
- </RadioButtonGroup>
- </Control>
-
- <?ifdef BUILD_QtDialog ?>
- <Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="170" Width="330" Height="18" CheckBoxValue="1" Property="DESKTOP_SHORTCUT_REQUESTED" Text="Create CMake Desktop Icon"/>
- <?endif ?>
- </Dialog>
- </UI>
- </Fragment>
-</Wix>
diff --git a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs
index 8fe60f2..88335f8 100644
--- a/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs
+++ b/Utilities/Release/WiX/cmake_nsis_overwrite_dialog.wxs
@@ -1,21 +1,21 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <UI>
- <Dialog Id="CMakeNsisOverwriteDialog" Width="310" Height="120" Title="NSIS Installation Conflict">
- <Control Id="OK" Type="PushButton" X="122" Y="90" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIOK)">
- <Publish Event="EndDialog" Value="Return">1</Publish>
- </Control>
- <Control Id="Text" Type="Text" X="48" Y="22" Width="260" Height="60">
- <Text>
- Uninstall.exe was detected in your chosen installation prefix.
- This indicates a conflicting NSIS based installation of CMake.
+ <Fragment>
+ <UI>
+ <Dialog Id="CMakeNsisOverwriteDialog" Width="310" Height="120" Title="NSIS Installation Conflict">
+ <Control Id="OK" Type="PushButton" X="122" Y="90" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIOK)">
+ <Publish Event="EndDialog" Value="Return">1</Publish>
+ </Control>
+ <Control Id="Text" Type="Text" X="48" Y="22" Width="260" Height="60">
+ <Text>
+ Uninstall.exe was detected in your chosen installation prefix.
+ This indicates a conflicting NSIS based installation of CMake.
- Please uninstall your old CMake installation or choose a different
- installation directory.
- </Text>
- </Control>
- <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.InvalidDirDlgIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.InvalidDirDlgIcon)" />
- </Dialog>
- </UI>
- </Fragment>
+ Please uninstall your old CMake installation or choose a different
+ installation directory.
+ </Text>
+ </Control>
+ <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.InvalidDirDlgIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.InvalidDirDlgIcon)" />
+ </Dialog>
+ </UI>
+ </Fragment>
</Wix>
diff --git a/Utilities/Release/WiX/custom_action_dll.wxs.in b/Utilities/Release/WiX/custom_action_dll.wxs.in
index 021e63c..64e9762 100644
--- a/Utilities/Release/WiX/custom_action_dll.wxs.in
+++ b/Utilities/Release/WiX/custom_action_dll.wxs.in
@@ -1,6 +1,6 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <Binary Id="CMakeCustomActionsDll"
- SourceFile="$<TARGET_FILE:CMakeWiXCustomActions>"/>
- </Fragment>
+ <Fragment>
+ <Binary Id="CMakeCustomActionsDll"
+ SourceFile="$<TARGET_FILE:CMakeWiXCustomActions>"/>
+ </Fragment>
</Wix>
diff --git a/Utilities/Release/WiX/install_dir.wxs b/Utilities/Release/WiX/install_dir.wxs
index 49b74e3..d7debde 100644
--- a/Utilities/Release/WiX/install_dir.wxs
+++ b/Utilities/Release/WiX/install_dir.wxs
@@ -1,72 +1,72 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <UI Id="CMakeUI_InstallDir">
- <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
- <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
- <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+ <Fragment>
+ <UI Id="CMakeUI_InstallDir">
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
- <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
- <Property Id="WixUI_Mode" Value="InstallDir" />
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="InstallDir" />
- <DialogRef Id="CMakeExtraDialog" />
- <?ifdef CHECK_NSIS ?>
- <DialogRef Id="CMakeNsisOverwriteDialog" />
- <?endif ?>
+ <DialogRef Id="CMakeOptionsDlg" />
+ <?ifdef CHECK_NSIS ?>
+ <DialogRef Id="CMakeNsisOverwriteDialog" />
+ <?endif ?>
- <DialogRef Id="BrowseDlg" />
- <DialogRef Id="DiskCostDlg" />
- <DialogRef Id="ErrorDlg" />
- <DialogRef Id="FatalError" />
- <DialogRef Id="FilesInUse" />
- <DialogRef Id="MsiRMFilesInUse" />
- <DialogRef Id="PrepareDlg" />
- <DialogRef Id="ProgressDlg" />
- <DialogRef Id="ResumeDlg" />
- <DialogRef Id="UserExit" />
+ <DialogRef Id="BrowseDlg" />
+ <DialogRef Id="DiskCostDlg" />
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
- <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
- <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+ <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
+ <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
- <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
- <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
- <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
- <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CMakeExtraDialog">LicenseAccepted = "1"</Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CMakeOptionsDlg">LicenseAccepted = "1"</Publish>
- <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="CMakeExtraDialog">1</Publish>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
- <?ifdef CHECK_NSIS ?>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="CMakeDetectNsisOverwrite" Order="4">1</Publish>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="CMakeNsisOverwriteDialog" Order="5">CMAKE_NSIS_OVERWRITE_DETECTED="1"</Publish>
- <?endif ?>
- <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="6"><![CDATA[(WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1") AND CMAKE_NSIS_OVERWRITE_DETECTED<>1]]></Publish>
- <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
- <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
+ <Publish Dialog="CMakeOptionsDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ <Publish Dialog="CMakeOptionsDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
- <Publish Dialog="CMakeExtraDialog" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
- <Publish Dialog="CMakeExtraDialog" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="CMakeOptionsDlg">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
+ <?ifdef CHECK_NSIS ?>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="CMakeDetectNsisOverwrite" Order="4">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="CMakeNsisOverwriteDialog" Order="5">CMAKE_NSIS_OVERWRITE_DETECTED="1"</Publish>
+ <?endif ?>
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="6"><![CDATA[(WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1") AND CMAKE_NSIS_OVERWRITE_DETECTED<>1]]></Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
- <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
- <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
- <Property Id="ARPNOMODIFY" Value="1" />
- </UI>
+ <Property Id="ARPNOMODIFY" Value="1" />
+ </UI>
- <UIRef Id="WixUI_Common" />
+ <UIRef Id="WixUI_Common" />
- <?ifdef CHECK_NSIS ?>
- <CustomAction Id="CMakeDetectNsisOverwrite" BinaryKey="CMakeCustomActionsDll" DllEntry="DetectNsisOverwrite"/>
- <?endif ?>
- </Fragment>
+ <?ifdef CHECK_NSIS ?>
+ <CustomAction Id="CMakeDetectNsisOverwrite" BinaryKey="CMakeCustomActionsDll" DllEntry="DetectNsisOverwrite"/>
+ <?endif ?>
+ </Fragment>
</Wix>
diff --git a/Utilities/Release/WiX/options.wxs b/Utilities/Release/WiX/options.wxs
new file mode 100644
index 0000000..0fd3527
--- /dev/null
+++ b/Utilities/Release/WiX/options.wxs
@@ -0,0 +1,36 @@
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Fragment>
+ <!-- Hold the "CMAKE_IN_PATH" checkbox value in a public property to propagate to the InstallExecuteSequence. -->
+ <Property Id="CMAKE_IN_PATH" Value="Init" />
+
+ <!-- Always initialize the checkbox value so it cannot be directly overridden from the command line. -->
+ <SetProperty Action="Set_CMAKE_IN_PATH_Init" Id="CMAKE_IN_PATH" After="AppSearch" Sequence="first" Value="1" />
+
+ <!-- Read the "CMAKE_IN_PATH" checkbox value from the registry, if it was stored previously.
+ Properties using RegistrySearch cannot be private, so use a private-looking public name. -->
+ <Property Id="_CMAKE_IN_PATH_REG">
+ <RegistrySearch Id="CMAKE_IN_PATH_RegistrySearch_HKLM" Root="HKLM" Key="Software\Kitware\CMake" Name="InstallInPATH" Type="raw" />
+ </Property>
+
+ <!-- Override the default "CMAKE_IN_PATH" checkbox with a value read from the registry, if any. -->
+ <SetProperty Action="Set_CMAKE_IN_PATH_REG_0" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_Init" Sequence="first" Value="{}"> _CMAKE_IN_PATH_REG = "#0" </SetProperty>
+ <SetProperty Action="Set_CMAKE_IN_PATH_REG_1" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_REG_0" Sequence="first" Value="1"> _CMAKE_IN_PATH_REG = "#1" </SetProperty>
+
+ <!-- Override the default "CMAKE_IN_PATH" checkbox with a value specified on the command line, if any. -->
+ <SetProperty Action="Set_CMAKE_IN_PATH_CMD_0" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_REG_1" Sequence="first" Value="{}"> ADD_CMAKE_TO_PATH = "0" </SetProperty>
+ <SetProperty Action="Set_CMAKE_IN_PATH_CMD_1" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_0" Sequence="first" Value="1"> ADD_CMAKE_TO_PATH = "1" </SetProperty>
+ <!-- Support legacy values too. -->
+ <SetProperty Action="Set_CMAKE_IN_PATH_CMD_None" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_1" Sequence="first" Value="{}"> ADD_CMAKE_TO_PATH = "None" </SetProperty>
+ <SetProperty Action="Set_CMAKE_IN_PATH_CMD_System" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_None" Sequence="first" Value="1"> ADD_CMAKE_TO_PATH = "System" AND ALLUSERS </SetProperty>
+ <!-- Per-user installation is not implemented, but reserve the old value for future use. -->
+ <SetProperty Action="Set_CMAKE_IN_PATH_CMD_User" Id="CMAKE_IN_PATH" After="Set_CMAKE_IN_PATH_CMD_System" Sequence="first" Value="1"> ADD_CMAKE_TO_PATH = "User" AND NOT ALLUSERS </SetProperty>
+
+ <DirectoryRef Id="TARGETDIR">
+ <!-- Save the "CMAKE_IN_PATH" checkbox value persistently in the registry. -->
+ <Component Id="CMakeRegistry_InstallInPATH">
+ <!-- Use a leading "0" so the value parses as an integer even when the property is unset. -->
+ <RegistryValue Root="HKLM" Key="Software\Kitware\CMake" Name="InstallInPATH" Type="integer" Value="0[CMAKE_IN_PATH]" />
+ </Component>
+ </DirectoryRef>
+ </Fragment>
+</Wix>
diff --git a/Utilities/Release/WiX/options_dlg.wxs b/Utilities/Release/WiX/options_dlg.wxs
new file mode 100644
index 0000000..4d27d00
--- /dev/null
+++ b/Utilities/Release/WiX/options_dlg.wxs
@@ -0,0 +1,28 @@
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Fragment>
+ <UI>
+ <PropertyRef Id="CMAKE_IN_PATH" />
+ <Dialog Id="CMakeOptionsDlg" Width="370" Height="270" Title="Install Options">
+
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"/>
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)"/>
+
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Choose options for installing CMake [ProductVersion]"/>
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="Install Options"/>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)"/>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0"/>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0"/>
+
+ <Control Id="CMAKE_IN_PATH_CheckBox" Type="CheckBox" X="20" Y="60" Width="330" Height="18" CheckBoxValue="1" Property="CMAKE_IN_PATH" Text="Add CMake to the PATH environment variable" />
+
+ <?ifdef BUILD_QtDialog ?>
+ <Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="80" Width="330" Height="18" CheckBoxValue="1" Property="DESKTOP_SHORTCUT_REQUESTED" Text="Add CMake shortcut to the Desktop" />
+ <?endif ?>
+ </Dialog>
+ </UI>
+ </Fragment>
+</Wix>
diff --git a/Utilities/Release/WiX/patch_desktop_shortcut.xml b/Utilities/Release/WiX/patch_desktop_shortcut.xml
index d30705d..8ec2c12 100644
--- a/Utilities/Release/WiX/patch_desktop_shortcut.xml
+++ b/Utilities/Release/WiX/patch_desktop_shortcut.xml
@@ -1,5 +1,5 @@
<CPackWiXPatch>
<CPackWiXFragment Id="CM_SHORTCUT_DESKTOP">
- <Condition>DESKTOP_SHORTCUT_REQUESTED = 1</Condition>
+ <Condition>DESKTOP_SHORTCUT_REQUESTED</Condition>
</CPackWiXFragment>
</CPackWiXPatch>
diff --git a/Utilities/Release/WiX/patch_path_env.xml b/Utilities/Release/WiX/patch_path_env.xml
index 0e335c4..ba4316d 100644
--- a/Utilities/Release/WiX/patch_path_env.xml
+++ b/Utilities/Release/WiX/patch_path_env.xml
@@ -1,18 +1,17 @@
<CPackWiXPatch>
<CPackWiXFragment Id="CM_DP_bin">
+ <!-- Implement the "CMAKE_IN_PATH" checkbox when installing for all users. -->
<Component Id="CMakeSystemPathEntryCMP" KeyPath="yes" Guid="0E782367-5D68-4539-81D1-B9757AE496A1">
-
- <Condition>ADD_CMAKE_TO_PATH = "System"</Condition>
-
+ <Condition>CMAKE_IN_PATH AND ALLUSERS</Condition>
<Environment Id="CMakeSystemPathEntryENV" Action="set" Part="last"
Name="PATH" Value="[INSTALL_ROOT]bin"
System="yes"/>
</Component>
+ <!-- Implement the "CMAKE_IN_PATH" checkbox when installing per-user. -->
+ <!-- This is not currently reachable, but is reserved for future use. -->
<Component Id="CMakeUserPathEntryCMP" KeyPath="yes" Guid="392E524D-D5BF-4F16-A7AF-A82B07482CB9">
-
- <Condition>ADD_CMAKE_TO_PATH = "User"</Condition>
-
+ <Condition>CMAKE_IN_PATH AND NOT ALLUSERS</Condition>
<Environment Id="CMakeUserPathEntryENV" Action="set" Part="last"
Name="PATH" Value="[INSTALL_ROOT]bin"
System="no"/>
diff --git a/Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps1 b/Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps1
index e1d9ad1..e1d9ad1 100755..100644
--- a/Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps1
+++ b/Utilities/Release/win/qt-5.15.10-win-x86-msvc.ps1
diff --git a/Utilities/Release/win/sign-package.ps1 b/Utilities/Release/win/sign-package.ps1
index fdaff14..fdaff14 100755..100644
--- a/Utilities/Release/win/sign-package.ps1
+++ b/Utilities/Release/win/sign-package.ps1
diff --git a/Utilities/Scripts/update-curl.bash b/Utilities/Scripts/update-curl.bash
index 09bb65b..d66fcda 100755
--- a/Utilities/Scripts/update-curl.bash
+++ b/Utilities/Scripts/update-curl.bash
@@ -8,7 +8,7 @@ readonly name="curl"
readonly ownership="Curl Upstream <curl-library@lists.haxx.se>"
readonly subtree="Utilities/cmcurl"
readonly repo="https://github.com/curl/curl.git"
-readonly tag="curl-8_6_0"
+readonly tag="curl-8_7_1"
readonly shortlog=false
readonly paths="
CMake/*
diff --git a/Utilities/Scripts/update-zlib.bash b/Utilities/Scripts/update-zlib.bash
index c18f118..aad18bf 100755
--- a/Utilities/Scripts/update-zlib.bash
+++ b/Utilities/Scripts/update-zlib.bash
@@ -8,7 +8,7 @@ readonly name="zlib"
readonly ownership="zlib upstream <kwrobot@kitware.com>"
readonly subtree="Utilities/cmzlib"
readonly repo="https://github.com/madler/zlib.git"
-readonly tag="v1.2.13" # When updating, sync Copyright.txt below!
+readonly tag="v1.3.1" # When updating, sync Copyright.txt below!
readonly shortlog=false
readonly paths="
README
@@ -45,7 +45,7 @@ extract_source () {
pushd "${extractdir}/${name}-reduced"
echo "* -whitespace" > .gitattributes
echo -n "'zlib' general purpose compression library
-version 1.2.13, October 13th, 2022
+version 1.3.1, January 22nd, 2024
Copyright " > Copyright.txt
sed -n '/^ (C) 1995-/,+19 {s/^ \?//;p}' README >> Copyright.txt
diff --git a/Utilities/Scripts/update-zstd.bash b/Utilities/Scripts/update-zstd.bash
index 48ca5a1..7bfb3dc 100755
--- a/Utilities/Scripts/update-zstd.bash
+++ b/Utilities/Scripts/update-zstd.bash
@@ -8,7 +8,7 @@ readonly name="zstd"
readonly ownership="zstd upstream <kwrobot@kitware.com>"
readonly subtree="Utilities/cmzstd"
readonly repo="https://github.com/facebook/zstd.git"
-readonly tag="v1.5.0"
+readonly tag="v1.5.5"
readonly shortlog=false
readonly paths="
LICENSE
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 4ffcdd7..746c872 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -3,7 +3,7 @@
if(NOT CMake_SOURCE_DIR)
set(CMakeHelp_STANDALONE 1)
- cmake_minimum_required(VERSION 3.13...3.27 FATAL_ERROR)
+ cmake_minimum_required(VERSION 3.13...3.28 FATAL_ERROR)
get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)
diff --git a/Utilities/Sphinx/CTestCustom.cmake.in b/Utilities/Sphinx/CTestCustom.cmake.in
index 840121b..ee13aa1 100644
--- a/Utilities/Sphinx/CTestCustom.cmake.in
+++ b/Utilities/Sphinx/CTestCustom.cmake.in
@@ -1,3 +1,4 @@
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"cmake.texi:[0-9]+: warning: .definfoenclose is obsolete"
+ "cmake.texi:[0-9]+: warning: @ref should not appear on @item line"
)
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index 20e1340..09a7d5a 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -98,6 +98,7 @@ linkcheck_allowed_redirects = {
r'https://cdash\.org': r'https://www\.cdash\.org/',
r'https://cmake.org/get-involved/': r'https://cmake.org/documentation/',
r'https://docs\.nvidia\.com/cuda/': r'https://docs\.nvidia\.com/cuda/index\.html',
+ r'https://learn\.microsoft\.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support': r'https://learn\.microsoft\.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support\?.*',
r'https://learn\.microsoft\.com/en-us/cpp/c-language/parsing-c-command-line-arguments': r'https://learn\.microsoft\.com/en-us/cpp/c-language/parsing-c-command-line-arguments\?.*',
r'https://openjdk\.java\.net/jeps/313': r'https://openjdk\.org:443/jeps/313',
r'https://www\.sphinx-doc\.org': r'https://www\.sphinx-doc\.org/en/master/',
diff --git a/Utilities/cmcurl/CMake/Macros.cmake b/Utilities/cmcurl/CMake/Macros.cmake
index 9ff62ea..d5439fc 100644
--- a/Utilities/cmcurl/CMake/Macros.cmake
+++ b/Utilities/cmcurl/CMake/Macros.cmake
@@ -68,35 +68,6 @@ macro(curl_internal_test CURL_TEST)
endif()
endmacro()
-macro(curl_nroff_check)
- find_program(NROFF NAMES gnroff nroff)
- if(NROFF)
- # Need a way to write to stdin, this will do
- file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt" "test")
- # Tests for a valid nroff option to generate a manpage
- foreach(_MANOPT "-man" "-mandoc")
- execute_process(COMMAND "${NROFF}" ${_MANOPT}
- OUTPUT_VARIABLE NROFF_MANOPT_OUTPUT
- INPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt"
- ERROR_QUIET)
- # Save the option if it was valid
- if(NROFF_MANOPT_OUTPUT)
- message("Found *nroff option: -- ${_MANOPT}")
- set(NROFF_MANOPT ${_MANOPT})
- set(NROFF_USEFUL ON)
- break()
- endif()
- endforeach()
- # No need for the temporary file
- file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/nroff-input.txt")
- if(NOT NROFF_USEFUL)
- message(WARNING "Found no *nroff option to get plaintext from man pages")
- endif()
- else()
- message(WARNING "Found no *nroff program")
- endif()
-endmacro()
-
macro(optional_dependency DEPENDENCY)
set(CURL_${DEPENDENCY} AUTO CACHE STRING "Build curl with ${DEPENDENCY} support (AUTO, ON or OFF)")
set_property(CACHE CURL_${DEPENDENCY} PROPERTY STRINGS AUTO ON OFF)
diff --git a/Utilities/cmcurl/CMake/Utilities.cmake b/Utilities/cmcurl/CMake/Utilities.cmake
index 9ff38e3..84a40f4 100644
--- a/Utilities/cmcurl/CMake/Utilities.cmake
+++ b/Utilities/cmcurl/CMake/Utilities.cmake
@@ -23,7 +23,7 @@
###########################################################################
# File containing various utilities
-# Returns a list of arguments that evaluate to true
+# Returns number of arguments that evaluate to true
function(count_true output_count_var)
set(lst_len 0)
foreach(option_var IN LISTS ARGN)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 3dd24f1..21601e9 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -93,6 +93,7 @@ set(SHARE_LIB_OBJECT OFF)
set(USE_LIBIDN2 ON)
set(USE_NGHTTP2 ON)
set(USE_NGTCP2 OFF)
+set(USE_OPENSSL_QUIC OFF)
set(USE_QUICHE OFF)
set(USE_WIN32_IDN OFF)
set(USE_WIN32_LDAP OFF CACHE INTERNAL "No curl Windows LDAP")
@@ -475,18 +476,14 @@ if(0) # This code not needed for building within CMake.
find_package(Perl)
option(BUILD_LIBCURL_DOCS "to build libcurl man pages" ON)
-# curl source release tarballs come with the curl man page pre-built.
-option(ENABLE_CURL_MANUAL "to build the man page for curl and enable its -M/--manual option" OFF)
+option(ENABLE_CURL_MANUAL "to build the man page for curl and enable its -M/--manual option" ON)
if(ENABLE_CURL_MANUAL OR BUILD_LIBCURL_DOCS)
if(PERL_FOUND)
- curl_nroff_check()
- if(NROFF_USEFUL)
- set(HAVE_MANUAL_TOOLS ON)
- endif()
+ set(HAVE_MANUAL_TOOLS ON)
endif()
if(NOT HAVE_MANUAL_TOOLS)
- message(WARNING "Perl not found, or nroff not useful. Will not build manuals.")
+ message(WARNING "Perl not found. Will not build manuals.")
endif()
endif()
endif()
@@ -566,8 +563,7 @@ if(APPLE)
endif()
if(WIN32)
cmake_dependent_option(CURL_USE_SCHANNEL "Enable Windows native SSL/TLS" OFF CURL_ENABLE_SSL OFF)
- cmake_dependent_option(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without OpenSSL" ON
- CURL_USE_SCHANNEL OFF)
+ option(CURL_WINDOWS_SSPI "Enable SSPI on Windows" ${CURL_USE_SCHANNEL})
endif()
cmake_dependent_option(CURL_USE_MBEDTLS "Enable mbedTLS for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
cmake_dependent_option(CURL_USE_BEARSSL "Enable BearSSL for SSL/TLS" OFF CURL_ENABLE_SSL OFF)
@@ -901,7 +897,28 @@ if(USE_MSH3)
list(APPEND CURL_LIBS ${MSH3_LIBRARIES})
endif()
-if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3))
+option(USE_OPENSSL_QUIC "Use openssl and nghttp3 libraries for HTTP/3 support" OFF)
+if(USE_OPENSSL_QUIC)
+ if(USE_NGTCP2 OR USE_QUICHE OR USE_MSH3)
+ message(FATAL_ERROR "Only one HTTP/3 backend can be selected!")
+ endif()
+ find_package(OpenSSL 3.2.0 REQUIRED)
+
+ find_package(NGHTTP3 REQUIRED)
+ set(USE_NGHTTP3 ON)
+ include_directories(${NGHTTP3_INCLUDE_DIRS})
+ list(APPEND CURL_LIBS ${NGHTTP3_LIBRARIES})
+endif()
+
+if(0) # This code not needed for building within CMake.
+if(USE_MBEDTLS OR
+ USE_BEARSSL OR
+ USE_SECTRANSP)
+ message(WARNING "A selected TLS library does not support TLS 1.3.")
+endif()
+endif()
+
+if(CURL_WITH_MULTI_SSL AND (USE_NGTCP2 OR USE_QUICHE OR USE_MSH3 OR USE_OPENSSL_QUIC))
message(FATAL_ERROR "MultiSSL cannot be enabled with HTTP/3 and vice versa.")
endif()
@@ -1731,7 +1748,7 @@ if(NOT CURL_DISABLE_INSTALL)
NOT CURL_DISABLE_HTTP AND NTLM_WB_ENABLED)
_add_if("TLS-SRP" USE_TLS_SRP)
_add_if("HTTP2" USE_NGHTTP2)
- _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE)
+ _add_if("HTTP3" USE_NGTCP2 OR USE_QUICHE OR USE_OPENSSL_QUIC)
_add_if("MultiSSL" CURL_WITH_MULTI_SSL)
# TODO wolfSSL only support this from v5.0.0 onwards
_add_if("HTTPS-proxy" SSL_ENABLED AND (USE_OPENSSL OR USE_GNUTLS
@@ -1816,6 +1833,30 @@ if(NOT CURL_DISABLE_INSTALL)
set(LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(LIBCURL_LIBS "")
set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
+
+ # For processing full path libraries into -L and -l ld options,
+ # the directories that go with the -L option are cached, so they
+ # only get added once per such directory.
+ set(_libcurl_libs_dirs)
+ # To avoid getting unnecessary -L options for known system directories,
+ # _libcurl_libs_dirs is seeded with them.
+ foreach(_libdir ${CMAKE_SYSTEM_PREFIX_PATH})
+ if(_libdir MATCHES "/$")
+ set(_libdir "${_libdir}lib")
+ else()
+ set(_libdir "${_libdir}/lib")
+ endif()
+ if(IS_DIRECTORY "${_libdir}")
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ endif()
+ if(DEFINED CMAKE_LIBRARY_ARCHITECTURE)
+ set(_libdir "${_libdir}/${CMAKE_LIBRARY_ARCHITECTURE}")
+ if(IS_DIRECTORY "${_libdir}")
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ endif()
+ endif()
+ endforeach()
+
foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${CURL_LIBS})
if(TARGET "${_lib}")
set(_libname "${_lib}")
@@ -1831,8 +1872,24 @@ if(NOT CURL_DISABLE_INSTALL)
continue()
endif()
endif()
- if(_lib MATCHES ".*/.*" OR _lib MATCHES "^-")
+ if(_lib MATCHES "^-")
set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
+ elseif(_lib MATCHES ".*/.*")
+ # This gets a bit more complex, because we want to specify the
+ # directory separately, and only once per directory
+ string(REGEX REPLACE "^(.*)/[^/]*$" "\\1" _libdir "${_lib}")
+ string(REGEX REPLACE "^.*/([^/.]*).*$" "\\1" _libname "${_lib}")
+ if(_libname MATCHES "^lib")
+ list(FIND _libcurl_libs_dirs "${_libdir}" _libdir_index)
+ if(_libdir_index LESS 0)
+ list(APPEND _libcurl_libs_dirs "${_libdir}")
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} -L${_libdir}")
+ endif()
+ string(REGEX REPLACE "^lib" "" _libname "${_libname}")
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_libname}")
+ else()
+ set(LIBCURL_LIBS "${LIBCURL_LIBS} ${_lib}")
+ endif()
else()
set(LIBCURL_LIBS "${LIBCURL_LIBS} -l${_lib}")
endif()
diff --git a/Utilities/cmcurl/include/curl/curl.h b/Utilities/cmcurl/include/curl/curl.h
index 5b9bcc6..3c99bae 100644
--- a/Utilities/cmcurl/include/curl/curl.h
+++ b/Utilities/cmcurl/include/curl/curl.h
@@ -2938,7 +2938,8 @@ typedef enum {
CURLINFO_XFER_ID = CURLINFO_OFF_T + 63,
CURLINFO_CONN_ID = CURLINFO_OFF_T + 64,
CURLINFO_QUEUE_TIME_T = CURLINFO_OFF_T + 65,
- CURLINFO_LASTONE = 65
+ CURLINFO_USED_PROXY = CURLINFO_LONG + 66,
+ CURLINFO_LASTONE = 66
} CURLINFO;
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
diff --git a/Utilities/cmcurl/include/curl/curlver.h b/Utilities/cmcurl/include/curl/curlver.h
index 85008e1..7b742b7 100644
--- a/Utilities/cmcurl/include/curl/curlver.h
+++ b/Utilities/cmcurl/include/curl/curlver.h
@@ -32,13 +32,13 @@
/* This is the version number of the libcurl package from which this header
file origins: */
-#define LIBCURL_VERSION "8.6.0"
+#define LIBCURL_VERSION "8.7.1"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBCURL_VERSION_MAJOR 8
-#define LIBCURL_VERSION_MINOR 6
-#define LIBCURL_VERSION_PATCH 0
+#define LIBCURL_VERSION_MINOR 7
+#define LIBCURL_VERSION_PATCH 1
/* This is the numeric version of the libcurl version number, meant for easier
parsing and comparisons by programs. The LIBCURL_VERSION_NUM define will
@@ -59,7 +59,7 @@
CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
-#define LIBCURL_VERSION_NUM 0x080600
+#define LIBCURL_VERSION_NUM 0x080701
/*
* This is the date and time when the full source package was created. The
diff --git a/Utilities/cmcurl/lib/Makefile.inc b/Utilities/cmcurl/lib/Makefile.inc
index 627148a..400e2b1 100644
--- a/Utilities/cmcurl/lib/Makefile.inc
+++ b/Utilities/cmcurl/lib/Makefile.inc
@@ -134,9 +134,11 @@ LIB_CFILES = \
curl_range.c \
curl_rtmp.c \
curl_sasl.c \
+ curl_sha512_256.c \
curl_sspi.c \
curl_threads.c \
curl_trc.c \
+ cw-out.c \
dict.c \
doh.c \
dynbuf.c \
@@ -199,6 +201,7 @@ LIB_CFILES = \
psl.c \
rand.c \
rename.c \
+ request.c \
rtsp.c \
select.c \
sendf.c \
@@ -277,10 +280,12 @@ LIB_HFILES = \
curl_setup.h \
curl_setup_once.h \
curl_sha256.h \
+ curl_sha512_256.h \
curl_sspi.h \
curl_threads.h \
curl_trc.h \
curlx.h \
+ cw-out.h \
dict.h \
doh.h \
dynbuf.h \
@@ -333,6 +338,7 @@ LIB_HFILES = \
psl.h \
rand.h \
rename.h \
+ request.h \
rtsp.h \
select.h \
sendf.h \
diff --git a/Utilities/cmcurl/lib/altsvc.c b/Utilities/cmcurl/lib/altsvc.c
index e9f62bf..c12d7bd 100644
--- a/Utilities/cmcurl/lib/altsvc.c
+++ b/Utilities/cmcurl/lib/altsvc.c
@@ -209,7 +209,6 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, char *line)
static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
{
CURLcode result = CURLE_OK;
- char *line = NULL;
FILE *fp;
/* we need a private copy of the file name so that the altsvc cache file
@@ -221,11 +220,10 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
fp = fopen(file, FOPEN_READTEXT);
if(fp) {
- line = malloc(MAX_ALTSVC_LINE);
- if(!line)
- goto fail;
- while(Curl_get_line(line, MAX_ALTSVC_LINE, fp)) {
- char *lineptr = line;
+ struct dynbuf buf;
+ Curl_dyn_init(&buf, MAX_ALTSVC_LINE);
+ while(Curl_get_line(&buf, fp)) {
+ char *lineptr = Curl_dyn_ptr(&buf);
while(*lineptr && ISBLANK(*lineptr))
lineptr++;
if(*lineptr == '#')
@@ -234,16 +232,10 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
altsvc_add(asi, lineptr);
}
- free(line); /* free the line buffer */
+ Curl_dyn_free(&buf); /* free the line buffer */
fclose(fp);
}
return result;
-
-fail:
- Curl_safefree(asi->filename);
- free(line);
- fclose(fp);
- return CURLE_OUT_OF_MEMORY;
}
/*
diff --git a/Utilities/cmcurl/lib/asyn-ares.c b/Utilities/cmcurl/lib/asyn-ares.c
index 76efba7..3d718b3 100644
--- a/Utilities/cmcurl/lib/asyn-ares.c
+++ b/Utilities/cmcurl/lib/asyn-ares.c
@@ -122,6 +122,8 @@ struct thread_data {
#define CARES_TIMEOUT_PER_ATTEMPT 2000
+static int ares_ver = 0;
+
/*
* Curl_resolver_global_init() - the generic low-level asynchronous name
* resolve API. Called from curl_global_init() to initialize global resolver
@@ -134,6 +136,7 @@ int Curl_resolver_global_init(void)
return CURLE_FAILED_INIT;
}
#endif
+ ares_version(&ares_ver);
return CURLE_OK;
}
@@ -173,16 +176,8 @@ CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
int status;
struct ares_options options;
int optmask = ARES_OPT_SOCK_STATE_CB;
- static int ares_ver = 0;
options.sock_state_cb = sock_state_cb;
options.sock_state_cb_data = easy;
- if(ares_ver == 0)
- ares_version(&ares_ver);
-
- if(ares_ver < 0x011400) { /* c-ares included similar change since 1.20.0 */
- options.timeout = CARES_TIMEOUT_PER_ATTEMPT;
- optmask |= ARES_OPT_TIMEOUTMS;
- }
/*
if c ares < 1.20.0: curl set timeout to CARES_TIMEOUT_PER_ATTEMPT (2s)
@@ -193,6 +188,11 @@ CURLcode Curl_resolver_init(struct Curl_easy *easy, void **resolver)
if c-ares >= 1.24.0, user can set the timeout via /etc/resolv.conf to
overwrite c-ares' timeout.
*/
+ DEBUGASSERT(ares_ver);
+ if(ares_ver < 0x011400) {
+ options.timeout = CARES_TIMEOUT_PER_ATTEMPT;
+ optmask |= ARES_OPT_TIMEOUTMS;
+ }
status = ares_init_options((ares_channel*)resolver, &options, optmask);
if(status != ARES_SUCCESS) {
@@ -850,7 +850,7 @@ CURLcode Curl_set_dns_servers(struct Curl_easy *data,
/* If server is NULL or empty, this would purge all DNS servers
* from ares library, which will cause any and all queries to fail.
* So, just return OK if none are configured and don't actually make
- * any changes to c-ares. This lets c-ares use it's defaults, which
+ * any changes to c-ares. This lets c-ares use its defaults, which
* it gets from the OS (for instance from /etc/resolv.conf on Linux).
*/
if(!(servers && servers[0]))
diff --git a/Utilities/cmcurl/lib/asyn-thread.c b/Utilities/cmcurl/lib/asyn-thread.c
index d4d382a..5b9d504 100644
--- a/Utilities/cmcurl/lib/asyn-thread.c
+++ b/Utilities/cmcurl/lib/asyn-thread.c
@@ -581,7 +581,7 @@ static void destroy_async_data(struct Curl_async *async)
* before the FD is invalidated to avoid EBADF on EPOLL_CTL_DEL
*/
Curl_multi_closed(data, sock_rd);
- sclose(sock_rd);
+ wakeup_close(sock_rd);
#endif
}
async->tdata = NULL;
diff --git a/Utilities/cmcurl/lib/bufq.c b/Utilities/cmcurl/lib/bufq.c
index d03906d..c324551 100644
--- a/Utilities/cmcurl/lib/bufq.c
+++ b/Utilities/cmcurl/lib/bufq.c
@@ -396,7 +396,7 @@ ssize_t Curl_bufq_write(struct bufq *q,
while(len) {
tail = get_non_full_tail(q);
if(!tail) {
- if(q->chunk_count < q->max_chunks) {
+ if((q->chunk_count < q->max_chunks) || (q->opts & BUFQ_OPT_SOFT_LIMIT)) {
*err = CURLE_OUT_OF_MEMORY;
return -1;
}
@@ -417,6 +417,17 @@ ssize_t Curl_bufq_write(struct bufq *q,
return nwritten;
}
+CURLcode Curl_bufq_cwrite(struct bufq *q,
+ const char *buf, size_t len,
+ size_t *pnwritten)
+{
+ ssize_t n;
+ CURLcode result;
+ n = Curl_bufq_write(q, (const unsigned char *)buf, len, &result);
+ *pnwritten = (n < 0)? 0 : (size_t)n;
+ return result;
+}
+
ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
CURLcode *err)
{
@@ -440,6 +451,16 @@ ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
return nread;
}
+CURLcode Curl_bufq_cread(struct bufq *q, char *buf, size_t len,
+ size_t *pnread)
+{
+ ssize_t n;
+ CURLcode result;
+ n = Curl_bufq_read(q, (unsigned char *)buf, len, &result);
+ *pnread = (n < 0)? 0 : (size_t)n;
+ return result;
+}
+
bool Curl_bufq_peek(struct bufq *q,
const unsigned char **pbuf, size_t *plen)
{
diff --git a/Utilities/cmcurl/lib/bufq.h b/Utilities/cmcurl/lib/bufq.h
index 089d61b..027a2b6 100644
--- a/Utilities/cmcurl/lib/bufq.h
+++ b/Utilities/cmcurl/lib/bufq.h
@@ -178,6 +178,10 @@ ssize_t Curl_bufq_write(struct bufq *q,
const unsigned char *buf, size_t len,
CURLcode *err);
+CURLcode Curl_bufq_cwrite(struct bufq *q,
+ const char *buf, size_t len,
+ size_t *pnwritten);
+
/**
* Read buf from the start of the buffer queue. The buf is copied
* and the amount of copied bytes is returned.
@@ -187,6 +191,9 @@ ssize_t Curl_bufq_write(struct bufq *q,
ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len,
CURLcode *err);
+CURLcode Curl_bufq_cread(struct bufq *q, char *buf, size_t len,
+ size_t *pnread);
+
/**
* Peek at the head chunk in the buffer queue. Returns a pointer to
* the chunk buf (at the current offset) and its length. Does not
diff --git a/Utilities/cmcurl/lib/c-hyper.c b/Utilities/cmcurl/lib/c-hyper.c
index d02ecd7..247d59f 100644
--- a/Utilities/cmcurl/lib/c-hyper.c
+++ b/Utilities/cmcurl/lib/c-hyper.c
@@ -53,7 +53,9 @@
#include <hyper.h>
#include "urldata.h"
+#include "cfilters.h"
#include "sendf.h"
+#include "headers.h"
#include "transfer.h"
#include "multiif.h"
#include "progress.h"
@@ -65,6 +67,9 @@
#include "curl_memory.h"
#include "memdebug.h"
+
+static CURLcode cr_hyper_add(struct Curl_easy *data);
+
typedef enum {
USERDATA_NOT_SET = 0, /* for tasks with no userdata set; must be zero */
USERDATA_RESP_BODY
@@ -73,7 +78,8 @@ typedef enum {
size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
uint8_t *buf, size_t buflen)
{
- struct Curl_easy *data = userp;
+ struct hyp_io_ctx *io_ctx = userp;
+ struct Curl_easy *data = io_ctx->data;
struct connectdata *conn = data->conn;
CURLcode result;
ssize_t nread;
@@ -81,7 +87,8 @@ size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
(void)ctx;
DEBUGF(infof(data, "Curl_hyper_recv(%zu)", buflen));
- result = Curl_read(data, conn->sockfd, (char *)buf, buflen, &nread);
+ result = Curl_conn_recv(data, io_ctx->sockindex,
+ (char *)buf, buflen, &nread);
if(result == CURLE_AGAIN) {
/* would block, register interest */
DEBUGF(infof(data, "Curl_hyper_recv(%zu) -> EAGAIN", buflen));
@@ -105,15 +112,14 @@ size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
size_t Curl_hyper_send(void *userp, hyper_context *ctx,
const uint8_t *buf, size_t buflen)
{
- struct Curl_easy *data = userp;
- struct connectdata *conn = data->conn;
+ struct hyp_io_ctx *io_ctx = userp;
+ struct Curl_easy *data = io_ctx->data;
CURLcode result;
- ssize_t nwrote;
+ size_t nwrote;
DEBUGF(infof(data, "Curl_hyper_send(%zu)", buflen));
- result = Curl_write(data, conn->sockfd, (void *)buf, buflen, &nwrote);
- if(!result && !nwrote)
- result = CURLE_AGAIN;
+ result = Curl_conn_send(data, io_ctx->sockindex,
+ (void *)buf, buflen, &nwrote);
if(result == CURLE_AGAIN) {
DEBUGF(infof(data, "Curl_hyper_send(%zu) -> EAGAIN", buflen));
/* would block, register interest */
@@ -152,9 +158,6 @@ static int hyper_each_header(void *userdata,
return HYPER_ITER_BREAK;
}
- if(!data->req.bytecount)
- Curl_pgrsTime(data, TIMER_STARTTRANSFER);
-
Curl_dyn_reset(&data->state.headerb);
if(name_len) {
if(Curl_dyn_addf(&data->state.headerb, "%.*s: %.*s\r\n",
@@ -168,7 +171,7 @@ static int hyper_each_header(void *userdata,
len = Curl_dyn_len(&data->state.headerb);
headp = Curl_dyn_ptr(&data->state.headerb);
- result = Curl_http_header(data, data->conn, headp);
+ result = Curl_http_header(data, data->conn, headp, len);
if(result) {
data->state.hresult = result;
return HYPER_ITER_BREAK;
@@ -204,7 +207,6 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
CURLcode result = CURLE_OK;
if(0 == k->bodywrites) {
- bool done = FALSE;
#if defined(USE_NTLM)
struct connectdata *conn = data->conn;
if(conn->bits.close &&
@@ -217,27 +219,26 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
Curl_safefree(data->req.newurl);
}
#endif
- if(data->state.expect100header) {
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
+ if(Curl_http_exp100_is_selected(data)) {
if(data->req.httpcode < 400) {
- k->exp100 = EXP100_SEND_DATA;
- if(data->hyp.exp100_waker) {
- hyper_waker_wake(data->hyp.exp100_waker);
- data->hyp.exp100_waker = NULL;
+ Curl_http_exp100_got100(data);
+ if(data->hyp.send_body_waker) {
+ hyper_waker_wake(data->hyp.send_body_waker);
+ data->hyp.send_body_waker = NULL;
}
}
else { /* >= 4xx */
- k->exp100 = EXP100_FAILED;
+ Curl_req_abort_sending(data);
}
}
if(data->state.hconnect && (data->req.httpcode/100 != 2) &&
data->state.authproxy.done) {
- done = TRUE;
+ data->req.done = TRUE;
result = CURLE_OK;
}
else
- result = Curl_http_firstwrite(data, data->conn, &done);
- if(result || done) {
+ result = Curl_http_firstwrite(data);
+ if(result || data->req.done) {
infof(data, "Return early from hyper_body_chunk");
data->state.hresult = result;
return HYPER_ITER_BREAK;
@@ -273,14 +274,13 @@ static CURLcode status_line(struct Curl_easy *data,
/* We need to set 'httpcodeq' for functions that check the response code in
a single place. */
data->req.httpcode = http_status;
-
+ data->req.httpversion = http_version == HYPER_HTTP_VERSION_1_1? 11 :
+ (http_version == HYPER_HTTP_VERSION_2 ? 20 : 10);
if(data->state.hconnect)
/* CONNECT */
data->info.httpproxycode = http_status;
else {
- conn->httpversion =
- http_version == HYPER_HTTP_VERSION_1_1 ? 11 :
- (http_version == HYPER_HTTP_VERSION_2 ? 20 : 10);
+ conn->httpversion = (unsigned char)data->req.httpversion;
if(http_version == HYPER_HTTP_VERSION_1_0)
data->state.httpwant = CURL_HTTP_VERSION_1_0;
@@ -335,7 +335,6 @@ static CURLcode empty_header(struct Curl_easy *data)
CURLcode Curl_hyper_stream(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
- bool *done,
int select_res)
{
hyper_response *resp = NULL;
@@ -352,20 +351,9 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
struct SingleRequest *k = &data->req;
(void)conn;
- if(k->exp100 > EXP100_SEND_DATA) {
- struct curltime now = Curl_now();
- timediff_t ms = Curl_timediff(now, k->start100);
- if(ms >= data->set.expect_100_timeout) {
- /* we've waited long enough, continue anyway */
- k->exp100 = EXP100_SEND_DATA;
- k->keepon |= KEEP_SEND;
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
- infof(data, "Done waiting for 100-continue");
- if(data->hyp.exp100_waker) {
- hyper_waker_wake(data->hyp.exp100_waker);
- data->hyp.exp100_waker = NULL;
- }
- }
+ if(data->hyp.send_body_waker) {
+ hyper_waker_wake(data->hyp.send_body_waker);
+ data->hyp.send_body_waker = NULL;
}
if(select_res & CURL_CSELECT_IN) {
@@ -379,7 +367,6 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
h->write_waker = NULL;
}
- *done = FALSE;
do {
hyper_task_return_type t;
task = hyper_executor_poll(h->exec);
@@ -422,7 +409,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
break;
}
}
- *done = TRUE;
+ data->req.done = TRUE;
hyper_error_free(hypererr);
break;
}
@@ -431,12 +418,11 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
hyper_task_free(task);
if((userdata_t)userdata == USERDATA_RESP_BODY) {
/* end of transfer */
- *done = TRUE;
+ data->req.done = TRUE;
infof(data, "hyperstream is done");
if(!k->bodywrites) {
/* hyper doesn't always call the body write callback */
- bool stilldone;
- result = Curl_http_firstwrite(data, data->conn, &stilldone);
+ result = Curl_http_firstwrite(data);
}
break;
}
@@ -462,11 +448,11 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
reasonp = hyper_response_reason_phrase(resp);
reason_len = hyper_response_reason_phrase_len(resp);
- if(http_status == 417 && data->state.expect100header) {
+ if(http_status == 417 && Curl_http_exp100_is_selected(data)) {
infof(data, "Got 417 while waiting for a 100");
data->state.disableexpect = TRUE;
data->req.newurl = strdup(data->state.url);
- Curl_done_sending(data, k);
+ Curl_req_abort_sending(data);
}
result = status_line(data, conn,
@@ -654,115 +640,66 @@ static CURLcode request_target(struct Curl_easy *data,
return result;
}
-static int uploadpostfields(void *userdata, hyper_context *ctx,
- hyper_buf **chunk)
-{
- struct Curl_easy *data = (struct Curl_easy *)userdata;
- (void)ctx;
- if(data->req.exp100 > EXP100_SEND_DATA) {
- if(data->req.exp100 == EXP100_FAILED)
- return HYPER_POLL_ERROR;
-
- /* still waiting confirmation */
- if(data->hyp.exp100_waker)
- hyper_waker_free(data->hyp.exp100_waker);
- data->hyp.exp100_waker = hyper_context_waker(ctx);
- return HYPER_POLL_PENDING;
- }
- if(data->req.upload_done)
- *chunk = NULL; /* nothing more to deliver */
- else {
- /* send everything off in a single go */
- hyper_buf *copy = hyper_buf_copy(data->set.postfields,
- (size_t)data->req.p.http->postsize);
- if(copy)
- *chunk = copy;
- else {
- data->state.hresult = CURLE_OUT_OF_MEMORY;
- return HYPER_POLL_ERROR;
- }
- /* increasing the writebytecount here is a little premature but we
- don't know exactly when the body is sent */
- data->req.writebytecount += (size_t)data->req.p.http->postsize;
- Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
- data->req.upload_done = TRUE;
- }
- return HYPER_POLL_READY;
-}
-
static int uploadstreamed(void *userdata, hyper_context *ctx,
hyper_buf **chunk)
{
size_t fillcount;
struct Curl_easy *data = (struct Curl_easy *)userdata;
- struct connectdata *conn = (struct connectdata *)data->conn;
CURLcode result;
+ char *xfer_ulbuf;
+ size_t xfer_ulblen;
+ bool eos;
+ int rc = HYPER_POLL_ERROR;
(void)ctx;
- if(data->req.exp100 > EXP100_SEND_DATA) {
- if(data->req.exp100 == EXP100_FAILED)
- return HYPER_POLL_ERROR;
+ result = Curl_multi_xfer_ulbuf_borrow(data, &xfer_ulbuf, &xfer_ulblen);
+ if(result)
+ goto out;
- /* still waiting confirmation */
- if(data->hyp.exp100_waker)
- hyper_waker_free(data->hyp.exp100_waker);
- data->hyp.exp100_waker = hyper_context_waker(ctx);
- return HYPER_POLL_PENDING;
- }
+ result = Curl_client_read(data, xfer_ulbuf, xfer_ulblen, &fillcount, &eos);
+ if(result)
+ goto out;
- if(data->req.upload_chunky && conn->bits.authneg) {
- fillcount = 0;
- data->req.upload_chunky = FALSE;
- result = CURLE_OK;
- }
- else {
- result = Curl_fillreadbuffer(data, data->set.upload_buffer_size,
- &fillcount);
- }
- if(result) {
- data->state.hresult = result;
- return HYPER_POLL_ERROR;
- }
- if(!fillcount) {
- if((data->req.keepon & KEEP_SEND_PAUSE) != KEEP_SEND_PAUSE)
- /* done! */
- *chunk = NULL;
- else {
- /* paused, save a waker */
- if(data->hyp.send_body_waker)
- hyper_waker_free(data->hyp.send_body_waker);
- data->hyp.send_body_waker = hyper_context_waker(ctx);
- return HYPER_POLL_PENDING;
- }
- }
- else {
- hyper_buf *copy = hyper_buf_copy((uint8_t *)data->state.ulbuf, fillcount);
+ if(fillcount) {
+ hyper_buf *copy = hyper_buf_copy((uint8_t *)xfer_ulbuf, fillcount);
if(copy)
*chunk = copy;
else {
- data->state.hresult = CURLE_OUT_OF_MEMORY;
- return HYPER_POLL_ERROR;
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
}
/* increasing the writebytecount here is a little premature but we
don't know exactly when the body is sent */
data->req.writebytecount += fillcount;
Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
+ rc = HYPER_POLL_READY;
+ }
+ else if(eos) {
+ *chunk = NULL;
+ rc = HYPER_POLL_READY;
}
- return HYPER_POLL_READY;
+ else {
+ /* paused, save a waker */
+ if(data->hyp.send_body_waker)
+ hyper_waker_free(data->hyp.send_body_waker);
+ data->hyp.send_body_waker = hyper_context_waker(ctx);
+ rc = HYPER_POLL_PENDING;
+ }
+
+out:
+ Curl_multi_xfer_ulbuf_release(data, xfer_ulbuf);
+ data->state.hresult = result;
+ return rc;
}
/*
- * bodysend() sets up headers in the outgoing request for an HTTP transfer that
- * sends a body
+ * finalize_request() sets up last headers and optional body settings
*/
-
-static CURLcode bodysend(struct Curl_easy *data,
- struct connectdata *conn,
- hyper_headers *headers,
- hyper_request *hyperreq,
- Curl_HttpReq httpreq)
+static CURLcode finalize_request(struct Curl_easy *data,
+ hyper_headers *headers,
+ hyper_request *hyperreq,
+ Curl_HttpReq httpreq)
{
- struct HTTP *http = data->req.p.http;
CURLcode result = CURLE_OK;
struct dynbuf req;
if((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD))
@@ -770,34 +707,31 @@ static CURLcode bodysend(struct Curl_easy *data,
else {
hyper_body *body;
Curl_dyn_init(&req, DYN_HTTP_REQUEST);
- result = Curl_http_bodysend(data, conn, &req, httpreq);
+ result = Curl_http_req_complete(data, &req, httpreq);
+ if(result)
+ return result;
- if(!result)
+ /* if the "complete" above did produce more than the closing line,
+ parse the added headers */
+ if(Curl_dyn_len(&req) != 2 || strcmp(Curl_dyn_ptr(&req), "\r\n")) {
result = Curl_hyper_header(data, headers, Curl_dyn_ptr(&req));
+ if(result)
+ return result;
+ }
Curl_dyn_free(&req);
body = hyper_body_new();
hyper_body_set_userdata(body, data);
- if(data->set.postfields)
- hyper_body_set_data_func(body, uploadpostfields);
- else {
- result = Curl_get_upload_buffer(data);
- if(result) {
- hyper_body_free(body);
- return result;
- }
- /* init the "upload from here" pointer */
- data->req.upload_fromhere = data->state.ulbuf;
- hyper_body_set_data_func(body, uploadstreamed);
- }
+ hyper_body_set_data_func(body, uploadstreamed);
+
if(HYPERE_OK != hyper_request_set_body(hyperreq, body)) {
/* fail */
result = CURLE_OUT_OF_MEMORY;
}
}
- http->sending = HTTPSEND_BODY;
- return result;
+
+ return cr_hyper_add(data);
}
static CURLcode cookies(struct Curl_easy *data,
@@ -885,7 +819,16 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
may be parts of the request that is not yet sent, since we can deal with
the rest of the request in the PERFORM phase. */
*done = TRUE;
- Curl_client_cleanup(data);
+ result = Curl_client_start(data);
+ if(result)
+ return result;
+
+ /* Add collecting of headers written to client. For a new connection,
+ * we might have done that already, but reuse
+ * or multiplex needs it here as well. */
+ result = Curl_headers_init(data);
+ if(result)
+ return result;
infof(data, "Time for the Hyper dance");
memset(h, 0, sizeof(struct hyptransfer));
@@ -913,9 +856,9 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
return result;
}
- result = Curl_http_resume(data, conn, httpreq);
+ result = Curl_http_req_set_reader(data, httpreq, &te);
if(result)
- return result;
+ goto error;
result = Curl_http_range(data, httpreq);
if(result)
@@ -932,7 +875,9 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto error;
}
/* tell Hyper how to read/write network data */
- hyper_io_set_userdata(io, data);
+ h->io_ctx.data = data;
+ h->io_ctx.sockindex = FIRSTSOCKET;
+ hyper_io_set_userdata(io, &h->io_ctx);
hyper_io_set_read(io, Curl_hyper_recv);
hyper_io_set_write(io, Curl_hyper_send);
@@ -1005,11 +950,6 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto error;
}
}
- else {
- if(!data->state.disableexpect) {
- data->state.expect100header = TRUE;
- }
- }
if(hyper_request_set_method(req, (uint8_t *)method, strlen(method))) {
failf(data, "error setting method");
@@ -1034,10 +974,6 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto error;
}
- result = Curl_http_body(data, conn, httpreq, &te);
- if(result)
- goto error;
-
if(data->state.aptr.host) {
result = Curl_hyper_header(data, headers, data->state.aptr.host);
if(result)
@@ -1160,13 +1096,13 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(result)
goto error;
- result = bodysend(data, conn, headers, req, httpreq);
+ result = finalize_request(data, headers, req, httpreq);
if(result)
goto error;
Curl_debug(data, CURLINFO_HEADER_OUT, (char *)"\r\n", 2);
- if(data->req.upload_chunky && conn->bits.authneg) {
+ if(data->req.upload_chunky && data->req.authneg) {
data->req.upload_chunky = TRUE;
}
else {
@@ -1193,13 +1129,10 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) {
/* HTTP GET/HEAD download */
Curl_pgrsSetUploadSize(data, 0); /* nothing */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
}
+
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, TRUE, FIRSTSOCKET);
conn->datastream = Curl_hyper_stream;
- if(data->state.expect100header)
- /* Timeout count starts now since with Hyper we don't know exactly when
- the full request has been sent. */
- data->req.start100 = Curl_now();
/* clear userpwd and proxyuserpwd to avoid reusing old credentials
* from reused connections */
@@ -1241,10 +1174,51 @@ void Curl_hyper_done(struct Curl_easy *data)
hyper_waker_free(h->write_waker);
h->write_waker = NULL;
}
- if(h->exp100_waker) {
- hyper_waker_free(h->exp100_waker);
- h->exp100_waker = NULL;
+ if(h->send_body_waker) {
+ hyper_waker_free(h->send_body_waker);
+ h->send_body_waker = NULL;
+ }
+}
+
+static CURLcode cr_hyper_unpause(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)reader;
+ if(data->hyp.send_body_waker) {
+ hyper_waker_wake(data->hyp.send_body_waker);
+ data->hyp.send_body_waker = NULL;
}
+ return CURLE_OK;
+}
+
+/* Hyper client reader, handling unpausing */
+static const struct Curl_crtype cr_hyper_protocol = {
+ "cr-hyper",
+ Curl_creader_def_init,
+ Curl_creader_def_read,
+ Curl_creader_def_close,
+ Curl_creader_def_needs_rewind,
+ Curl_creader_def_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ cr_hyper_unpause,
+ Curl_creader_def_done,
+ sizeof(struct Curl_creader)
+};
+
+static CURLcode cr_hyper_add(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result;
+
+ result = Curl_creader_create(&reader, data, &cr_hyper_protocol,
+ CURL_CR_PROTOCOL);
+ if(!result)
+ result = Curl_creader_add(data, reader);
+
+ if(result && reader)
+ Curl_creader_free(data, reader);
+ return result;
}
#endif /* !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER) */
diff --git a/Utilities/cmcurl/lib/c-hyper.h b/Utilities/cmcurl/lib/c-hyper.h
index 0c7de90..89dd53b 100644
--- a/Utilities/cmcurl/lib/c-hyper.h
+++ b/Utilities/cmcurl/lib/c-hyper.h
@@ -29,13 +29,18 @@
#include <hyper.h>
+struct hyp_io_ctx {
+ struct Curl_easy *data;
+ int sockindex;
+};
+
/* per-transfer data for the Hyper backend */
struct hyptransfer {
hyper_waker *write_waker;
hyper_waker *read_waker;
const hyper_executor *exec;
- hyper_waker *exp100_waker;
hyper_waker *send_body_waker;
+ struct hyp_io_ctx io_ctx;
};
size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
@@ -45,7 +50,6 @@ size_t Curl_hyper_send(void *userp, hyper_context *ctx,
CURLcode Curl_hyper_stream(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
- bool *done,
int select_res);
CURLcode Curl_hyper_header(struct Curl_easy *data, hyper_headers *headers,
diff --git a/Utilities/cmcurl/lib/cf-h1-proxy.c b/Utilities/cmcurl/lib/cf-h1-proxy.c
index 167e531..ed6322c 100644
--- a/Utilities/cmcurl/lib/cf-h1-proxy.c
+++ b/Utilities/cmcurl/lib/cf-h1-proxy.c
@@ -114,18 +114,12 @@ static CURLcode tunnel_init(struct Curl_cfilter *cf,
struct h1_tunnel_state **pts)
{
struct h1_tunnel_state *ts;
- CURLcode result;
if(cf->conn->handler->flags & PROTOPT_NOTCPPROXY) {
failf(data, "%s cannot be done over CONNECT", cf->conn->handler->scheme);
return CURLE_UNSUPPORTED_PROTOCOL;
}
- /* we might need the upload buffer for streaming a partial request */
- result = Curl_get_upload_buffer(data);
- if(result)
- return result;
-
ts = calloc(1, sizeof(*ts));
if(!ts)
return CURLE_OUT_OF_MEMORY;
@@ -212,6 +206,11 @@ static void tunnel_free(struct Curl_cfilter *cf,
}
}
+static bool tunnel_want_send(struct h1_tunnel_state *ts)
+{
+ return (ts->tunnel_state == H1_TUNNEL_CONNECT);
+}
+
#ifndef USE_HYPER
static CURLcode start_CONNECT(struct Curl_cfilter *cf,
struct Curl_easy *data,
@@ -238,6 +237,8 @@ static CURLcode start_CONNECT(struct Curl_cfilter *cf,
http_minor = (cf->conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? 0 : 1;
result = Curl_h1_req_write_head(req, http_minor, &ts->request_data);
+ if(!result)
+ result = Curl_creader_set_null(data);
out:
if(result)
@@ -366,7 +367,6 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
{
CURLcode result = CURLE_OK;
struct SingleRequest *k = &data->req;
- curl_socket_t tunnelsocket = Curl_conn_cf_get_socket(cf, data);
char *linep;
size_t line_len;
int error, writetype;
@@ -386,7 +386,7 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
/* Read one byte at a time to avoid a race condition. Wait at most one
second before looping to ensure continuous pgrsUpdates. */
- result = Curl_read(data, tunnelsocket, &byte, 1, &nread);
+ result = Curl_conn_recv(data, cf->sockindex, &byte, 1, &nread);
if(result == CURLE_AGAIN)
/* socket buffer drained, return */
return CURLE_OK;
@@ -593,7 +593,9 @@ static CURLcode start_CONNECT(struct Curl_cfilter *cf,
goto error;
}
/* tell Hyper how to read/write network data */
- hyper_io_set_userdata(io, data);
+ h->io_ctx.data = data;
+ h->io_ctx.sockindex = cf->sockindex;
+ hyper_io_set_userdata(io, &h->io_ctx);
hyper_io_set_read(io, Curl_hyper_recv);
hyper_io_set_write(io, Curl_hyper_send);
conn->sockfd = tunnelsocket;
@@ -749,6 +751,10 @@ static CURLcode start_CONNECT(struct Curl_cfilter *cf,
if(result)
goto error;
+ result = Curl_creader_set_null(data);
+ if(result)
+ goto error;
+
sendtask = hyper_clientconn_send(client, req);
if(!sendtask) {
failf(data, "hyper_clientconn_send");
@@ -832,9 +838,9 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
int didwhat;
(void)ts;
- *done = FALSE;
- result = Curl_hyper_stream(data, cf->conn, &didwhat, done,
+ result = Curl_hyper_stream(data, cf->conn, &didwhat,
CURL_CSELECT_IN | CURL_CSELECT_OUT);
+ *done = data->req.done;
if(result || !*done)
return result;
if(h->exec) {
@@ -918,6 +924,7 @@ static CURLcode H1_CONNECT(struct Curl_cfilter *cf,
* If the other side indicated a connection close, or if someone
* else told us to close this connection, do so now.
*/
+ Curl_req_soft_reset(&data->req, data);
if(ts->close_connection || conn->bits.close) {
/* Close this filter and the sub-chain, re-connect the
* sub-chain and continue. Closing this filter will
@@ -1003,11 +1010,9 @@ out:
*done = (result == CURLE_OK) && tunnel_is_established(cf->ctx);
if(*done) {
cf->connected = TRUE;
- /* Restore `data->req` fields that may habe been touched */
- data->req.header = TRUE; /* assume header */
- data->req.bytecount = 0;
- data->req.ignorebody = FALSE;
- Curl_client_cleanup(data);
+ /* The real request will follow the CONNECT, reset request partially */
+ Curl_req_soft_reset(&data->req, data);
+ Curl_client_reset(data);
Curl_pgrsSetUploadCounter(data, 0);
Curl_pgrsSetDownloadCounter(data, 0);
@@ -1031,7 +1036,7 @@ static void cf_h1_proxy_adjust_pollset(struct Curl_cfilter *cf,
wait for the socket to become readable to be able to get the
response headers or if we're still sending the request, wait
for write. */
- if(ts->CONNECT.sending == HTTPSEND_REQUEST)
+ if(tunnel_want_send(ts))
Curl_pollset_set_out_only(data, ps, sock);
else
Curl_pollset_set_in_only(data, ps, sock);
diff --git a/Utilities/cmcurl/lib/cf-h2-proxy.c b/Utilities/cmcurl/lib/cf-h2-proxy.c
index f8f2f3c..78dc222 100644
--- a/Utilities/cmcurl/lib/cf-h2-proxy.c
+++ b/Utilities/cmcurl/lib/cf-h2-proxy.c
@@ -38,6 +38,7 @@
#include "http2.h"
#include "http_proxy.h"
#include "multiif.h"
+#include "sendf.h"
#include "cf-h2-proxy.h"
/* The last 3 #include files should be in this order */
@@ -956,6 +957,9 @@ static CURLcode submit_CONNECT(struct Curl_cfilter *cf,
result = Curl_http_proxy_create_CONNECT(&req, cf, data, 2);
if(result)
goto out;
+ result = Curl_creader_set_null(data);
+ if(result)
+ goto out;
infof(data, "Establish HTTP/2 proxy tunnel to %s", req->authority);
@@ -1125,7 +1129,12 @@ static CURLcode cf_h2_proxy_connect(struct Curl_cfilter *cf,
out:
*done = (result == CURLE_OK) && (ts->state == H2_TUNNEL_ESTABLISHED);
- cf->connected = *done;
+ if(*done) {
+ cf->connected = TRUE;
+ /* The real request will follow the CONNECT, reset request partially */
+ Curl_req_soft_reset(&data->req, data);
+ Curl_client_reset(data);
+ }
CF_DATA_RESTORE(cf, save);
return result;
}
diff --git a/Utilities/cmcurl/lib/cf-haproxy.c b/Utilities/cmcurl/lib/cf-haproxy.c
index c062887..4043922 100644
--- a/Utilities/cmcurl/lib/cf-haproxy.c
+++ b/Utilities/cmcurl/lib/cf-haproxy.c
@@ -86,14 +86,14 @@ static CURLcode cf_haproxy_date_out_set(struct Curl_cfilter*cf,
if(data->set.str[STRING_HAPROXY_CLIENT_IP])
client_ip = data->set.str[STRING_HAPROXY_CLIENT_IP];
else
- client_ip = data->info.conn_local_ip;
+ client_ip = data->info.primary.local_ip;
result = Curl_dyn_addf(&ctx->data_out, "PROXY %s %s %s %i %i\r\n",
tcp_version,
client_ip,
- data->info.conn_primary_ip,
- data->info.conn_local_port,
- data->info.conn_primary_port);
+ data->info.primary.remote_ip,
+ data->info.primary.local_port,
+ data->info.primary.remote_port);
#ifdef USE_UNIX_SOCKETS
}
@@ -129,12 +129,17 @@ static CURLcode cf_haproxy_connect(struct Curl_cfilter *cf,
case HAPROXY_SEND:
len = Curl_dyn_len(&ctx->data_out);
if(len > 0) {
- ssize_t written = Curl_conn_send(data, cf->sockindex,
- Curl_dyn_ptr(&ctx->data_out),
- len, &result);
- if(written < 0)
+ size_t written;
+ result = Curl_conn_send(data, cf->sockindex,
+ Curl_dyn_ptr(&ctx->data_out),
+ len, &written);
+ if(result == CURLE_AGAIN) {
+ result = CURLE_OK;
+ written = 0;
+ }
+ else if(result)
goto out;
- Curl_dyn_tail(&ctx->data_out, len - (size_t)written);
+ Curl_dyn_tail(&ctx->data_out, len - written);
if(Curl_dyn_len(&ctx->data_out) > 0) {
result = CURLE_OK;
goto out;
diff --git a/Utilities/cmcurl/lib/cf-socket.c b/Utilities/cmcurl/lib/cf-socket.c
index 742902f..1de5100 100644
--- a/Utilities/cmcurl/lib/cf-socket.c
+++ b/Utilities/cmcurl/lib/cf-socket.c
@@ -776,10 +776,7 @@ struct cf_socket_ctx {
struct Curl_sockaddr_ex addr; /* address to connect to */
curl_socket_t sock; /* current attempt socket */
struct bufq recvbuf; /* used when `buffer_recv` is set */
- char r_ip[MAX_IPADR_LEN]; /* remote IP as string */
- int r_port; /* remote port number */
- char l_ip[MAX_IPADR_LEN]; /* local IP as string */
- int l_port; /* local port number */
+ struct ip_quadruple ip; /* The IP quadruple 2x(addr+port) */
struct curltime started_at; /* when socket was created */
struct curltime connected_at; /* when socket connected/got first byte */
struct curltime first_byte_at; /* when first byte was recvd */
@@ -880,8 +877,9 @@ static ssize_t nw_in_read(void *reader_ctx,
nread = -1;
}
}
- CURL_TRC_CF(rctx->data, rctx->cf, "nw_in_read(len=%zu) -> %d, err=%d",
- len, (int)nread, *err);
+ CURL_TRC_CF(rctx->data, rctx->cf, "nw_in_read(len=%zu, fd=%"
+ CURL_FORMAT_SOCKET_T ") -> %d, err=%d",
+ len, ctx->sock, (int)nread, *err);
return nread;
}
@@ -940,7 +938,7 @@ static CURLcode set_local_ip(struct Curl_cfilter *cf,
return CURLE_FAILED_INIT;
}
if(!Curl_addr2string((struct sockaddr*)&ssloc, slen,
- ctx->l_ip, &ctx->l_port)) {
+ ctx->ip.local_ip, &ctx->ip.local_port)) {
failf(data, "ssloc inet_ntop() failed with errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
return CURLE_FAILED_INIT;
@@ -961,7 +959,7 @@ static CURLcode set_remote_ip(struct Curl_cfilter *cf,
/* store remote address and port used in this connection attempt */
if(!Curl_addr2string(&ctx->addr.sa_addr, ctx->addr.addrlen,
- ctx->r_ip, &ctx->r_port)) {
+ ctx->ip.remote_ip, &ctx->ip.remote_port)) {
char buffer[STRERROR_LEN];
ctx->error = errno;
@@ -996,11 +994,11 @@ static CURLcode cf_socket_open(struct Curl_cfilter *cf,
#ifdef ENABLE_IPV6
if(ctx->addr.family == AF_INET6) {
set_ipv6_v6only(ctx->sock, 0);
- infof(data, " Trying [%s]:%d...", ctx->r_ip, ctx->r_port);
+ infof(data, " Trying [%s]:%d...", ctx->ip.remote_ip, ctx->ip.remote_port);
}
else
#endif
- infof(data, " Trying %s:%d...", ctx->r_ip, ctx->r_port);
+ infof(data, " Trying %s:%d...", ctx->ip.remote_ip, ctx->ip.remote_port);
#ifdef ENABLE_IPV6
is_tcp = (ctx->addr.family == AF_INET
@@ -1166,9 +1164,9 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf,
error = SOCKERRNO;
set_local_ip(cf, data);
CURL_TRC_CF(data, cf, "local address %s port %d...",
- ctx->l_ip, ctx->l_port);
+ ctx->ip.local_ip, ctx->ip.local_port);
if(-1 == rc) {
- result = socket_connect_result(data, ctx->r_ip, error);
+ result = socket_connect_result(data, ctx->ip.remote_ip, error);
goto out;
}
}
@@ -1213,7 +1211,8 @@ out:
{
char buffer[STRERROR_LEN];
infof(data, "connect to %s port %u from %s port %d failed: %s",
- ctx->r_ip, ctx->r_port, ctx->l_ip, ctx->l_port,
+ ctx->ip.remote_ip, ctx->ip.remote_port,
+ ctx->ip.local_ip, ctx->ip.local_port,
Curl_strerror(ctx->error, buffer, sizeof(buffer)));
}
#endif
@@ -1233,10 +1232,11 @@ static void cf_socket_get_host(struct Curl_cfilter *cf,
const char **pdisplay_host,
int *pport)
{
+ struct cf_socket_ctx *ctx = cf->ctx;
(void)data;
*phost = cf->conn->host.name;
*pdisplay_host = cf->conn->host.dispname;
- *pport = cf->conn->port;
+ *pport = ctx->ip.remote_port;
}
static void cf_socket_adjust_pollset(struct Curl_cfilter *cf,
@@ -1248,11 +1248,13 @@ static void cf_socket_adjust_pollset(struct Curl_cfilter *cf,
if(ctx->sock != CURL_SOCKET_BAD) {
if(!cf->connected) {
Curl_pollset_set_out_only(data, ps, ctx->sock);
- CURL_TRC_CF(data, cf, "adjust_pollset(!connected) -> %d socks", ps->num);
+ CURL_TRC_CF(data, cf, "adjust_pollset, !connected, POLLOUT fd=%"
+ CURL_FORMAT_SOCKET_T, ctx->sock);
}
else if(!ctx->active) {
Curl_pollset_add_in(data, ps, ctx->sock);
- CURL_TRC_CF(data, cf, "adjust_pollset(!active) -> %d socks", ps->num);
+ CURL_TRC_CF(data, cf, "adjust_pollset, !active, POLLIN fd=%"
+ CURL_FORMAT_SOCKET_T, ctx->sock);
}
}
}
@@ -1433,31 +1435,24 @@ out:
return nread;
}
-static void conn_set_primary_ip(struct Curl_cfilter *cf,
- struct Curl_easy *data)
-{
- struct cf_socket_ctx *ctx = cf->ctx;
-
- (void)data;
- DEBUGASSERT(sizeof(ctx->r_ip) == sizeof(cf->conn->primary_ip));
- memcpy(cf->conn->primary_ip, ctx->r_ip, sizeof(cf->conn->primary_ip));
-}
-
static void cf_socket_active(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct cf_socket_ctx *ctx = cf->ctx;
/* use this socket from now on */
cf->conn->sock[cf->sockindex] = ctx->sock;
- /* the first socket info gets set at conn and data */
+ set_local_ip(cf, data);
+ if(cf->sockindex == SECONDARYSOCKET)
+ cf->conn->secondary = ctx->ip;
+ else
+ cf->conn->primary = ctx->ip;
+ /* the first socket info gets some specials */
if(cf->sockindex == FIRSTSOCKET) {
cf->conn->remote_addr = &ctx->addr;
#ifdef ENABLE_IPV6
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
#endif
- conn_set_primary_ip(cf, data);
- set_local_ip(cf, data);
- Curl_persistconninfo(data, cf->conn, ctx->l_ip, ctx->l_port);
+ Curl_persistconninfo(data, cf->conn, &ctx->ip);
/* buffering is currently disabled by default because we have stalls
* in parallel transfers where not all buffered data is consumed and no
* socket events happen.
@@ -1480,7 +1475,7 @@ static CURLcode cf_socket_cntrl(struct Curl_cfilter *cf,
cf_socket_active(cf, data);
break;
case CF_CTRL_DATA_SETUP:
- Curl_persistconninfo(data, cf->conn, ctx->l_ip, ctx->l_port);
+ Curl_persistconninfo(data, cf->conn, &ctx->ip);
break;
case CF_CTRL_FORGET_SOCKET:
ctx->sock = CURL_SOCKET_BAD;
@@ -1637,7 +1632,7 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
#else
rc = connect(ctx->sock, &ctx->addr.sa_addr, ctx->addr.addrlen);
if(-1 == rc) {
- return socket_connect_result(data, ctx->r_ip, SOCKERRNO);
+ return socket_connect_result(data, ctx->ip.remote_ip, SOCKERRNO);
}
ctx->sock_connected = TRUE;
#endif
@@ -1645,7 +1640,8 @@ static CURLcode cf_udp_setup_quic(struct Curl_cfilter *cf,
CURL_TRC_CF(data, cf, "%s socket %" CURL_FORMAT_SOCKET_T
" connected: [%s:%d] -> [%s:%d]",
(ctx->transport == TRNSPRT_QUIC)? "QUIC" : "UDP",
- ctx->sock, ctx->l_ip, ctx->l_port, ctx->r_ip, ctx->r_port);
+ ctx->sock, ctx->ip.local_ip, ctx->ip.local_port,
+ ctx->ip.remote_ip, ctx->ip.remote_port);
(void)curlx_nonblock(ctx->sock, TRUE);
switch(ctx->addr.family) {
@@ -1695,7 +1691,7 @@ static CURLcode cf_udp_connect(struct Curl_cfilter *cf,
goto out;
CURL_TRC_CF(data, cf, "cf_udp_connect(), opened socket=%"
CURL_FORMAT_SOCKET_T " (%s:%d)",
- ctx->sock, ctx->l_ip, ctx->l_port);
+ ctx->sock, ctx->ip.local_ip, ctx->ip.local_port);
}
else {
CURL_TRC_CF(data, cf, "cf_udp_connect(), opened socket=%"
@@ -1891,8 +1887,8 @@ static void set_accepted_remote_ip(struct Curl_cfilter *cf,
struct Curl_sockaddr_storage ssrem;
curl_socklen_t plen;
- ctx->r_ip[0] = 0;
- ctx->r_port = 0;
+ ctx->ip.remote_ip[0] = 0;
+ ctx->ip.remote_port = 0;
plen = sizeof(ssrem);
memset(&ssrem, 0, plen);
if(getpeername(ctx->sock, (struct sockaddr*) &ssrem, &plen)) {
@@ -1902,14 +1898,14 @@ static void set_accepted_remote_ip(struct Curl_cfilter *cf,
return;
}
if(!Curl_addr2string((struct sockaddr*)&ssrem, plen,
- ctx->r_ip, &ctx->r_port)) {
+ ctx->ip.remote_ip, &ctx->ip.remote_port)) {
failf(data, "ssrem inet_ntop() failed with errno %d: %s",
errno, Curl_strerror(errno, buffer, sizeof(buffer)));
return;
}
#else
- ctx->r_ip[0] = 0;
- ctx->r_port = 0;
+ ctx->ip.remote_ip[0] = 0;
+ ctx->ip.remote_port = 0;
(void)data;
#endif
}
@@ -1938,7 +1934,7 @@ CURLcode Curl_conn_tcp_accepted_set(struct Curl_easy *data,
cf->connected = TRUE;
CURL_TRC_CF(data, cf, "accepted_set(sock=%" CURL_FORMAT_SOCKET_T
", remote=%s port=%d)",
- ctx->sock, ctx->r_ip, ctx->r_port);
+ ctx->sock, ctx->ip.remote_ip, ctx->ip.remote_port);
return CURLE_OK;
}
@@ -1958,9 +1954,9 @@ CURLcode Curl_cf_socket_peek(struct Curl_cfilter *cf,
struct Curl_easy *data,
curl_socket_t *psock,
const struct Curl_sockaddr_ex **paddr,
- const char **pr_ip_str, int *pr_port,
- const char **pl_ip_str, int *pl_port)
+ struct ip_quadruple *pip)
{
+ (void)data;
if(cf_is_socket(cf) && cf->ctx) {
struct cf_socket_ctx *ctx = cf->ctx;
@@ -1968,17 +1964,8 @@ CURLcode Curl_cf_socket_peek(struct Curl_cfilter *cf,
*psock = ctx->sock;
if(paddr)
*paddr = &ctx->addr;
- if(pr_ip_str)
- *pr_ip_str = ctx->r_ip;
- if(pr_port)
- *pr_port = ctx->r_port;
- if(pl_port ||pl_ip_str) {
- set_local_ip(cf, data);
- if(pl_ip_str)
- *pl_ip_str = ctx->l_ip;
- if(pl_port)
- *pl_port = ctx->l_port;
- }
+ if(pip)
+ *pip = ctx->ip;
return CURLE_OK;
}
return CURLE_FAILED_INIT;
diff --git a/Utilities/cmcurl/lib/cf-socket.h b/Utilities/cmcurl/lib/cf-socket.h
index 87e0f30..058af50 100644
--- a/Utilities/cmcurl/lib/cf-socket.h
+++ b/Utilities/cmcurl/lib/cf-socket.h
@@ -33,6 +33,7 @@ struct Curl_cfilter;
struct Curl_easy;
struct connectdata;
struct Curl_sockaddr_ex;
+struct ip_quadruple;
/*
* The Curl_sockaddr_ex structure is basically libcurl's external API
@@ -153,18 +154,14 @@ CURLcode Curl_conn_tcp_accepted_set(struct Curl_easy *data,
* The filter owns all returned values.
* @param psock pointer to hold socket descriptor or NULL
* @param paddr pointer to hold addr reference or NULL
- * @param pr_ip_str pointer to hold remote addr as string or NULL
- * @param pr_port pointer to hold remote port number or NULL
- * @param pl_ip_str pointer to hold local addr as string or NULL
- * @param pl_port pointer to hold local port number or NULL
+ * @param pip pointer to get IP quadruple or NULL
* Returns error if the filter is of invalid type.
*/
CURLcode Curl_cf_socket_peek(struct Curl_cfilter *cf,
struct Curl_easy *data,
curl_socket_t *psock,
const struct Curl_sockaddr_ex **paddr,
- const char **pr_ip_str, int *pr_port,
- const char **pl_ip_str, int *pl_port);
+ struct ip_quadruple *pip);
extern struct Curl_cftype Curl_cft_tcp;
extern struct Curl_cftype Curl_cft_udp;
diff --git a/Utilities/cmcurl/lib/cfilters.c b/Utilities/cmcurl/lib/cfilters.c
index 823e90c..32329cf 100644
--- a/Utilities/cmcurl/lib/cfilters.c
+++ b/Utilities/cmcurl/lib/cfilters.c
@@ -67,7 +67,7 @@ void Curl_cf_def_get_host(struct Curl_cfilter *cf, struct Curl_easy *data,
else {
*phost = cf->conn->host.name;
*pdisplay_host = cf->conn->host.dispname;
- *pport = cf->conn->port;
+ *pport = cf->conn->primary.remote_port;
}
}
@@ -168,38 +168,46 @@ void Curl_conn_close(struct Curl_easy *data, int index)
}
}
-ssize_t Curl_conn_recv(struct Curl_easy *data, int num, char *buf,
- size_t len, CURLcode *code)
+ssize_t Curl_cf_recv(struct Curl_easy *data, int num, char *buf,
+ size_t len, CURLcode *code)
{
struct Curl_cfilter *cf;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
+ *code = CURLE_OK;
cf = data->conn->cfilter[num];
while(cf && !cf->connected) {
cf = cf->next;
}
if(cf) {
- return cf->cft->do_recv(cf, data, buf, len, code);
+ ssize_t nread = cf->cft->do_recv(cf, data, buf, len, code);
+ DEBUGASSERT(nread >= 0 || *code);
+ DEBUGASSERT(nread < 0 || !*code);
+ return nread;
}
failf(data, "recv: no filter connected");
*code = CURLE_FAILED_INIT;
return -1;
}
-ssize_t Curl_conn_send(struct Curl_easy *data, int num,
- const void *mem, size_t len, CURLcode *code)
+ssize_t Curl_cf_send(struct Curl_easy *data, int num,
+ const void *mem, size_t len, CURLcode *code)
{
struct Curl_cfilter *cf;
DEBUGASSERT(data);
DEBUGASSERT(data->conn);
+ *code = CURLE_OK;
cf = data->conn->cfilter[num];
while(cf && !cf->connected) {
cf = cf->next;
}
if(cf) {
- return cf->cft->do_send(cf, data, mem, len, code);
+ ssize_t nwritten = cf->cft->do_send(cf, data, mem, len, code);
+ DEBUGASSERT(nwritten >= 0 || *code);
+ DEBUGASSERT(nwritten < 0 || !*code || !len);
+ return nwritten;
}
failf(data, "send: no filter connected");
DEBUGASSERT(0);
@@ -662,6 +670,58 @@ size_t Curl_conn_get_max_concurrent(struct Curl_easy *data,
return (result || n <= 0)? 1 : (size_t)n;
}
+int Curl_conn_sockindex(struct Curl_easy *data, curl_socket_t sockfd)
+{
+ if(data && data->conn &&
+ sockfd != CURL_SOCKET_BAD && sockfd == data->conn->sock[SECONDARYSOCKET])
+ return SECONDARYSOCKET;
+ return FIRSTSOCKET;
+}
+
+CURLcode Curl_conn_recv(struct Curl_easy *data, int sockindex,
+ char *buf, size_t blen, ssize_t *n)
+{
+ CURLcode result = CURLE_OK;
+ ssize_t nread;
+
+ DEBUGASSERT(data->conn);
+ nread = data->conn->recv[sockindex](data, sockindex, buf, blen, &result);
+ DEBUGASSERT(nread >= 0 || result);
+ DEBUGASSERT(nread < 0 || !result);
+ *n = (nread >= 0)? (size_t)nread : 0;
+ return result;
+}
+
+CURLcode Curl_conn_send(struct Curl_easy *data, int sockindex,
+ const void *buf, size_t blen,
+ size_t *pnwritten)
+{
+ ssize_t nwritten;
+ CURLcode result = CURLE_OK;
+ struct connectdata *conn;
+
+ DEBUGASSERT(sockindex >= 0 && sockindex < 2);
+ DEBUGASSERT(pnwritten);
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->conn);
+ conn = data->conn;
+#ifdef CURLDEBUG
+ {
+ /* Allow debug builds to override this logic to force short sends
+ */
+ char *p = getenv("CURL_SMALLSENDS");
+ if(p) {
+ size_t altsize = (size_t)strtoul(p, NULL, 10);
+ if(altsize)
+ blen = CURLMIN(blen, altsize);
+ }
+ }
+#endif
+ nwritten = conn->send[sockindex](data, sockindex, buf, blen, &result);
+ DEBUGASSERT((nwritten >= 0) || result);
+ *pnwritten = (nwritten < 0)? 0 : (size_t)nwritten;
+ return result;
+}
void Curl_pollset_reset(struct Curl_easy *data,
struct easy_pollset *ps)
diff --git a/Utilities/cmcurl/lib/cfilters.h b/Utilities/cmcurl/lib/cfilters.h
index f838429..c90b1f4 100644
--- a/Utilities/cmcurl/lib/cfilters.h
+++ b/Utilities/cmcurl/lib/cfilters.h
@@ -402,11 +402,11 @@ void Curl_conn_adjust_pollset(struct Curl_easy *data,
/**
* Receive data through the filter chain at `sockindex` for connection
* `data->conn`. Copy at most `len` bytes into `buf`. Return the
- * actuel number of bytes copied or a negative value on error.
+ * actual number of bytes copied or a negative value on error.
* The error code is placed into `*code`.
*/
-ssize_t Curl_conn_recv(struct Curl_easy *data, int sockindex, char *buf,
- size_t len, CURLcode *code);
+ssize_t Curl_cf_recv(struct Curl_easy *data, int sockindex, char *buf,
+ size_t len, CURLcode *code);
/**
* Send `len` bytes of data from `buf` through the filter chain `sockindex`
@@ -414,8 +414,8 @@ ssize_t Curl_conn_recv(struct Curl_easy *data, int sockindex, char *buf,
* or a negative value on error.
* The error code is placed into `*code`.
*/
-ssize_t Curl_conn_send(struct Curl_easy *data, int sockindex,
- const void *buf, size_t len, CURLcode *code);
+ssize_t Curl_cf_send(struct Curl_easy *data, int sockindex,
+ const void *buf, size_t len, CURLcode *code);
/**
* The easy handle `data` is being attached to `conn`. This does
@@ -497,6 +497,30 @@ size_t Curl_conn_get_max_concurrent(struct Curl_easy *data,
int sockindex);
+/**
+ * Get the index of the given socket in the connection's sockets.
+ * Useful in calling `Curl_conn_send()/Curl_conn_recv()` with the
+ * correct socket index.
+ */
+int Curl_conn_sockindex(struct Curl_easy *data, curl_socket_t sockfd);
+
+/*
+ * Receive data on the connection, using FIRSTSOCKET/SECONDARYSOCKET.
+ * Will return CURLE_AGAIN iff blocked on receiving.
+ */
+CURLcode Curl_conn_recv(struct Curl_easy *data, int sockindex,
+ char *buf, size_t buffersize,
+ ssize_t *pnread);
+
+/*
+ * Send data on the connection, using FIRSTSOCKET/SECONDARYSOCKET.
+ * Will return CURLE_AGAIN iff blocked on sending.
+ */
+CURLcode Curl_conn_send(struct Curl_easy *data, int sockindex,
+ const void *buf, size_t blen,
+ size_t *pnwritten);
+
+
void Curl_pollset_reset(struct Curl_easy *data,
struct easy_pollset *ps);
diff --git a/Utilities/cmcurl/lib/conncache.c b/Utilities/cmcurl/lib/conncache.c
index 66f18ec..0d26090 100644
--- a/Utilities/cmcurl/lib/conncache.c
+++ b/Utilities/cmcurl/lib/conncache.c
@@ -131,7 +131,7 @@ static void hashkey(struct connectdata *conn, char *buf, size_t len)
#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
hostname = conn->http_proxy.host.name;
- port = conn->port;
+ port = conn->primary.remote_port;
}
else
#endif
@@ -395,8 +395,6 @@ bool Curl_conncache_return_conn(struct Curl_easy *data,
important that details from this (unrelated) disconnect does not
taint meta-data in the data handle. */
struct conncache *connc = data->state.conn_cache;
- connc->closure_handle->state.buffer = data->state.buffer;
- connc->closure_handle->set.buffer_size = data->set.buffer_size;
Curl_disconnect(connc->closure_handle, conn_candidate,
/* dead_connection */ FALSE);
}
@@ -522,12 +520,9 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
void Curl_conncache_close_all_connections(struct conncache *connc)
{
struct connectdata *conn;
- char buffer[READBUFFER_MIN + 1];
SIGPIPE_VARIABLE(pipe_st);
if(!connc->closure_handle)
return;
- connc->closure_handle->state.buffer = buffer;
- connc->closure_handle->set.buffer_size = READBUFFER_MIN;
conn = conncache_find_first_connection(connc);
while(conn) {
@@ -541,7 +536,6 @@ void Curl_conncache_close_all_connections(struct conncache *connc)
conn = conncache_find_first_connection(connc);
}
- connc->closure_handle->state.buffer = NULL;
sigpipe_ignore(connc->closure_handle, &pipe_st);
Curl_hostcache_clean(connc->closure_handle,
diff --git a/Utilities/cmcurl/lib/connect.c b/Utilities/cmcurl/lib/connect.c
index 45743e9..e457006 100644
--- a/Utilities/cmcurl/lib/connect.c
+++ b/Utilities/cmcurl/lib/connect.c
@@ -94,7 +94,7 @@
* infinite time left). If the value is negative, the timeout time has already
* elapsed.
* @param data the transfer to check on
- * @param nowp timestamp to use for calculdation, NULL to use Curl_now()
+ * @param nowp timestamp to use for calculation, NULL to use Curl_now()
* @param duringconnect TRUE iff connect timeout is also taken into account.
* @unittest: 1303
*/
@@ -145,19 +145,26 @@ timediff_t Curl_timeleft(struct Curl_easy *data,
/* Copies connection info into the transfer handle to make it available when
the transfer handle is no longer associated with the connection. */
void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
- char *local_ip, int local_port)
+ struct ip_quadruple *ip)
{
- memcpy(data->info.conn_primary_ip, conn->primary_ip, MAX_IPADR_LEN);
- if(local_ip && local_ip[0])
- memcpy(data->info.conn_local_ip, local_ip, MAX_IPADR_LEN);
- else
- data->info.conn_local_ip[0] = 0;
+ if(ip)
+ data->info.primary = *ip;
+ else {
+ memset(&data->info.primary, 0, sizeof(data->info.primary));
+ data->info.primary.remote_port = -1;
+ data->info.primary.local_port = -1;
+ }
data->info.conn_scheme = conn->handler->scheme;
/* conn_protocol can only provide "old" protocols */
data->info.conn_protocol = (conn->handler->protocol) & CURLPROTO_MASK;
- data->info.conn_primary_port = conn->port;
data->info.conn_remote_port = conn->remote_port;
- data->info.conn_local_port = local_port;
+ data->info.used_proxy =
+#ifdef CURL_DISABLE_PROXY
+ 0
+#else
+ conn->bits.proxy
+#endif
+ ;
}
static const struct Curl_addrinfo *
@@ -721,7 +728,7 @@ evaluate:
failf(data, "Failed to connect to %s port %u after "
"%" CURL_FORMAT_TIMEDIFF_T " ms: %s",
- hostname, conn->port,
+ hostname, conn->primary.remote_port,
Curl_timediff(now, data->progress.t_startsingle),
curl_easy_strerror(result));
@@ -911,7 +918,7 @@ static CURLcode cf_he_connect(struct Curl_cfilter *cf,
if(cf->conn->handler->protocol & PROTO_FAMILY_SSH)
Curl_pgrsTime(data, TIMER_APPCONNECT); /* we're connected already */
- Curl_verboseconnect(data, cf->conn);
+ Curl_verboseconnect(data, cf->conn, cf->sockindex);
data->info.numconnects++; /* to track the # of connections made */
}
break;
diff --git a/Utilities/cmcurl/lib/connect.h b/Utilities/cmcurl/lib/connect.h
index 58264bd..00efe6f 100644
--- a/Utilities/cmcurl/lib/connect.h
+++ b/Utilities/cmcurl/lib/connect.h
@@ -30,6 +30,7 @@
#include "timeval.h"
struct Curl_dns_entry;
+struct ip_quadruple;
/* generic function that returns how much time there's left to run, according
to the timeouts set */
@@ -52,7 +53,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
char *addr, int *port);
void Curl_persistconninfo(struct Curl_easy *data, struct connectdata *conn,
- char *local_ip, int local_port);
+ struct ip_quadruple *ip);
/*
* Curl_conncontrol() marks the end of a connection/stream. The 'closeit'
diff --git a/Utilities/cmcurl/lib/cookie.c b/Utilities/cmcurl/lib/cookie.c
index dc319b6..c1ed291 100644
--- a/Utilities/cmcurl/lib/cookie.c
+++ b/Utilities/cmcurl/lib/cookie.c
@@ -426,6 +426,7 @@ static void remove_expired(struct CookieInfo *cookies)
}
}
+#ifndef USE_LIBPSL
/* Make sure domain contains a dot or is localhost. */
static bool bad_domain(const char *domain, size_t len)
{
@@ -443,6 +444,7 @@ static bool bad_domain(const char *domain, size_t len)
}
return TRUE;
}
+#endif
/*
RFC 6265 section 4.1.1 says a server should accept this range:
@@ -1040,7 +1042,7 @@ Curl_cookie_add(struct Curl_easy *data,
Curl_psl_release(data);
}
else
- acceptable = !bad_domain(domain, strlen(domain));
+ infof(data, "libpsl problem, rejecting cookie for satety");
}
if(!acceptable) {
@@ -1205,7 +1207,6 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
bool newsession)
{
struct CookieInfo *c;
- char *line = NULL;
FILE *handle = NULL;
if(!inc) {
@@ -1241,16 +1242,14 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
c->running = FALSE; /* this is not running, this is init */
if(fp) {
-
- line = malloc(MAX_COOKIE_LINE);
- if(!line)
- goto fail;
- while(Curl_get_line(line, MAX_COOKIE_LINE, fp)) {
- char *lineptr = line;
+ struct dynbuf buf;
+ Curl_dyn_init(&buf, MAX_COOKIE_LINE);
+ while(Curl_get_line(&buf, fp)) {
+ char *lineptr = Curl_dyn_ptr(&buf);
bool headerline = FALSE;
- if(checkprefix("Set-Cookie:", line)) {
+ if(checkprefix("Set-Cookie:", lineptr)) {
/* This is a cookie line, get it! */
- lineptr = &line[11];
+ lineptr += 11;
headerline = TRUE;
while(*lineptr && ISBLANK(*lineptr))
lineptr++;
@@ -1258,7 +1257,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
Curl_cookie_add(data, c, headerline, TRUE, lineptr, NULL, NULL, TRUE);
}
- free(line); /* free the line buffer */
+ Curl_dyn_free(&buf); /* free the line buffer */
/*
* Remove expired cookies from the hash. We must make sure to run this
@@ -1274,18 +1273,6 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
c->running = TRUE; /* now, we're running */
return c;
-
-fail:
- free(line);
- /*
- * Only clean up if we allocated it here, as the original could still be in
- * use by a share handle.
- */
- if(!inc)
- Curl_cookie_cleanup(c);
- if(handle)
- fclose(handle);
- return NULL; /* out of memory */
}
/*
diff --git a/Utilities/cmcurl/lib/curl_config.h.cmake b/Utilities/cmcurl/lib/curl_config.h.cmake
index 98b787f..1ce57e2 100644
--- a/Utilities/cmcurl/lib/curl_config.h.cmake
+++ b/Utilities/cmcurl/lib/curl_config.h.cmake
@@ -729,6 +729,9 @@ ${SIZEOF_TIME_T_CODE}
/* to enable quiche */
#cmakedefine USE_QUICHE 1
+/* to enable openssl + nghttp3 */
+#cmakedefine USE_OPENSSL_QUIC 1
+
/* Define to 1 if you have the quiche_conn_set_qlog_fd function. */
#cmakedefine HAVE_QUICHE_CONN_SET_QLOG_FD 1
diff --git a/Utilities/cmcurl/lib/curl_des.c b/Utilities/cmcurl/lib/curl_des.c
index b77763f..f8d2b2c 100644
--- a/Utilities/cmcurl/lib/curl_des.c
+++ b/Utilities/cmcurl/lib/curl_des.c
@@ -36,7 +36,7 @@
* Curl_des_set_odd_parity()
*
* This is used to apply odd parity to the given byte array. It is typically
- * used by when a cryptography engines doesn't have it's own version.
+ * used by when a cryptography engine doesn't have its own version.
*
* The function is a port of the Java based oddParity() function over at:
*
diff --git a/Utilities/cmcurl/lib/curl_get_line.c b/Utilities/cmcurl/lib/curl_get_line.c
index 686abe7..1002073 100644
--- a/Utilities/cmcurl/lib/curl_get_line.c
+++ b/Utilities/cmcurl/lib/curl_get_line.c
@@ -33,14 +33,16 @@
#include "memdebug.h"
/*
- * Curl_get_line() makes sure to only return complete whole lines that fit in
- * 'len' bytes and end with a newline.
+ * Curl_get_line() makes sure to only return complete whole lines that end
+ * newlines.
*/
-char *Curl_get_line(char *buf, int len, FILE *input)
+int Curl_get_line(struct dynbuf *buf, FILE *input)
{
- bool partial = FALSE;
+ CURLcode result;
+ char buffer[128];
+ Curl_dyn_reset(buf);
while(1) {
- char *b = fgets(buf, len, input);
+ char *b = fgets(buffer, sizeof(buffer), input);
if(b) {
size_t rlen = strlen(b);
@@ -48,39 +50,28 @@ char *Curl_get_line(char *buf, int len, FILE *input)
if(!rlen)
break;
- if(b[rlen-1] == '\n') {
- /* b is \n terminated */
- if(partial) {
- partial = FALSE;
- continue;
- }
- return b;
- }
- else if(feof(input)) {
- if(partial)
- /* Line is already too large to return, ignore rest */
- break;
+ result = Curl_dyn_addn(buf, b, rlen);
+ if(result)
+ /* too long line or out of memory */
+ return 0; /* error */
- if(rlen + 1 < (size_t) len) {
- /* b is EOF terminated, insert missing \n */
- b[rlen] = '\n';
- b[rlen + 1] = '\0';
- return b;
- }
- else
- /* Maximum buffersize reached + EOF
- * This line is impossible to add a \n to so we'll ignore it
- */
- break;
+ else if(b[rlen-1] == '\n')
+ /* end of the line */
+ return 1; /* all good */
+
+ else if(feof(input)) {
+ /* append a newline */
+ result = Curl_dyn_addn(buf, "\n", 1);
+ if(result)
+ /* too long line or out of memory */
+ return 0; /* error */
+ return 1; /* all good */
}
- else
- /* Maximum buffersize reached */
- partial = TRUE;
}
else
break;
}
- return NULL;
+ return 0;
}
#endif /* if not disabled */
diff --git a/Utilities/cmcurl/lib/curl_get_line.h b/Utilities/cmcurl/lib/curl_get_line.h
index 0ff32c5..7907cde 100644
--- a/Utilities/cmcurl/lib/curl_get_line.h
+++ b/Utilities/cmcurl/lib/curl_get_line.h
@@ -24,8 +24,9 @@
*
***************************************************************************/
-/* get_line() makes sure to only return complete whole lines that fit in 'len'
- * bytes and end with a newline. */
-char *Curl_get_line(char *buf, int len, FILE *input);
+#include "dynbuf.h"
+
+/* Curl_get_line() returns complete lines that end with a newline. */
+int Curl_get_line(struct dynbuf *buf, FILE *input);
#endif /* HEADER_CURL_GET_LINE_H */
diff --git a/Utilities/cmcurl/lib/curl_ntlm_wb.c b/Utilities/cmcurl/lib/curl_ntlm_wb.c
index 0c7892a..acb0093 100644
--- a/Utilities/cmcurl/lib/curl_ntlm_wb.c
+++ b/Utilities/cmcurl/lib/curl_ntlm_wb.c
@@ -266,7 +266,7 @@ static CURLcode ntlm_wb_response(struct Curl_easy *data, struct ntlmdata *ntlm,
size_t len_in = strlen(input), len_out = 0;
struct dynbuf b;
char *ptr = NULL;
- usigned char buf[1024]
+ unsigned char buf[1024];
Curl_dyn_init(&b, MAX_NTLM_WB_RESPONSE);
while(len_in > 0) {
diff --git a/Utilities/cmcurl/lib/curl_rtmp.c b/Utilities/cmcurl/lib/curl_rtmp.c
index 147b12a..b2f2ada 100644
--- a/Utilities/cmcurl/lib/curl_rtmp.c
+++ b/Utilities/cmcurl/lib/curl_rtmp.c
@@ -265,10 +265,10 @@ static CURLcode rtmp_do(struct Curl_easy *data, bool *done)
if(data->state.upload) {
Curl_pgrsSetUploadSize(data, data->state.infilesize);
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
}
else
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
*done = TRUE;
return CURLE_OK;
}
diff --git a/Utilities/cmcurl/lib/curl_setup.h b/Utilities/cmcurl/lib/curl_setup.h
index f856f07..fd74478 100644
--- a/Utilities/cmcurl/lib/curl_setup.h
+++ b/Utilities/cmcurl/lib/curl_setup.h
@@ -270,6 +270,13 @@
#include <curl/system.h>
+/* Helper macro to expand and concatenate two macros.
+ * Direct macros concatenation does not work because macros
+ * are not expanded before direct concatenation.
+ */
+#define CURL_CONC_MACROS_(A,B) A ## B
+#define CURL_CONC_MACROS(A,B) CURL_CONC_MACROS_(A,B)
+
/* curl uses its own printf() function internally. It understands the GNU
* format. Use this format, so that is matches the GNU format attribute we
* use with the mingw compiler, allowing it to verify them at compile-time.
@@ -510,6 +517,17 @@
#endif
#define CURL_OFF_T_MIN (-CURL_OFF_T_MAX - CURL_OFF_T_C(1))
+#if (SIZEOF_CURL_OFF_T != 8)
+# error "curl_off_t must be exactly 64 bits"
+#else
+ typedef unsigned CURL_TYPEOF_CURL_OFF_T curl_uint64_t;
+# ifndef CURL_SUFFIX_CURL_OFF_TU
+# error "CURL_SUFFIX_CURL_OFF_TU must be defined"
+# endif
+# define CURL_UINT64_SUFFIX CURL_SUFFIX_CURL_OFF_TU
+# define CURL_UINT64_C(val) CURL_CONC_MACROS(val,CURL_UINT64_SUFFIX)
+#endif
+
#if (SIZEOF_TIME_T == 4)
# ifdef HAVE_TIME_T_UNSIGNED
# define TIME_T_MAX UINT_MAX
diff --git a/Utilities/cmcurl/lib/curl_sha512_256.c b/Utilities/cmcurl/lib/curl_sha512_256.c
new file mode 100644
index 0000000..8af3839
--- /dev/null
+++ b/Utilities/cmcurl/lib/curl_sha512_256.c
@@ -0,0 +1,844 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Evgeny Grin (Karlson2k), <k2k@narod.ru>.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#if !defined(CURL_DISABLE_DIGEST_AUTH) && !defined(CURL_DISABLE_SHA512_256)
+
+#include "curl_sha512_256.h"
+#include "warnless.h"
+
+/* The recommended order of the TLS backends:
+ * * OpenSSL
+ * * GnuTLS
+ * * wolfSSL
+ * * Schannel SSPI
+ * * SecureTransport (Darwin)
+ * * mbedTLS
+ * * BearSSL
+ * * rustls
+ * Skip the backend if it does not support the required algorithm */
+
+#if defined(USE_OPENSSL)
+# include <openssl/opensslv.h>
+# if (!defined(LIBRESSL_VERSION_NUMBER) && \
+ defined(OPENSSL_VERSION_NUMBER) && \
+ (OPENSSL_VERSION_NUMBER >= 0x10100010L)) || \
+ (defined(LIBRESSL_VERSION_NUMBER) && \
+ (LIBRESSL_VERSION_NUMBER >= 0x3080000fL))
+# include <openssl/opensslconf.h>
+# if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA512)
+# include <openssl/evp.h>
+# define USE_OPENSSL_SHA512_256 1
+# define HAS_SHA512_256_IMPLEMENTATION 1
+# endif
+# endif
+#endif /* USE_OPENSSL */
+
+
+#if !defined(HAS_SHA512_256_IMPLEMENTATION) && defined(USE_GNUTLS)
+# include <nettle/sha.h>
+# if defined(SHA512_256_DIGEST_SIZE)
+# define USE_GNUTLS_SHA512_256 1
+# define HAS_SHA512_256_IMPLEMENTATION 1
+# endif
+#endif /* ! HAS_SHA512_256_IMPLEMENTATION && USE_GNUTLS */
+
+#if defined(USE_OPENSSL_SHA512_256)
+
+/* OpenSSL does not provide macros for SHA-512/256 sizes */
+
+/**
+ * Size of the SHA-512/256 single processing block in bytes.
+ */
+#define SHA512_256_BLOCK_SIZE 128
+
+/**
+ * Size of the SHA-512/256 resulting digest in bytes.
+ * This is the final digest size, not intermediate hash.
+ */
+#define SHA512_256_DIGEST_SIZE SHA512_256_DIGEST_LENGTH
+
+/**
+ * Context type used for SHA-512/256 calculations
+ */
+typedef EVP_MD_CTX *Curl_sha512_256_ctx;
+
+/**
+ * Initialise structure for SHA-512/256 calculation.
+ *
+ * @param context the calculation context
+ * @return CURLE_OK if succeed,
+ * error code otherwise
+ */
+static CURLcode
+Curl_sha512_256_init(void *context)
+{
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+ *ctx = EVP_MD_CTX_create();
+ if(!*ctx)
+ return CURLE_OUT_OF_MEMORY;
+
+ if(EVP_DigestInit_ex(*ctx, EVP_sha512_256(), NULL)) {
+ /* Check whether the header and this file use the same numbers */
+ DEBUGASSERT(EVP_MD_CTX_size(*ctx) == SHA512_256_DIGEST_SIZE);
+ /* Check whether the block size is correct */
+ DEBUGASSERT(EVP_MD_CTX_block_size(*ctx) == SHA512_256_BLOCK_SIZE);
+
+ return CURLE_OK; /* Success */
+ }
+
+ /* Cleanup */
+ EVP_MD_CTX_destroy(*ctx);
+ return CURLE_FAILED_INIT;
+}
+
+
+/**
+ * Process portion of bytes.
+ *
+ * @param context the calculation context
+ * @param data bytes to add to hash
+ * @return CURLE_OK if succeed,
+ * error code otherwise
+ */
+static CURLcode
+Curl_sha512_256_update(void *context,
+ const unsigned char *data,
+ size_t length)
+{
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+ if(!EVP_DigestUpdate(*ctx, data, length))
+ return CURLE_SSL_CIPHER;
+
+ return CURLE_OK;
+}
+
+
+/**
+ * Finalise SHA-512/256 calculation, return digest.
+ *
+ * @param context the calculation context
+ * @param[out] digest set to the hash, must be #SHA512_256_DIGEST_SIZE bytes
+ * @return CURLE_OK if succeed,
+ * error code otherwise
+ */
+static CURLcode
+Curl_sha512_256_finish(unsigned char *digest,
+ void *context)
+{
+ CURLcode ret;
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+#ifdef __NetBSD__
+ /* Use a larger buffer to work around a bug in NetBSD:
+ https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=58039 */
+ unsigned char tmp_digest[SHA512_256_DIGEST_SIZE * 2];
+ ret = EVP_DigestFinal_ex(*ctx,
+ tmp_digest, NULL) ? CURLE_OK : CURLE_SSL_CIPHER;
+ if(ret == CURLE_OK)
+ memcpy(digest, tmp_digest, SHA512_256_DIGEST_SIZE);
+#else /* ! __NetBSD__ */
+ ret = EVP_DigestFinal_ex(*ctx, digest, NULL) ? CURLE_OK : CURLE_SSL_CIPHER;
+#endif /* ! __NetBSD__ */
+
+ EVP_MD_CTX_destroy(*ctx);
+ *ctx = NULL;
+
+ return ret;
+}
+
+#elif defined(USE_GNUTLS_SHA512_256)
+
+/**
+ * Context type used for SHA-512/256 calculations
+ */
+typedef struct sha512_256_ctx Curl_sha512_256_ctx;
+
+/**
+ * Initialise structure for SHA-512/256 calculation.
+ *
+ * @param context the calculation context
+ * @return always CURLE_OK
+ */
+static CURLcode
+Curl_sha512_256_init(void *context)
+{
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+ /* Check whether the header and this file use the same numbers */
+ DEBUGASSERT(SHA512_256_DIGEST_LENGTH == SHA512_256_DIGEST_SIZE);
+
+ sha512_256_init(ctx);
+
+ return CURLE_OK;
+}
+
+
+/**
+ * Process portion of bytes.
+ *
+ * @param context the calculation context
+ * @param data bytes to add to hash
+ * @param length number of bytes in @a data
+ * @return always CURLE_OK
+ */
+static CURLcode
+Curl_sha512_256_update(void *context,
+ const unsigned char *data,
+ size_t length)
+{
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+ DEBUGASSERT((data != NULL) || (length == 0));
+
+ sha512_256_update(ctx, length, (const uint8_t *)data);
+
+ return CURLE_OK;
+}
+
+
+/**
+ * Finalise SHA-512/256 calculation, return digest.
+ *
+ * @param context the calculation context
+ * @param[out] digest set to the hash, must be #SHA512_256_DIGEST_SIZE bytes
+ * @return always CURLE_OK
+ */
+static CURLcode
+Curl_sha512_256_finish(unsigned char *digest,
+ void *context)
+{
+ Curl_sha512_256_ctx *const ctx = (Curl_sha512_256_ctx *)context;
+
+ sha512_256_digest(ctx, (size_t)SHA512_256_DIGEST_SIZE, (uint8_t *)digest);
+
+ return CURLE_OK;
+}
+
+#else /* No system or TLS backend SHA-512/256 implementation available */
+
+/* Use local implementation */
+#define HAS_SHA512_256_IMPLEMENTATION 1
+
+/* ** This implementation of SHA-512/256 hash calculation was originally ** *
+ * ** written by Evgeny Grin (Karlson2k) for GNU libmicrohttpd. ** *
+ * ** The author ported the code to libcurl. The ported code is provided ** *
+ * ** under curl license. ** *
+ * ** This is a minimal version with minimal optimisations. Performance ** *
+ * ** can be significantly improved. Big-endian store and load macros ** *
+ * ** are obvious targets for optimisation. ** */
+
+#ifdef __GNUC__
+# if defined(__has_attribute) && defined(__STDC_VERSION__)
+# if __has_attribute(always_inline) && __STDC_VERSION__ >= 199901
+# define MHDX_INLINE inline __attribute__((always_inline))
+# endif
+# endif
+#endif
+
+#if !defined(MHDX_INLINE) && \
+ defined(_MSC_VER) && !defined(__GNUC__) && !defined(__clang__)
+# if _MSC_VER >= 1400
+# define MHDX_INLINE __forceinline
+# else
+# define MHDX_INLINE /* empty */
+# endif
+#endif
+
+#if !defined(MHDX_INLINE)
+# if defined(inline)
+ /* Assume that 'inline' macro was already defined correctly by
+ * the build system. */
+# define MHDX_INLINE inline
+# elif defined(__cplusplus)
+ /* The code is compiled with C++ compiler.
+ * C++ always supports 'inline'. */
+# define MHDX_INLINE inline
+# elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901
+ /* C99 (and later) supports 'inline' keyword */
+# define MHDX_INLINE inline
+# elif defined(__GNUC__) && __GNUC__ >= 3
+ /* GCC supports '__inline__' as an extension */
+# define MHDX_INLINE __inline__
+# else
+# define MHDX_INLINE /* empty */
+# endif
+#endif
+
+/* Bits manipulation macros and functions.
+ Can be moved to other headers to reuse. */
+
+#define MHDX_GET_64BIT_BE(ptr) \
+ ( ((curl_uint64_t)(((const unsigned char*)(ptr))[0]) << 56) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[1]) << 48) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[2]) << 40) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[3]) << 32) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[4]) << 24) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[5]) << 16) | \
+ ((curl_uint64_t)(((const unsigned char*)(ptr))[6]) << 8) | \
+ (curl_uint64_t)(((const unsigned char*)(ptr))[7]) )
+
+#define MHDX_PUT_64BIT_BE(ptr,val) do { \
+ ((unsigned char*)(ptr))[7]=(unsigned char)((curl_uint64_t)(val)); \
+ ((unsigned char*)(ptr))[6]=(unsigned char)(((curl_uint64_t)(val)) >> 8); \
+ ((unsigned char*)(ptr))[5]=(unsigned char)(((curl_uint64_t)(val)) >> 16); \
+ ((unsigned char*)(ptr))[4]=(unsigned char)(((curl_uint64_t)(val)) >> 24); \
+ ((unsigned char*)(ptr))[3]=(unsigned char)(((curl_uint64_t)(val)) >> 32); \
+ ((unsigned char*)(ptr))[2]=(unsigned char)(((curl_uint64_t)(val)) >> 40); \
+ ((unsigned char*)(ptr))[1]=(unsigned char)(((curl_uint64_t)(val)) >> 48); \
+ ((unsigned char*)(ptr))[0]=(unsigned char)(((curl_uint64_t)(val)) >> 56); \
+ } while(0)
+
+/* Defined as a function. The macro version may duplicate the binary code
+ * size as each argument is used twice, so if any calculation is used
+ * as an argument, the calculation could be done twice. */
+static MHDX_INLINE curl_uint64_t
+MHDx_rotr64(curl_uint64_t value, unsigned int bits)
+{
+ bits %= 64;
+ if(0 == bits)
+ return value;
+ /* Defined in a form which modern compiler could optimise. */
+ return (value >> bits) | (value << (64 - bits));
+}
+
+/* SHA-512/256 specific data */
+
+/**
+ * Number of bits in a single SHA-512/256 word.
+ */
+#define SHA512_256_WORD_SIZE_BITS 64
+
+/**
+ * Number of bytes in a single SHA-512/256 word.
+ */
+#define SHA512_256_BYTES_IN_WORD (SHA512_256_WORD_SIZE_BITS / 8)
+
+/**
+ * Hash is kept internally as 8 64-bit words.
+ * This is the intermediate hash size, used during computing the final digest.
+ */
+#define SHA512_256_HASH_SIZE_WORDS 8
+
+/**
+ * Size of the SHA-512/256 resulting digest in words.
+ * This is the final digest size, not intermediate hash.
+ */
+#define SHA512_256_DIGEST_SIZE_WORDS (SHA512_256_HASH_SIZE_WORDS / 2)
+
+/**
+ * Size of the SHA-512/256 resulting digest in bytes
+ * This is the final digest size, not intermediate hash.
+ */
+#define SHA512_256_DIGEST_SIZE \
+ (SHA512_256_DIGEST_SIZE_WORDS * SHA512_256_BYTES_IN_WORD)
+
+/**
+ * Size of the SHA-512/256 single processing block in bits.
+ */
+#define SHA512_256_BLOCK_SIZE_BITS 1024
+
+/**
+ * Size of the SHA-512/256 single processing block in bytes.
+ */
+#define SHA512_256_BLOCK_SIZE (SHA512_256_BLOCK_SIZE_BITS / 8)
+
+/**
+ * Size of the SHA-512/256 single processing block in words.
+ */
+#define SHA512_256_BLOCK_SIZE_WORDS \
+ (SHA512_256_BLOCK_SIZE_BITS / SHA512_256_WORD_SIZE_BITS)
+
+/**
+ * SHA-512/256 calculation context
+ */
+struct mhdx_sha512_256ctx
+{
+ /**
+ * Intermediate hash value. The variable is properly aligned. Smart
+ * compilers may automatically use fast load/store instruction for big
+ * endian data on little endian machine.
+ */
+ curl_uint64_t H[SHA512_256_HASH_SIZE_WORDS];
+ /**
+ * SHA-512/256 input data buffer. The buffer is properly aligned. Smart
+ * compilers may automatically use fast load/store instruction for big
+ * endian data on little endian machine.
+ */
+ curl_uint64_t buffer[SHA512_256_BLOCK_SIZE_WORDS];
+ /**
+ * The number of bytes, lower part
+ */
+ curl_uint64_t count;
+ /**
+ * The number of bits, high part. Unlike lower part, this counts the number
+ * of bits, not bytes.
+ */
+ curl_uint64_t count_bits_hi;
+};
+
+/**
+ * Context type used for SHA-512/256 calculations
+ */
+typedef struct mhdx_sha512_256ctx Curl_sha512_256_ctx;
+
+
+/**
+ * Initialise structure for SHA-512/256 calculation.
+ *
+ * @param context the calculation context
+ * @return always CURLE_OK
+ */
+static CURLcode
+MHDx_sha512_256_init(void *context)
+{
+ struct mhdx_sha512_256ctx *const ctx = (struct mhdx_sha512_256ctx *) context;
+
+ /* Check whether the header and this file use the same numbers */
+ DEBUGASSERT(SHA512_256_DIGEST_LENGTH == SHA512_256_DIGEST_SIZE);
+
+ DEBUGASSERT(sizeof(curl_uint64_t) == 8);
+
+ /* Initial hash values, see FIPS PUB 180-4 section 5.3.6.2 */
+ /* Values generated by "IV Generation Function" as described in
+ * section 5.3.6 */
+ ctx->H[0] = CURL_UINT64_C(0x22312194FC2BF72C);
+ ctx->H[1] = CURL_UINT64_C(0x9F555FA3C84C64C2);
+ ctx->H[2] = CURL_UINT64_C(0x2393B86B6F53B151);
+ ctx->H[3] = CURL_UINT64_C(0x963877195940EABD);
+ ctx->H[4] = CURL_UINT64_C(0x96283EE2A88EFFE3);
+ ctx->H[5] = CURL_UINT64_C(0xBE5E1E2553863992);
+ ctx->H[6] = CURL_UINT64_C(0x2B0199FC2C85B8AA);
+ ctx->H[7] = CURL_UINT64_C(0x0EB72DDC81C52CA2);
+
+ /* Initialise number of bytes and high part of number of bits. */
+ ctx->count = CURL_UINT64_C(0);
+ ctx->count_bits_hi = CURL_UINT64_C(0);
+
+ return CURLE_OK;
+}
+
+
+/**
+ * Base of the SHA-512/256 transformation.
+ * Gets a full 128 bytes block of data and updates hash values;
+ * @param H hash values
+ * @param data the data buffer with #SHA512_256_BLOCK_SIZE bytes block
+ */
+static void
+MHDx_sha512_256_transform(curl_uint64_t H[SHA512_256_HASH_SIZE_WORDS],
+ const void *data)
+{
+ /* Working variables,
+ see FIPS PUB 180-4 section 6.7, 6.4. */
+ curl_uint64_t a = H[0];
+ curl_uint64_t b = H[1];
+ curl_uint64_t c = H[2];
+ curl_uint64_t d = H[3];
+ curl_uint64_t e = H[4];
+ curl_uint64_t f = H[5];
+ curl_uint64_t g = H[6];
+ curl_uint64_t h = H[7];
+
+ /* Data buffer, used as a cyclic buffer.
+ See FIPS PUB 180-4 section 5.2.2, 6.7, 6.4. */
+ curl_uint64_t W[16];
+
+ /* 'Ch' and 'Maj' macro functions are defined with widely-used optimisation.
+ See FIPS PUB 180-4 formulae 4.8, 4.9. */
+#define Ch(x,y,z) ( (z) ^ ((x) & ((y) ^ (z))) )
+#define Maj(x,y,z) ( ((x) & (y)) ^ ((z) & ((x) ^ (y))) )
+
+ /* Four 'Sigma' macro functions.
+ See FIPS PUB 180-4 formulae 4.10, 4.11, 4.12, 4.13. */
+#define SIG0(x) \
+ ( MHDx_rotr64((x), 28) ^ MHDx_rotr64((x), 34) ^ MHDx_rotr64((x), 39) )
+#define SIG1(x) \
+ ( MHDx_rotr64((x), 14) ^ MHDx_rotr64((x), 18) ^ MHDx_rotr64((x), 41) )
+#define sig0(x) \
+ ( MHDx_rotr64((x), 1) ^ MHDx_rotr64((x), 8) ^ ((x) >> 7) )
+#define sig1(x) \
+ ( MHDx_rotr64((x), 19) ^ MHDx_rotr64((x), 61) ^ ((x) >> 6) )
+
+ if(1) {
+ unsigned int t;
+ /* K constants array.
+ See FIPS PUB 180-4 section 4.2.3 for K values. */
+ static const curl_uint64_t K[80] = {
+ CURL_UINT64_C(0x428a2f98d728ae22), CURL_UINT64_C(0x7137449123ef65cd),
+ CURL_UINT64_C(0xb5c0fbcfec4d3b2f), CURL_UINT64_C(0xe9b5dba58189dbbc),
+ CURL_UINT64_C(0x3956c25bf348b538), CURL_UINT64_C(0x59f111f1b605d019),
+ CURL_UINT64_C(0x923f82a4af194f9b), CURL_UINT64_C(0xab1c5ed5da6d8118),
+ CURL_UINT64_C(0xd807aa98a3030242), CURL_UINT64_C(0x12835b0145706fbe),
+ CURL_UINT64_C(0x243185be4ee4b28c), CURL_UINT64_C(0x550c7dc3d5ffb4e2),
+ CURL_UINT64_C(0x72be5d74f27b896f), CURL_UINT64_C(0x80deb1fe3b1696b1),
+ CURL_UINT64_C(0x9bdc06a725c71235), CURL_UINT64_C(0xc19bf174cf692694),
+ CURL_UINT64_C(0xe49b69c19ef14ad2), CURL_UINT64_C(0xefbe4786384f25e3),
+ CURL_UINT64_C(0x0fc19dc68b8cd5b5), CURL_UINT64_C(0x240ca1cc77ac9c65),
+ CURL_UINT64_C(0x2de92c6f592b0275), CURL_UINT64_C(0x4a7484aa6ea6e483),
+ CURL_UINT64_C(0x5cb0a9dcbd41fbd4), CURL_UINT64_C(0x76f988da831153b5),
+ CURL_UINT64_C(0x983e5152ee66dfab), CURL_UINT64_C(0xa831c66d2db43210),
+ CURL_UINT64_C(0xb00327c898fb213f), CURL_UINT64_C(0xbf597fc7beef0ee4),
+ CURL_UINT64_C(0xc6e00bf33da88fc2), CURL_UINT64_C(0xd5a79147930aa725),
+ CURL_UINT64_C(0x06ca6351e003826f), CURL_UINT64_C(0x142929670a0e6e70),
+ CURL_UINT64_C(0x27b70a8546d22ffc), CURL_UINT64_C(0x2e1b21385c26c926),
+ CURL_UINT64_C(0x4d2c6dfc5ac42aed), CURL_UINT64_C(0x53380d139d95b3df),
+ CURL_UINT64_C(0x650a73548baf63de), CURL_UINT64_C(0x766a0abb3c77b2a8),
+ CURL_UINT64_C(0x81c2c92e47edaee6), CURL_UINT64_C(0x92722c851482353b),
+ CURL_UINT64_C(0xa2bfe8a14cf10364), CURL_UINT64_C(0xa81a664bbc423001),
+ CURL_UINT64_C(0xc24b8b70d0f89791), CURL_UINT64_C(0xc76c51a30654be30),
+ CURL_UINT64_C(0xd192e819d6ef5218), CURL_UINT64_C(0xd69906245565a910),
+ CURL_UINT64_C(0xf40e35855771202a), CURL_UINT64_C(0x106aa07032bbd1b8),
+ CURL_UINT64_C(0x19a4c116b8d2d0c8), CURL_UINT64_C(0x1e376c085141ab53),
+ CURL_UINT64_C(0x2748774cdf8eeb99), CURL_UINT64_C(0x34b0bcb5e19b48a8),
+ CURL_UINT64_C(0x391c0cb3c5c95a63), CURL_UINT64_C(0x4ed8aa4ae3418acb),
+ CURL_UINT64_C(0x5b9cca4f7763e373), CURL_UINT64_C(0x682e6ff3d6b2b8a3),
+ CURL_UINT64_C(0x748f82ee5defb2fc), CURL_UINT64_C(0x78a5636f43172f60),
+ CURL_UINT64_C(0x84c87814a1f0ab72), CURL_UINT64_C(0x8cc702081a6439ec),
+ CURL_UINT64_C(0x90befffa23631e28), CURL_UINT64_C(0xa4506cebde82bde9),
+ CURL_UINT64_C(0xbef9a3f7b2c67915), CURL_UINT64_C(0xc67178f2e372532b),
+ CURL_UINT64_C(0xca273eceea26619c), CURL_UINT64_C(0xd186b8c721c0c207),
+ CURL_UINT64_C(0xeada7dd6cde0eb1e), CURL_UINT64_C(0xf57d4f7fee6ed178),
+ CURL_UINT64_C(0x06f067aa72176fba), CURL_UINT64_C(0x0a637dc5a2c898a6),
+ CURL_UINT64_C(0x113f9804bef90dae), CURL_UINT64_C(0x1b710b35131c471b),
+ CURL_UINT64_C(0x28db77f523047d84), CURL_UINT64_C(0x32caab7b40c72493),
+ CURL_UINT64_C(0x3c9ebe0a15c9bebc), CURL_UINT64_C(0x431d67c49c100d4c),
+ CURL_UINT64_C(0x4cc5d4becb3e42b6), CURL_UINT64_C(0x597f299cfc657e2a),
+ CURL_UINT64_C(0x5fcb6fab3ad6faec), CURL_UINT64_C(0x6c44198c4a475817)
+ };
+
+ /* One step of SHA-512/256 computation,
+ see FIPS PUB 180-4 section 6.4.2 step 3.
+ * Note: this macro updates working variables in-place, without rotation.
+ * Note: the first (vH += SIG1(vE) + Ch(vE,vF,vG) + kt + wt) equals T1 in
+ FIPS PUB 180-4 section 6.4.2 step 3.
+ the second (vH += SIG0(vA) + Maj(vE,vF,vC) equals T1 + T2 in
+ FIPS PUB 180-4 section 6.4.2 step 3.
+ * Note: 'wt' must be used exactly one time in this macro as macro for
+ 'wt' calculation may change other data as well every time when
+ used. */
+#define SHA2STEP64(vA,vB,vC,vD,vE,vF,vG,vH,kt,wt) do { \
+ (vD) += ((vH) += SIG1 ((vE)) + Ch ((vE),(vF),(vG)) + (kt) + (wt)); \
+ (vH) += SIG0 ((vA)) + Maj ((vA),(vB),(vC)); } while (0)
+
+ /* One step of SHA-512/256 computation with working variables rotation,
+ see FIPS PUB 180-4 section 6.4.2 step 3. This macro version reassigns
+ all working variables on each step. */
+#define SHA2STEP64RV(vA,vB,vC,vD,vE,vF,vG,vH,kt,wt) do { \
+ curl_uint64_t tmp_h_ = (vH); \
+ SHA2STEP64((vA),(vB),(vC),(vD),(vE),(vF),(vG),tmp_h_,(kt),(wt)); \
+ (vH) = (vG); \
+ (vG) = (vF); \
+ (vF) = (vE); \
+ (vE) = (vD); \
+ (vD) = (vC); \
+ (vC) = (vB); \
+ (vB) = (vA); \
+ (vA) = tmp_h_; } while(0)
+
+ /* Get value of W(t) from input data buffer for 0 <= t <= 15,
+ See FIPS PUB 180-4 section 6.2.
+ Input data must be read in big-endian bytes order,
+ see FIPS PUB 180-4 section 3.1.2. */
+#define SHA512_GET_W_FROM_DATA(buf,t) \
+ MHDX_GET_64BIT_BE( \
+ ((const unsigned char*) (buf)) + (t) * SHA512_256_BYTES_IN_WORD)
+
+ /* During first 16 steps, before making any calculation on each step, the
+ W element is read from the input data buffer as a big-endian value and
+ stored in the array of W elements. */
+ for(t = 0; t < 16; ++t) {
+ SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], \
+ W[t] = SHA512_GET_W_FROM_DATA(data, t));
+ }
+
+ /* 'W' generation and assignment for 16 <= t <= 79.
+ See FIPS PUB 180-4 section 6.4.2.
+ As only the last 16 'W' are used in calculations, it is possible to
+ use 16 elements array of W as a cyclic buffer.
+ Note: ((t-16) & 15) have same value as (t & 15) */
+#define Wgen(w,t) \
+ (curl_uint64_t)( (w)[(t - 16) & 15] + sig1((w)[((t) - 2) & 15]) \
+ + (w)[((t) - 7) & 15] + sig0((w)[((t) - 15) & 15]) )
+
+ /* During the last 64 steps, before making any calculation on each step,
+ current W element is generated from other W elements of the cyclic
+ buffer and the generated value is stored back in the cyclic buffer. */
+ for(t = 16; t < 80; ++t) {
+ SHA2STEP64RV(a, b, c, d, e, f, g, h, K[t], \
+ W[t & 15] = Wgen(W, t));
+ }
+ }
+
+ /* Compute and store the intermediate hash.
+ See FIPS PUB 180-4 section 6.4.2 step 4. */
+ H[0] += a;
+ H[1] += b;
+ H[2] += c;
+ H[3] += d;
+ H[4] += e;
+ H[5] += f;
+ H[6] += g;
+ H[7] += h;
+}
+
+
+/**
+ * Process portion of bytes.
+ *
+ * @param context the calculation context
+ * @param data bytes to add to hash
+ * @param length number of bytes in @a data
+ * @return always CURLE_OK
+ */
+static CURLcode
+MHDx_sha512_256_update(void *context,
+ const unsigned char *data,
+ size_t length)
+{
+ unsigned int bytes_have; /**< Number of bytes in the context buffer */
+ struct mhdx_sha512_256ctx *const ctx = (struct mhdx_sha512_256ctx *)context;
+ /* the void pointer here is required to mute Intel compiler warning */
+ void *const ctx_buf = ctx->buffer;
+
+ DEBUGASSERT((data != NULL) || (length == 0));
+
+ if(0 == length)
+ return CURLE_OK; /* Shortcut, do nothing */
+
+ /* Note: (count & (SHA512_256_BLOCK_SIZE-1))
+ equals (count % SHA512_256_BLOCK_SIZE) for this block size. */
+ bytes_have = (unsigned int) (ctx->count & (SHA512_256_BLOCK_SIZE - 1));
+ ctx->count += length;
+ if(length > ctx->count)
+ ctx->count_bits_hi += 1U << 3; /* Value wrap */
+ ctx->count_bits_hi += ctx->count >> 61;
+ ctx->count &= CURL_UINT64_C(0x1FFFFFFFFFFFFFFF);
+
+ if(0 != bytes_have) {
+ unsigned int bytes_left = SHA512_256_BLOCK_SIZE - bytes_have;
+ if(length >= bytes_left) {
+ /* Combine new data with data in the buffer and process the full
+ block. */
+ memcpy(((unsigned char *) ctx_buf) + bytes_have,
+ data,
+ bytes_left);
+ data += bytes_left;
+ length -= bytes_left;
+ MHDx_sha512_256_transform(ctx->H, ctx->buffer);
+ bytes_have = 0;
+ }
+ }
+
+ while(SHA512_256_BLOCK_SIZE <= length) {
+ /* Process any full blocks of new data directly,
+ without copying to the buffer. */
+ MHDx_sha512_256_transform(ctx->H, data);
+ data += SHA512_256_BLOCK_SIZE;
+ length -= SHA512_256_BLOCK_SIZE;
+ }
+
+ if(0 != length) {
+ /* Copy incomplete block of new data (if any)
+ to the buffer. */
+ memcpy(((unsigned char *) ctx_buf) + bytes_have, data, length);
+ }
+
+ return CURLE_OK;
+}
+
+
+
+/**
+ * Size of "length" insertion in bits.
+ * See FIPS PUB 180-4 section 5.1.2.
+ */
+#define SHA512_256_SIZE_OF_LEN_ADD_BITS 128
+
+/**
+ * Size of "length" insertion in bytes.
+ */
+#define SHA512_256_SIZE_OF_LEN_ADD (SHA512_256_SIZE_OF_LEN_ADD_BITS / 8)
+
+/**
+ * Finalise SHA-512/256 calculation, return digest.
+ *
+ * @param context the calculation context
+ * @param[out] digest set to the hash, must be #SHA512_256_DIGEST_SIZE bytes
+ * @return always CURLE_OK
+ */
+static CURLcode
+MHDx_sha512_256_finish(unsigned char *digest,
+ void *context)
+{
+ struct mhdx_sha512_256ctx *const ctx = (struct mhdx_sha512_256ctx *)context;
+ curl_uint64_t num_bits; /**< Number of processed bits */
+ unsigned int bytes_have; /**< Number of bytes in the context buffer */
+ /* the void pointer here is required to mute Intel compiler warning */
+ void *const ctx_buf = ctx->buffer;
+
+ /* Memorise the number of processed bits.
+ The padding and other data added here during the postprocessing must
+ not change the amount of hashed data. */
+ num_bits = ctx->count << 3;
+
+ /* Note: (count & (SHA512_256_BLOCK_SIZE-1))
+ equals (count % SHA512_256_BLOCK_SIZE) for this block size. */
+ bytes_have = (unsigned int) (ctx->count & (SHA512_256_BLOCK_SIZE - 1));
+
+ /* Input data must be padded with a single bit "1", then with zeros and
+ the finally the length of data in bits must be added as the final bytes
+ of the last block.
+ See FIPS PUB 180-4 section 5.1.2. */
+
+ /* Data is always processed in form of bytes (not by individual bits),
+ therefore position of the first padding bit in byte is always
+ predefined (0x80). */
+ /* Buffer always have space at least for one byte (as full buffers are
+ processed when formed). */
+ ((unsigned char *) ctx_buf)[bytes_have++] = 0x80U;
+
+ if(SHA512_256_BLOCK_SIZE - bytes_have < SHA512_256_SIZE_OF_LEN_ADD) {
+ /* No space in the current block to put the total length of message.
+ Pad the current block with zeros and process it. */
+ if(bytes_have < SHA512_256_BLOCK_SIZE)
+ memset(((unsigned char *) ctx_buf) + bytes_have, 0,
+ SHA512_256_BLOCK_SIZE - bytes_have);
+ /* Process the full block. */
+ MHDx_sha512_256_transform(ctx->H, ctx->buffer);
+ /* Start the new block. */
+ bytes_have = 0;
+ }
+
+ /* Pad the rest of the buffer with zeros. */
+ memset(((unsigned char *) ctx_buf) + bytes_have, 0,
+ SHA512_256_BLOCK_SIZE - SHA512_256_SIZE_OF_LEN_ADD - bytes_have);
+ /* Put high part of number of bits in processed message and then lower
+ part of number of bits as big-endian values.
+ See FIPS PUB 180-4 section 5.1.2. */
+ /* Note: the target location is predefined and buffer is always aligned */
+ MHDX_PUT_64BIT_BE(((unsigned char *) ctx_buf) \
+ + SHA512_256_BLOCK_SIZE \
+ - SHA512_256_SIZE_OF_LEN_ADD, \
+ ctx->count_bits_hi);
+ MHDX_PUT_64BIT_BE(((unsigned char *) ctx_buf) \
+ + SHA512_256_BLOCK_SIZE \
+ - SHA512_256_SIZE_OF_LEN_ADD \
+ + SHA512_256_BYTES_IN_WORD, \
+ num_bits);
+ /* Process the full final block. */
+ MHDx_sha512_256_transform(ctx->H, ctx->buffer);
+
+ /* Put in BE mode the leftmost part of the hash as the final digest.
+ See FIPS PUB 180-4 section 6.7. */
+
+ MHDX_PUT_64BIT_BE((digest + 0 * SHA512_256_BYTES_IN_WORD), ctx->H[0]);
+ MHDX_PUT_64BIT_BE((digest + 1 * SHA512_256_BYTES_IN_WORD), ctx->H[1]);
+ MHDX_PUT_64BIT_BE((digest + 2 * SHA512_256_BYTES_IN_WORD), ctx->H[2]);
+ MHDX_PUT_64BIT_BE((digest + 3 * SHA512_256_BYTES_IN_WORD), ctx->H[3]);
+
+ /* Erase potentially sensitive data. */
+ memset(ctx, 0, sizeof(struct mhdx_sha512_256ctx));
+
+ return CURLE_OK;
+}
+
+/* Map to the local implementation */
+#define Curl_sha512_256_init MHDx_sha512_256_init
+#define Curl_sha512_256_update MHDx_sha512_256_update
+#define Curl_sha512_256_finish MHDx_sha512_256_finish
+
+#endif /* Local SHA-512/256 code */
+
+
+/**
+ * Compute SHA-512/256 hash for the given data in one function call
+ * @param[out] output the pointer to put the hash
+ * @param[in] input the pointer to the data to process
+ * @param input_size the size of the data pointed by @a input
+ * @return always #CURLE_OK
+ */
+CURLcode
+Curl_sha512_256it(unsigned char *output, const unsigned char *input,
+ size_t input_size)
+{
+ Curl_sha512_256_ctx ctx;
+ CURLcode res;
+
+ res = Curl_sha512_256_init(&ctx);
+ if(res != CURLE_OK)
+ return res;
+
+ res = Curl_sha512_256_update(&ctx, (const void *) input, input_size);
+
+ if(res != CURLE_OK) {
+ (void) Curl_sha512_256_finish(output, &ctx);
+ return res;
+ }
+
+ return Curl_sha512_256_finish(output, &ctx);
+}
+
+/* Wrapper function, takes 'unsigned int' as length type, returns void */
+static void
+Curl_sha512_256_update_i(void *context,
+ const unsigned char *data,
+ unsigned int length)
+{
+ /* Hypothetically the function may fail, but assume it does not */
+ (void) Curl_sha512_256_update(context, data, length);
+}
+
+/* Wrapper function, returns void */
+static void
+Curl_sha512_256_finish_v(unsigned char *result,
+ void *context)
+{
+ /* Hypothetically the function may fail, but assume it does not */
+ (void) Curl_sha512_256_finish(result, context);
+}
+
+/* Wrapper function, takes 'unsigned int' as length type, returns void */
+
+const struct HMAC_params Curl_HMAC_SHA512_256[] = {
+ {
+ /* Initialize context procedure. */
+ Curl_sha512_256_init,
+ /* Update context with data. */
+ Curl_sha512_256_update_i,
+ /* Get final result procedure. */
+ Curl_sha512_256_finish_v,
+ /* Context structure size. */
+ sizeof(Curl_sha512_256_ctx),
+ /* Maximum key length (bytes). */
+ SHA512_256_BLOCK_SIZE,
+ /* Result length (bytes). */
+ SHA512_256_DIGEST_SIZE
+ }
+};
+
+#endif /* !CURL_DISABLE_DIGEST_AUTH && !CURL_DISABLE_SHA512_256 */
diff --git a/Utilities/cmcurl/lib/curl_sha512_256.h b/Utilities/cmcurl/lib/curl_sha512_256.h
new file mode 100644
index 0000000..30a9f14
--- /dev/null
+++ b/Utilities/cmcurl/lib/curl_sha512_256.h
@@ -0,0 +1,44 @@
+#ifndef HEADER_CURL_SHA512_256_H
+#define HEADER_CURL_SHA512_256_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Evgeny Grin (Karlson2k), <k2k@narod.ru>.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+#if !defined(CURL_DISABLE_DIGEST_AUTH) && !defined(CURL_DISABLE_SHA512_256)
+
+#include <curl/curl.h>
+#include "curl_hmac.h"
+
+#define CURL_HAVE_SHA512_256
+
+extern const struct HMAC_params Curl_HMAC_SHA512_256[1];
+
+#define SHA512_256_DIGEST_LENGTH 32
+
+CURLcode
+Curl_sha512_256it(unsigned char *output, const unsigned char *input,
+ size_t input_size);
+
+#endif /* !CURL_DISABLE_DIGEST_AUTH && !CURL_DISABLE_SHA512_256 */
+
+#endif /* HEADER_CURL_SHA256_H */
diff --git a/Utilities/cmcurl/lib/curl_trc.c b/Utilities/cmcurl/lib/curl_trc.c
index b8dccc4..fa6ad22 100644
--- a/Utilities/cmcurl/lib/curl_trc.c
+++ b/Utilities/cmcurl/lib/curl_trc.c
@@ -36,6 +36,7 @@
#include "cf-socket.h"
#include "connect.h"
+#include "doh.h"
#include "http2.h"
#include "http_proxy.h"
#include "cf-h1-proxy.h"
@@ -113,12 +114,14 @@ void Curl_failf(struct Curl_easy *data, const char *fmt, ...)
void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
{
DEBUGASSERT(!strchr(fmt, '\n'));
- if(data && data->set.verbose) {
+ if(Curl_trc_is_verbose(data)) {
va_list ap;
- int len;
+ int len = 0;
char buffer[MAXINFO + 2];
+ if(data->state.feat)
+ len = msnprintf(buffer, MAXINFO, "[%s] ", data->state.feat->name);
va_start(ap, fmt);
- len = mvsnprintf(buffer, MAXINFO, fmt, ap);
+ len += mvsnprintf(buffer + len, MAXINFO - len, fmt, ap);
va_end(ap);
buffer[len++] = '\n';
buffer[len] = '\0';
@@ -132,9 +135,16 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
DEBUGASSERT(cf);
if(Curl_trc_cf_is_verbose(cf, data)) {
va_list ap;
- int len;
+ int len = 0;
char buffer[MAXINFO + 2];
- len = msnprintf(buffer, MAXINFO, "[%s] ", cf->cft->name);
+ if(data->state.feat)
+ len += msnprintf(buffer + len, MAXINFO - len, "[%s] ",
+ data->state.feat->name);
+ if(cf->sockindex)
+ len += msnprintf(buffer + len, MAXINFO - len, "[%s-%d] ",
+ cf->cft->name, cf->sockindex);
+ else
+ len += msnprintf(buffer + len, MAXINFO - len, "[%s] ", cf->cft->name);
va_start(ap, fmt);
len += mvsnprintf(buffer + len, MAXINFO - len, fmt, ap);
va_end(ap);
@@ -144,6 +154,12 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
}
}
+static struct curl_trc_feat *trc_feats[] = {
+#ifndef CURL_DISABLE_DOH
+ &Curl_doh_trc,
+#endif
+ NULL,
+};
static struct Curl_cftype *cf_types[] = {
&Curl_cft_tcp,
@@ -215,6 +231,15 @@ CURLcode Curl_trc_opt(const char *config)
break;
}
}
+ for(i = 0; trc_feats[i]; ++i) {
+ if(strcasecompare(token, "all")) {
+ trc_feats[i]->log_level = lvl;
+ }
+ else if(strcasecompare(token, trc_feats[i]->name)) {
+ trc_feats[i]->log_level = lvl;
+ break;
+ }
+ }
token = strtok_r(NULL, ", ", &tok_buf);
}
free(tmp);
diff --git a/Utilities/cmcurl/lib/curl_trc.h b/Utilities/cmcurl/lib/curl_trc.h
index 3a5387a..92b0533 100644
--- a/Utilities/cmcurl/lib/curl_trc.h
+++ b/Utilities/cmcurl/lib/curl_trc.h
@@ -86,10 +86,21 @@ void Curl_failf(struct Curl_easy *data,
#ifndef CURL_DISABLE_VERBOSE_STRINGS
/* informational messages enabled */
-#define Curl_trc_is_verbose(data) ((data) && (data)->set.verbose)
+struct curl_trc_feat {
+ const char *name;
+ int log_level;
+};
+
+#define Curl_trc_is_verbose(data) \
+ ((data) && (data)->set.verbose && \
+ (!(data)->state.feat || \
+ ((data)->state.feat->log_level >= CURL_LOG_LVL_INFO)))
#define Curl_trc_cf_is_verbose(cf, data) \
- ((data) && (data)->set.verbose && \
- (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO)
+ (Curl_trc_is_verbose(data) && \
+ (cf) && (cf)->cft->log_level >= CURL_LOG_LVL_INFO)
+#define Curl_trc_ft_is_verbose(data, ft) \
+ (Curl_trc_is_verbose(data) && \
+ (ft)->log_level >= CURL_LOG_LVL_INFO)
/**
* Output an informational message when transfer's verbose logging is enabled.
@@ -109,6 +120,7 @@ void Curl_trc_cf_infof(struct Curl_easy *data, struct Curl_cfilter *cf,
#define Curl_trc_is_verbose(d) ((void)(d), FALSE)
#define Curl_trc_cf_is_verbose(x,y) ((void)(x), (void)(y), FALSE)
+#define Curl_trc_ft_is_verbose(x,y) ((void)(x), (void)(y), FALSE)
static void Curl_infof(struct Curl_easy *data, const char *fmt, ...)
{
diff --git a/Utilities/cmcurl/lib/cw-out.c b/Utilities/cmcurl/lib/cw-out.c
new file mode 100644
index 0000000..c168837
--- /dev/null
+++ b/Utilities/cmcurl/lib/cw-out.c
@@ -0,0 +1,437 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#include <curl/curl.h>
+
+#include "urldata.h"
+#include "cfilters.h"
+#include "headers.h"
+#include "multiif.h"
+#include "sendf.h"
+#include "cw-out.h"
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+
+/**
+ * OVERALL DESIGN of this client writer
+ *
+ * The 'cw-out' writer is supposed to be the last writer in a transfer's
+ * stack. It is always added when that stack is initialized. Its purpose
+ * is to pass BODY and HEADER bytes to the client-installed callback
+ * functions.
+ *
+ * These callback may return `CURL_WRITEFUNC_PAUSE` to indicate that the
+ * data had not been written and the whole transfer should stop receiving
+ * new data. Or at least, stop calling the functions. When the transfer
+ * is "unpaused" by the client, the previous data shall be passed as
+ * if nothing happened.
+ *
+ * The `cw-out` writer therefore manages buffers for bytes that could
+ * not be written. Data that was already in flight from the server also
+ * needs buffering on paused transfer when it arrives.
+ *
+ * In addition, the writer allows buffering of "small" body writes,
+ * so client functions are called less often. That is only enabled on a
+ * number of conditions.
+ *
+ * HEADER and BODY data may arrive in any order. For paused transfers,
+ * a list of `struct cw_out_buf` is kept for `cw_out_type` types. The
+ * list may be: [BODY]->[HEADER]->[BODY]->[HEADER]....
+ * When unpausing, this list is "played back" to the client callbacks.
+ *
+ * The amount of bytes being buffered is limited by `DYN_PAUSE_BUFFER`
+ * and when that is exceeded `CURLE_TOO_LARGE` is returned as error.
+ */
+typedef enum {
+ CW_OUT_NONE,
+ CW_OUT_BODY,
+ CW_OUT_HDS
+} cw_out_type;
+
+struct cw_out_buf {
+ struct cw_out_buf *next;
+ struct dynbuf b;
+ cw_out_type type;
+};
+
+static struct cw_out_buf *cw_out_buf_create(cw_out_type otype)
+{
+ struct cw_out_buf *cwbuf = calloc(1, sizeof(*cwbuf));
+ if(cwbuf) {
+ cwbuf->type = otype;
+ Curl_dyn_init(&cwbuf->b, DYN_PAUSE_BUFFER);
+ }
+ return cwbuf;
+}
+
+static void cw_out_buf_free(struct cw_out_buf *cwbuf)
+{
+ if(cwbuf) {
+ Curl_dyn_free(&cwbuf->b);
+ free(cwbuf);
+ }
+}
+
+struct cw_out_ctx {
+ struct Curl_cwriter super;
+ struct cw_out_buf *buf;
+};
+
+static CURLcode cw_out_write(struct Curl_easy *data,
+ struct Curl_cwriter *writer, int type,
+ const char *buf, size_t nbytes);
+static void cw_out_close(struct Curl_easy *data, struct Curl_cwriter *writer);
+static CURLcode cw_out_init(struct Curl_easy *data,
+ struct Curl_cwriter *writer);
+
+struct Curl_cwtype Curl_cwt_out = {
+ "cw-out",
+ NULL,
+ cw_out_init,
+ cw_out_write,
+ cw_out_close,
+ sizeof(struct cw_out_ctx)
+};
+
+static CURLcode cw_out_init(struct Curl_easy *data,
+ struct Curl_cwriter *writer)
+{
+ struct cw_out_ctx *ctx = writer->ctx;
+ (void)data;
+ ctx->buf = NULL;
+ return CURLE_OK;
+}
+
+static void cw_out_bufs_free(struct cw_out_ctx *ctx)
+{
+ while(ctx->buf) {
+ struct cw_out_buf *next = ctx->buf->next;
+ cw_out_buf_free(ctx->buf);
+ ctx->buf = next;
+ }
+}
+
+static size_t cw_out_bufs_len(struct cw_out_ctx *ctx)
+{
+ struct cw_out_buf *cwbuf = ctx->buf;
+ size_t len = 0;
+ while(cwbuf) {
+ len += Curl_dyn_len(&cwbuf->b);
+ cwbuf = cwbuf->next;
+ }
+ return len;
+}
+
+static void cw_out_close(struct Curl_easy *data, struct Curl_cwriter *writer)
+{
+ struct cw_out_ctx *ctx = writer->ctx;
+
+ (void)data;
+ cw_out_bufs_free(ctx);
+}
+
+/**
+ * Return the current curl_write_callback and user_data for the buf type
+ */
+static void cw_get_writefunc(struct Curl_easy *data, cw_out_type otype,
+ curl_write_callback *pwcb, void **pwcb_data,
+ size_t *pmax_write, size_t *pmin_write)
+{
+ switch(otype) {
+ case CW_OUT_BODY:
+ *pwcb = data->set.fwrite_func;
+ *pwcb_data = data->set.out;
+ *pmax_write = CURL_MAX_WRITE_SIZE;
+ /* if we ever want buffering of BODY output, we can set `min_write`
+ * the preferred size. The default should always be to pass data
+ * to the client as it comes without delay */
+ *pmin_write = 0;
+ break;
+ case CW_OUT_HDS:
+ *pwcb = data->set.fwrite_header? data->set.fwrite_header :
+ (data->set.writeheader? data->set.fwrite_func : NULL);
+ *pwcb_data = data->set.writeheader;
+ *pmax_write = 0; /* do not chunk-write headers, write them as they are */
+ *pmin_write = 0;
+ break;
+ default:
+ *pwcb = NULL;
+ *pwcb_data = NULL;
+ *pmax_write = CURL_MAX_WRITE_SIZE;
+ *pmin_write = 0;
+ }
+}
+
+static CURLcode cw_out_ptr_flush(struct cw_out_ctx *ctx,
+ struct Curl_easy *data,
+ cw_out_type otype,
+ bool flush_all,
+ const char *buf, size_t blen,
+ size_t *pconsumed)
+{
+ curl_write_callback wcb;
+ void *wcb_data;
+ size_t max_write, min_write;
+ size_t wlen, nwritten;
+
+ (void)ctx;
+ /* write callbacks may get NULLed by the client between calls. */
+ cw_get_writefunc(data, otype, &wcb, &wcb_data, &max_write, &min_write);
+ if(!wcb) {
+ *pconsumed = blen;
+ return CURLE_OK;
+ }
+
+ *pconsumed = 0;
+ while(blen && !(data->req.keepon & KEEP_RECV_PAUSE)) {
+ if(!flush_all && blen < min_write)
+ break;
+ wlen = max_write? CURLMIN(blen, max_write) : blen;
+ Curl_set_in_callback(data, TRUE);
+ nwritten = wcb((char *)buf, 1, wlen, wcb_data);
+ Curl_set_in_callback(data, FALSE);
+ if(CURL_WRITEFUNC_PAUSE == nwritten) {
+ if(data->conn && data->conn->handler->flags & PROTOPT_NONETWORK) {
+ /* Protocols that work without network cannot be paused. This is
+ actually only FILE:// just now, and it can't pause since the
+ transfer isn't done using the "normal" procedure. */
+ failf(data, "Write callback asked for PAUSE when not supported");
+ return CURLE_WRITE_ERROR;
+ }
+ /* mark the connection as RECV paused */
+ data->req.keepon |= KEEP_RECV_PAUSE;
+ break;
+ }
+ if(nwritten != wlen) {
+ failf(data, "Failure writing output to destination, "
+ "passed %zu returned %zd", wlen, nwritten);
+ return CURLE_WRITE_ERROR;
+ }
+ *pconsumed += nwritten;
+ blen -= nwritten;
+ buf += nwritten;
+ }
+ return CURLE_OK;
+}
+
+static CURLcode cw_out_buf_flush(struct cw_out_ctx *ctx,
+ struct Curl_easy *data,
+ struct cw_out_buf *cwbuf,
+ bool flush_all)
+{
+ CURLcode result = CURLE_OK;
+
+ if(Curl_dyn_len(&cwbuf->b)) {
+ size_t consumed;
+
+ result = cw_out_ptr_flush(ctx, data, cwbuf->type, flush_all,
+ Curl_dyn_ptr(&cwbuf->b),
+ Curl_dyn_len(&cwbuf->b),
+ &consumed);
+ if(result)
+ return result;
+
+ if(consumed) {
+ if(consumed == Curl_dyn_len(&cwbuf->b)) {
+ Curl_dyn_free(&cwbuf->b);
+ }
+ else {
+ DEBUGASSERT(consumed < Curl_dyn_len(&cwbuf->b));
+ result = Curl_dyn_tail(&cwbuf->b, Curl_dyn_len(&cwbuf->b) - consumed);
+ if(result)
+ return result;
+ }
+ }
+ }
+ return result;
+}
+
+static CURLcode cw_out_flush_chain(struct cw_out_ctx *ctx,
+ struct Curl_easy *data,
+ struct cw_out_buf **pcwbuf,
+ bool flush_all)
+{
+ struct cw_out_buf *cwbuf = *pcwbuf;
+ CURLcode result;
+
+ if(!cwbuf)
+ return CURLE_OK;
+ if(data->req.keepon & KEEP_RECV_PAUSE)
+ return CURLE_OK;
+
+ /* write the end of the chain until it blocks or gets empty */
+ while(cwbuf->next) {
+ struct cw_out_buf **plast = &cwbuf->next;
+ while((*plast)->next)
+ plast = &(*plast)->next;
+ result = cw_out_flush_chain(ctx, data, plast, flush_all);
+ if(result)
+ return result;
+ if(*plast) {
+ /* could not write last, paused again? */
+ DEBUGASSERT(data->req.keepon & KEEP_RECV_PAUSE);
+ return CURLE_OK;
+ }
+ }
+
+ result = cw_out_buf_flush(ctx, data, cwbuf, flush_all);
+ if(result)
+ return result;
+ if(!Curl_dyn_len(&cwbuf->b)) {
+ cw_out_buf_free(cwbuf);
+ *pcwbuf = NULL;
+ }
+ return CURLE_OK;
+}
+
+static CURLcode cw_out_append(struct cw_out_ctx *ctx,
+ cw_out_type otype,
+ const char *buf, size_t blen)
+{
+ if(cw_out_bufs_len(ctx) + blen > DYN_PAUSE_BUFFER)
+ return CURLE_TOO_LARGE;
+
+ /* if we do not have a buffer, or it is of another type, make a new one.
+ * And for CW_OUT_HDS always make a new one, so we "replay" headers
+ * exactly as they came in */
+ if(!ctx->buf || (ctx->buf->type != otype) || (otype == CW_OUT_HDS)) {
+ struct cw_out_buf *cwbuf = cw_out_buf_create(otype);
+ if(!cwbuf)
+ return CURLE_OUT_OF_MEMORY;
+ cwbuf->next = ctx->buf;
+ ctx->buf = cwbuf;
+ }
+ DEBUGASSERT(ctx->buf && (ctx->buf->type == otype));
+ return Curl_dyn_addn(&ctx->buf->b, buf, blen);
+}
+
+static CURLcode cw_out_do_write(struct cw_out_ctx *ctx,
+ struct Curl_easy *data,
+ cw_out_type otype,
+ bool flush_all,
+ const char *buf, size_t blen)
+{
+ CURLcode result;
+
+ /* if we have buffered data and it is a different type than what
+ * we are writing now, try to flush all */
+ if(ctx->buf && ctx->buf->type != otype) {
+ result = cw_out_flush_chain(ctx, data, &ctx->buf, TRUE);
+ if(result)
+ return result;
+ }
+
+ if(ctx->buf) {
+ /* still have buffered data, append and flush */
+ result = cw_out_append(ctx, otype, buf, blen);
+ if(result)
+ return result;
+ result = cw_out_flush_chain(ctx, data, &ctx->buf, flush_all);
+ if(result)
+ return result;
+ }
+ else {
+ /* nothing buffered, try direct write */
+ size_t consumed;
+ result = cw_out_ptr_flush(ctx, data, otype, flush_all,
+ buf, blen, &consumed);
+ if(result)
+ return result;
+ if(consumed < blen) {
+ /* did not write all, append the rest */
+ result = cw_out_append(ctx, otype, buf + consumed, blen - consumed);
+ if(result)
+ return result;
+ }
+ }
+ return CURLE_OK;
+}
+
+static CURLcode cw_out_write(struct Curl_easy *data,
+ struct Curl_cwriter *writer, int type,
+ const char *buf, size_t blen)
+{
+ struct cw_out_ctx *ctx = writer->ctx;
+ CURLcode result;
+ bool flush_all;
+
+ flush_all = (type & CLIENTWRITE_EOS)? TRUE:FALSE;
+ if((type & CLIENTWRITE_BODY) ||
+ ((type & CLIENTWRITE_HEADER) && data->set.include_header)) {
+ result = cw_out_do_write(ctx, data, CW_OUT_BODY, flush_all, buf, blen);
+ if(result)
+ return result;
+ }
+
+ if(type & (CLIENTWRITE_HEADER|CLIENTWRITE_INFO)) {
+ result = cw_out_do_write(ctx, data, CW_OUT_HDS, flush_all, buf, blen);
+ if(result)
+ return result;
+ }
+
+ return CURLE_OK;
+}
+
+bool Curl_cw_out_is_paused(struct Curl_easy *data)
+{
+ struct Curl_cwriter *cw_out;
+ struct cw_out_ctx *ctx;
+
+ cw_out = Curl_cwriter_get_by_type(data, &Curl_cwt_out);
+ if(!cw_out)
+ return FALSE;
+
+ ctx = (struct cw_out_ctx *)cw_out;
+ return cw_out_bufs_len(ctx) > 0;
+}
+
+static CURLcode cw_out_flush(struct Curl_easy *data, bool flush_all)
+{
+ struct Curl_cwriter *cw_out;
+ CURLcode result = CURLE_OK;
+
+ cw_out = Curl_cwriter_get_by_type(data, &Curl_cwt_out);
+ if(cw_out) {
+ struct cw_out_ctx *ctx = (struct cw_out_ctx *)cw_out;
+
+ result = cw_out_flush_chain(ctx, data, &ctx->buf, flush_all);
+ }
+ return result;
+}
+
+CURLcode Curl_cw_out_flush(struct Curl_easy *data)
+{
+ return cw_out_flush(data, FALSE);
+}
+
+CURLcode Curl_cw_out_done(struct Curl_easy *data)
+{
+ return cw_out_flush(data, TRUE);
+}
diff --git a/Utilities/cmcurl/lib/cw-out.h b/Utilities/cmcurl/lib/cw-out.h
new file mode 100644
index 0000000..c13e853
--- /dev/null
+++ b/Utilities/cmcurl/lib/cw-out.h
@@ -0,0 +1,53 @@
+#ifndef HEADER_CURL_CW_OUT_H
+#define HEADER_CURL_CW_OUT_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#include "sendf.h"
+
+/**
+ * The client writer type "cw-out" that does the actual writing to
+ * the client callbacks. Intended to be the last installed in the
+ * client writer stack of a transfer.
+ */
+extern struct Curl_cwtype Curl_cwt_out;
+
+/**
+ * Return TRUE iff 'cw-out' client write has paused data.
+ */
+bool Curl_cw_out_is_paused(struct Curl_easy *data);
+
+/**
+ * Flush any buffered date to the client, chunk collation still applies.
+ */
+CURLcode Curl_cw_out_flush(struct Curl_easy *data);
+
+/**
+ * Mark EndOfStream reached and flush ALL data to the client.
+ */
+CURLcode Curl_cw_out_done(struct Curl_easy *data);
+
+#endif /* HEADER_CURL_CW_OUT_H */
diff --git a/Utilities/cmcurl/lib/dict.c b/Utilities/cmcurl/lib/dict.c
index 3239848..f377678 100644
--- a/Utilities/cmcurl/lib/dict.c
+++ b/Utilities/cmcurl/lib/dict.c
@@ -122,13 +122,12 @@ static char *unescape_word(const char *input)
}
/* sendf() sends formatted data to the server */
-static CURLcode sendf(curl_socket_t sockfd, struct Curl_easy *data,
- const char *fmt, ...) CURL_PRINTF(3, 4);
+static CURLcode sendf(struct Curl_easy *data,
+ const char *fmt, ...) CURL_PRINTF(2, 3);
-static CURLcode sendf(curl_socket_t sockfd, struct Curl_easy *data,
- const char *fmt, ...)
+static CURLcode sendf(struct Curl_easy *data, const char *fmt, ...)
{
- ssize_t bytes_written;
+ size_t bytes_written;
size_t write_len;
CURLcode result = CURLE_OK;
char *s;
@@ -146,7 +145,7 @@ static CURLcode sendf(curl_socket_t sockfd, struct Curl_easy *data,
for(;;) {
/* Write the buffer to the socket */
- result = Curl_write(data, sockfd, sptr, write_len, &bytes_written);
+ result = Curl_xfer_send(data, sptr, write_len, &bytes_written);
if(result)
break;
@@ -178,8 +177,6 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
char *nthdef = NULL; /* This is not part of the protocol, but required
by RFC 2229 */
CURLcode result;
- struct connectdata *conn = data->conn;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
char *path;
@@ -228,7 +225,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
goto error;
}
- result = sendf(sockfd, data,
+ result = sendf(data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"MATCH "
"%s " /* database */
@@ -243,7 +240,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
failf(data, "Failed sending DICT request");
goto error;
}
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1); /* no upload */
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1); /* no upload */
}
else if(strncasecompare(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
strncasecompare(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
@@ -276,7 +273,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
goto error;
}
- result = sendf(sockfd, data,
+ result = sendf(data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"DEFINE "
"%s " /* database */
@@ -289,7 +286,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
failf(data, "Failed sending DICT request");
goto error;
}
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
}
else {
@@ -302,7 +299,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
if(ppath[i] == ':')
ppath[i] = ' ';
}
- result = sendf(sockfd, data,
+ result = sendf(data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
"%s\r\n"
"QUIT\r\n", ppath);
@@ -311,7 +308,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
goto error;
}
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
}
}
diff --git a/Utilities/cmcurl/lib/doh.c b/Utilities/cmcurl/lib/doh.c
index ef32d50..33e7141 100644
--- a/Utilities/cmcurl/lib/doh.c
+++ b/Utilities/cmcurl/lib/doh.c
@@ -69,7 +69,12 @@ static const char *doh_strerror(DOHcode code)
return errors[code];
return "bad error code";
}
-#endif
+
+struct curl_trc_feat Curl_doh_trc = {
+ "DoH",
+ CURL_LOG_LVL_NONE,
+};
+#endif /* !CURL_DISABLE_VERBOSE_STRINGS */
/* @unittest 1655
*/
@@ -189,9 +194,9 @@ static int doh_done(struct Curl_easy *doh, CURLcode result)
struct dohdata *dohp = data->req.doh;
/* so one of the DoH request done for the 'data' transfer is now complete! */
dohp->pending--;
- infof(data, "a DoH request is completed, %u to go", dohp->pending);
+ infof(doh, "a DoH request is completed, %u to go", dohp->pending);
if(result)
- infof(data, "DoH request %s", curl_easy_strerror(result));
+ infof(doh, "DoH request %s", curl_easy_strerror(result));
if(!dohp->pending) {
/* DoH completed */
@@ -242,6 +247,9 @@ static CURLcode dohprobe(struct Curl_easy *data,
the gcc typecheck helpers */
struct dynbuf *resp = &p->serverdoh;
doh->state.internal = true;
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+ doh->state.feat = &Curl_doh_trc;
+#endif
ERROR_CHECK_SETOPT(CURLOPT_URL, url);
ERROR_CHECK_SETOPT(CURLOPT_DEFAULT_PROTOCOL, "https");
ERROR_CHECK_SETOPT(CURLOPT_WRITEFUNCTION, doh_write_cb);
@@ -264,7 +272,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
ERROR_CHECK_SETOPT(CURLOPT_SHARE, data->share);
if(data->set.err && data->set.err != stderr)
ERROR_CHECK_SETOPT(CURLOPT_STDERR, data->set.err);
- if(data->set.verbose)
+ if(Curl_trc_ft_is_verbose(data, &Curl_doh_trc))
ERROR_CHECK_SETOPT(CURLOPT_VERBOSE, 1L);
if(data->set.no_signal)
ERROR_CHECK_SETOPT(CURLOPT_NOSIGNAL, 1L);
@@ -741,11 +749,11 @@ static void showdoh(struct Curl_easy *data,
const struct dohentry *d)
{
int i;
- infof(data, "TTL: %u seconds", d->ttl);
+ infof(data, "[DoH] TTL: %u seconds", d->ttl);
for(i = 0; i < d->numaddr; i++) {
const struct dohaddr *a = &d->addr[i];
if(a->type == DNS_TYPE_A) {
- infof(data, "DoH A: %u.%u.%u.%u",
+ infof(data, "[DoH] A: %u.%u.%u.%u",
a->ip.v4[0], a->ip.v4[1],
a->ip.v4[2], a->ip.v4[3]);
}
@@ -754,9 +762,9 @@ static void showdoh(struct Curl_easy *data,
char buffer[128];
char *ptr;
size_t len;
- msnprintf(buffer, 128, "DoH AAAA: ");
- ptr = &buffer[10];
- len = 118;
+ len = msnprintf(buffer, 128, "[DoH] AAAA: ");
+ ptr = &buffer[len];
+ len = sizeof(buffer) - len;
for(j = 0; j < 16; j += 2) {
size_t l;
msnprintf(ptr, len, "%s%02x%02x", j?":":"", d->addr[i].ip.v6[j],
@@ -950,8 +958,11 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry *dns;
struct Curl_addrinfo *ai;
- infof(data, "DoH Host name: %s", dohp->host);
- showdoh(data, &de);
+
+ if(Curl_trc_ft_is_verbose(data, &Curl_doh_trc)) {
+ infof(data, "[DoH] Host name: %s", dohp->host);
+ showdoh(data, &de);
+ }
result = doh2ai(&de, dohp->host, dohp->port, &ai);
if(result) {
diff --git a/Utilities/cmcurl/lib/doh.h b/Utilities/cmcurl/lib/doh.h
index 7d7b694..ffcf7a0 100644
--- a/Utilities/cmcurl/lib/doh.h
+++ b/Utilities/cmcurl/lib/doh.h
@@ -120,6 +120,8 @@ void de_init(struct dohentry *d);
void de_cleanup(struct dohentry *d);
#endif
+extern struct curl_trc_feat Curl_doh_trc;
+
#else /* if DoH is disabled */
#define Curl_doh(a,b,c,d) NULL
#define Curl_doh_is_resolved(x,y) CURLE_COULDNT_RESOLVE_HOST
diff --git a/Utilities/cmcurl/lib/easy.c b/Utilities/cmcurl/lib/easy.c
index 067b6d7..dc48706 100644
--- a/Utilities/cmcurl/lib/easy.c
+++ b/Utilities/cmcurl/lib/easy.c
@@ -58,6 +58,7 @@
#include "multiif.h"
#include "select.h"
#include "cfilters.h"
+#include "cw-out.h"
#include "sendf.h" /* for failf function prototype */
#include "connect.h" /* for Curl_getconnectinfo */
#include "slist.h"
@@ -741,7 +742,6 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
multi = Curl_multi_handle(1, 3, 7);
if(!multi)
return CURLE_OUT_OF_MEMORY;
- data->multi_easy = multi;
}
if(multi->in_callback)
@@ -750,15 +750,18 @@ static CURLcode easy_perform(struct Curl_easy *data, bool events)
/* Copy the MAXCONNECTS option to the multi handle */
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)data->set.maxconnects);
+ data->multi_easy = NULL; /* pretend it does not exist */
mcode = curl_multi_add_handle(multi, data);
if(mcode) {
curl_multi_cleanup(multi);
- data->multi_easy = NULL;
if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY;
return CURLE_FAILED_INIT;
}
+ /* assign this after curl_multi_add_handle() */
+ data->multi_easy = multi;
+
sigpipe_ignore(data, &pipe_st);
/* run the transfer */
@@ -1021,7 +1024,6 @@ fail:
#ifndef CURL_DISABLE_COOKIES
free(outcurl->cookies);
#endif
- free(outcurl->state.buffer);
Curl_dyn_free(&outcurl->state.headerb);
Curl_altsvc_cleanup(&outcurl->asi);
Curl_hsts_cleanup(&outcurl->hsts);
@@ -1038,7 +1040,7 @@ fail:
*/
void curl_easy_reset(struct Curl_easy *data)
{
- Curl_free_request_state(data);
+ Curl_req_hard_reset(&data->req, data);
/* zero out UserDefined data: */
Curl_freeset(data);
@@ -1108,9 +1110,10 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
/* Unpause parts in active mime tree. */
if((k->keepon & ~newstate & KEEP_SEND_PAUSE) &&
(data->mstate == MSTATE_PERFORMING ||
- data->mstate == MSTATE_RATELIMITING) &&
- data->state.fread_func == (curl_read_callback) Curl_mime_read) {
- Curl_mime_unpause(data->state.in);
+ data->mstate == MSTATE_RATELIMITING)) {
+ result = Curl_creader_unpause(data);
+ if(result)
+ return result;
}
/* put it back in the keepon */
@@ -1118,21 +1121,11 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
if(!(newstate & KEEP_RECV_PAUSE)) {
Curl_conn_ev_data_pause(data, FALSE);
- result = Curl_client_unpause(data);
+ result = Curl_cw_out_flush(data);
if(result)
return result;
}
-#ifdef USE_HYPER
- if(!(newstate & KEEP_SEND_PAUSE)) {
- /* need to wake the send body waker */
- if(data->hyp.send_body_waker) {
- hyper_waker_wake(data->hyp.send_body_waker);
- data->hyp.send_body_waker = NULL;
- }
- }
-#endif
-
/* if there's no error and we're not pausing both directions, we want
to have this handle checked soon */
if((newstate & (KEEP_RECV_PAUSE|KEEP_SEND_PAUSE)) !=
@@ -1142,7 +1135,7 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
/* reset the too-slow time keeper */
data->state.keeps_speed.tv_sec = 0;
- if(!data->state.tempcount)
+ if(!Curl_cw_out_is_paused(data))
/* if not pausing again, force a recv/send check of this connection as
the data might've been read off the socket already */
data->state.select_bits = CURL_CSELECT_IN | CURL_CSELECT_OUT;
@@ -1166,9 +1159,11 @@ CURLcode curl_easy_pause(struct Curl_easy *data, int action)
}
-static CURLcode easy_connection(struct Curl_easy *data, curl_socket_t *sfd,
+static CURLcode easy_connection(struct Curl_easy *data,
struct connectdata **connp)
{
+ curl_socket_t sfd;
+
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
@@ -1178,9 +1173,9 @@ static CURLcode easy_connection(struct Curl_easy *data, curl_socket_t *sfd,
return CURLE_UNSUPPORTED_PROTOCOL;
}
- *sfd = Curl_getconnectinfo(data, connp);
+ sfd = Curl_getconnectinfo(data, connp);
- if(*sfd == CURL_SOCKET_BAD) {
+ if(sfd == CURL_SOCKET_BAD) {
failf(data, "Failed to get recent socket");
return CURLE_UNSUPPORTED_PROTOCOL;
}
@@ -1196,7 +1191,6 @@ static CURLcode easy_connection(struct Curl_easy *data, curl_socket_t *sfd,
CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen,
size_t *n)
{
- curl_socket_t sfd;
CURLcode result;
ssize_t n1;
struct connectdata *c;
@@ -1204,7 +1198,7 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen,
if(Curl_is_in_callback(data))
return CURLE_RECURSIVE_API_CALL;
- result = easy_connection(data, &sfd, &c);
+ result = easy_connection(data, &c);
if(result)
return result;
@@ -1214,7 +1208,7 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen,
Curl_attach_connection(data, c);
*n = 0;
- result = Curl_read(data, sfd, buffer, buflen, &n1);
+ result = Curl_conn_recv(data, FIRSTSOCKET, buffer, buflen, &n1);
if(result)
return result;
@@ -1226,11 +1220,10 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen,
#ifdef USE_WEBSOCKETS
CURLcode Curl_connect_only_attach(struct Curl_easy *data)
{
- curl_socket_t sfd;
CURLcode result;
struct connectdata *c = NULL;
- result = easy_connection(data, &sfd, &c);
+ result = easy_connection(data, &c);
if(result)
return result;
@@ -1249,15 +1242,14 @@ CURLcode Curl_connect_only_attach(struct Curl_easy *data)
* This is the private internal version of curl_easy_send()
*/
CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
- size_t buflen, ssize_t *n)
+ size_t buflen, size_t *n)
{
- curl_socket_t sfd;
CURLcode result;
- ssize_t n1;
struct connectdata *c = NULL;
SIGPIPE_VARIABLE(pipe_st);
- result = easy_connection(data, &sfd, &c);
+ *n = 0;
+ result = easy_connection(data, &c);
if(result)
return result;
@@ -1266,20 +1258,12 @@ CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
needs to be reattached */
Curl_attach_connection(data, c);
- *n = 0;
sigpipe_ignore(data, &pipe_st);
- result = Curl_write(data, sfd, buffer, buflen, &n1);
+ result = Curl_conn_send(data, FIRSTSOCKET, buffer, buflen, n);
sigpipe_restore(&pipe_st);
- if(n1 == -1)
+ if(result && result != CURLE_AGAIN)
return CURLE_SEND_ERROR;
-
- /* detect EAGAIN */
- if(!result && !n1)
- return CURLE_AGAIN;
-
- *n = n1;
-
return result;
}
@@ -1290,13 +1274,13 @@ CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer,
size_t buflen, size_t *n)
{
- ssize_t written = 0;
+ size_t written = 0;
CURLcode result;
if(Curl_is_in_callback(data))
return CURLE_RECURSIVE_API_CALL;
result = Curl_senddata(data, buffer, buflen, &written);
- *n = (size_t)written;
+ *n = written;
return result;
}
diff --git a/Utilities/cmcurl/lib/easygetopt.c b/Utilities/cmcurl/lib/easygetopt.c
index 2b8a521..a0239a8 100644
--- a/Utilities/cmcurl/lib/easygetopt.c
+++ b/Utilities/cmcurl/lib/easygetopt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* ___|___/|_| ______|
*
- * Copyright (C) Daniel Stenberg, <daniel.se>, et al.
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
diff --git a/Utilities/cmcurl/lib/easyif.h b/Utilities/cmcurl/lib/easyif.h
index 6448952..6ce3483 100644
--- a/Utilities/cmcurl/lib/easyif.h
+++ b/Utilities/cmcurl/lib/easyif.h
@@ -28,7 +28,7 @@
* Prototypes for library-wide functions provided by easy.c
*/
CURLcode Curl_senddata(struct Curl_easy *data, const void *buffer,
- size_t buflen, ssize_t *n);
+ size_t buflen, size_t *n);
#ifdef USE_WEBSOCKETS
CURLcode Curl_connect_only_attach(struct Curl_easy *data);
diff --git a/Utilities/cmcurl/lib/easyoptions.c b/Utilities/cmcurl/lib/easyoptions.c
index da4c611..9c4438a 100644
--- a/Utilities/cmcurl/lib/easyoptions.c
+++ b/Utilities/cmcurl/lib/easyoptions.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) Daniel Stenberg, <daniel.se>, et al.
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
diff --git a/Utilities/cmcurl/lib/file.c b/Utilities/cmcurl/lib/file.c
index b7ce3a8..bee9e92 100644
--- a/Utilities/cmcurl/lib/file.c
+++ b/Utilities/cmcurl/lib/file.c
@@ -59,6 +59,7 @@
#include "file.h"
#include "speedcheck.h"
#include "getinfo.h"
+#include "multiif.h"
#include "transfer.h"
#include "url.h"
#include "parsedate.h" /* for the week day and month names */
@@ -290,10 +291,12 @@ static CURLcode file_upload(struct Curl_easy *data)
int fd;
int mode;
CURLcode result = CURLE_OK;
- char buffer[8*1024], *uphere_save;
+ char *xfer_ulbuf;
+ size_t xfer_ulblen;
curl_off_t bytecount = 0;
struct_stat file_stat;
const char *sendbuf;
+ bool eos = FALSE;
/*
* Since FILE: doesn't do the full init, we need to provide some extra
@@ -337,15 +340,16 @@ static CURLcode file_upload(struct Curl_easy *data)
data->state.resume_from = (curl_off_t)file_stat.st_size;
}
- /* Yikes! Curl_fillreadbuffer uses data->req.upload_fromhere to READ
- * client data to! Please, someone fix... */
- uphere_save = data->req.upload_fromhere;
- while(!result) {
+ result = Curl_multi_xfer_ulbuf_borrow(data, &xfer_ulbuf, &xfer_ulblen);
+ if(result)
+ goto out;
+
+ while(!result && !eos) {
size_t nread;
ssize_t nwrite;
size_t readcount;
- data->req.upload_fromhere = buffer;
- result = Curl_fillreadbuffer(data, sizeof(buffer), &readcount);
+
+ result = Curl_client_read(data, xfer_ulbuf, xfer_ulblen, &readcount, &eos);
if(result)
break;
@@ -359,16 +363,16 @@ static CURLcode file_upload(struct Curl_easy *data)
if((curl_off_t)nread <= data->state.resume_from) {
data->state.resume_from -= nread;
nread = 0;
- sendbuf = buffer;
+ sendbuf = xfer_ulbuf;
}
else {
- sendbuf = buffer + data->state.resume_from;
+ sendbuf = xfer_ulbuf + data->state.resume_from;
nread -= (size_t)data->state.resume_from;
data->state.resume_from = 0;
}
}
else
- sendbuf = buffer;
+ sendbuf = xfer_ulbuf;
/* write the data to the target */
nwrite = write(fd, sendbuf, nread);
@@ -389,8 +393,9 @@ static CURLcode file_upload(struct Curl_easy *data)
if(!result && Curl_pgrsUpdate(data))
result = CURLE_ABORTED_BY_CALLBACK;
+out:
close(fd);
- data->req.upload_fromhere = uphere_save;
+ Curl_multi_xfer_ulbuf_release(data, xfer_ulbuf);
return result;
}
@@ -419,6 +424,8 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
bool fstated = FALSE;
int fd;
struct FILEPROTO *file;
+ char *xfer_buf;
+ size_t xfer_blen;
*done = TRUE; /* unconditionally */
@@ -541,25 +548,26 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
return CURLE_BAD_DOWNLOAD_RESUME;
}
- Curl_pgrsTime(data, TIMER_STARTTRANSFER);
+ result = Curl_multi_xfer_buf_borrow(data, &xfer_buf, &xfer_blen);
+ if(result)
+ goto out;
while(!result) {
- char tmpbuf[8*1024];
ssize_t nread;
/* Don't fill a whole buffer if we want less than all data */
size_t bytestoread;
if(size_known) {
- bytestoread = (expected_size < (curl_off_t)(sizeof(tmpbuf)-1)) ?
- curlx_sotouz(expected_size) : (sizeof(tmpbuf)-1);
+ bytestoread = (expected_size < (curl_off_t)(xfer_blen-1)) ?
+ curlx_sotouz(expected_size) : (xfer_blen-1);
}
else
- bytestoread = sizeof(tmpbuf)-1;
+ bytestoread = xfer_blen-1;
- nread = read(fd, tmpbuf, bytestoread);
+ nread = read(fd, xfer_buf, bytestoread);
if(nread > 0)
- tmpbuf[nread] = 0;
+ xfer_buf[nread] = 0;
if(nread <= 0 || (size_known && (expected_size == 0)))
break;
@@ -567,18 +575,22 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
if(size_known)
expected_size -= nread;
- result = Curl_client_write(data, CLIENTWRITE_BODY, tmpbuf, nread);
+ result = Curl_client_write(data, CLIENTWRITE_BODY, xfer_buf, nread);
if(result)
- return result;
+ goto out;
if(Curl_pgrsUpdate(data))
result = CURLE_ABORTED_BY_CALLBACK;
else
result = Curl_speedcheck(data, Curl_now());
+ if(result)
+ goto out;
}
if(Curl_pgrsUpdate(data))
result = CURLE_ABORTED_BY_CALLBACK;
+out:
+ Curl_multi_xfer_buf_release(data, xfer_buf);
return result;
}
diff --git a/Utilities/cmcurl/lib/fopen.c b/Utilities/cmcurl/lib/fopen.c
index 851279f..0bdf2e1 100644
--- a/Utilities/cmcurl/lib/fopen.c
+++ b/Utilities/cmcurl/lib/fopen.c
@@ -129,7 +129,12 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
}
result = CURLE_WRITE_ERROR;
+#if (defined(ANDROID) || defined(__ANDROID__)) && \
+ (defined(__i386__) || defined(__arm__))
+ fd = open(tempstore, O_WRONLY | O_CREAT | O_EXCL, (mode_t)(0600|sb.st_mode));
+#else
fd = open(tempstore, O_WRONLY | O_CREAT | O_EXCL, 0600|sb.st_mode);
+#endif
if(fd == -1)
goto fail;
diff --git a/Utilities/cmcurl/lib/ftp.c b/Utilities/cmcurl/lib/ftp.c
index 58d6e1d..da0d060 100644
--- a/Utilities/cmcurl/lib/ftp.c
+++ b/Utilities/cmcurl/lib/ftp.c
@@ -85,6 +85,14 @@
#define INET_ADDRSTRLEN 16
#endif
+/* macro to check for a three-digit ftp status code at the start of the
+ given string */
+#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
+ ISDIGIT(line[2]))
+
+/* macro to check for the last line in an FTP server response */
+#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))
+
#ifdef CURL_DISABLE_VERBOSE_STRINGS
#define ftp_pasv_verbose(a,b,c,d) Curl_nop_stmt
#endif
@@ -143,7 +151,7 @@ static CURLcode wc_statemach(struct Curl_easy *data);
static void wc_data_dtor(void *ptr);
static CURLcode ftp_state_retr(struct Curl_easy *data, curl_off_t filesize);
static CURLcode ftp_readresp(struct Curl_easy *data,
- curl_socket_t sockfd,
+ int sockindex,
struct pingpong *pp,
int *ftpcode,
size_t *size);
@@ -247,6 +255,98 @@ static void freedirs(struct ftp_conn *ftpc)
Curl_safefree(ftpc->newhost);
}
+#ifdef CURL_DO_LINEEND_CONV
+/***********************************************************************
+ *
+ * Lineend Conversions
+ * On ASCII transfers, e.g. directory listings, we might get lines
+ * ending in '\r\n' and we prefer just '\n'.
+ * We might also get a lonely '\r' which we convert into a '\n'.
+ */
+struct ftp_cw_lc_ctx {
+ struct Curl_cwriter super;
+ bool newline_pending;
+};
+
+static CURLcode ftp_cw_lc_write(struct Curl_easy *data,
+ struct Curl_cwriter *writer, int type,
+ const char *buf, size_t blen)
+{
+ static const char nl = '\n';
+ struct ftp_cw_lc_ctx *ctx = writer->ctx;
+
+ if(!(type & CLIENTWRITE_BODY) ||
+ data->conn->proto.ftpc.transfertype != 'A')
+ return Curl_cwriter_write(data, writer->next, type, buf, blen);
+
+ /* ASCII mode BODY data, convert lineends */
+ while(blen) {
+ /* do not pass EOS when writing parts */
+ int chunk_type = (type & ~CLIENTWRITE_EOS);
+ const char *cp;
+ size_t chunk_len;
+ CURLcode result;
+
+ if(ctx->newline_pending) {
+ if(buf[0] != '\n') {
+ /* previous chunk ended in '\r' and we do not see a '\n' in this one,
+ * need to write a newline. */
+ result = Curl_cwriter_write(data, writer->next, chunk_type, &nl, 1);
+ if(result)
+ return result;
+ }
+ /* either we just wrote the newline or it is part of the next
+ * chunk of bytes we write. */
+ data->state.crlf_conversions++;
+ ctx->newline_pending = FALSE;
+ }
+
+ cp = memchr(buf, '\r', blen);
+ if(!cp)
+ break;
+
+ /* write the bytes before the '\r', excluding the '\r' */
+ chunk_len = cp - buf;
+ if(chunk_len) {
+ result = Curl_cwriter_write(data, writer->next, chunk_type,
+ buf, chunk_len);
+ if(result)
+ return result;
+ }
+ /* skip the '\r', we now have a newline pending */
+ buf = cp + 1;
+ blen = blen - chunk_len - 1;
+ ctx->newline_pending = TRUE;
+ }
+
+ /* Any remaining data does not contain a '\r' */
+ if(blen) {
+ DEBUGASSERT(!ctx->newline_pending);
+ return Curl_cwriter_write(data, writer->next, type, buf, blen);
+ }
+ else if(type & CLIENTWRITE_EOS) {
+ /* EndOfStream, if we have a trailing cr, now is the time to write it */
+ if(ctx->newline_pending) {
+ ctx->newline_pending = FALSE;
+ data->state.crlf_conversions++;
+ return Curl_cwriter_write(data, writer->next, type, &nl, 1);
+ }
+ /* Always pass on the EOS type indicator */
+ return Curl_cwriter_write(data, writer->next, type, buf, 0);
+ }
+ return CURLE_OK;
+}
+
+static const struct Curl_cwtype ftp_cw_lc = {
+ "ftp-lineconv",
+ NULL,
+ Curl_cwriter_def_init,
+ ftp_cw_lc_write,
+ Curl_cwriter_def_close,
+ sizeof(struct ftp_cw_lc_ctx)
+};
+
+#endif /* CURL_DO_LINEEND_CONV */
/***********************************************************************
*
* AcceptServerConnect()
@@ -412,8 +512,32 @@ static CURLcode ReceivedServerConnect(struct Curl_easy *data, bool *received)
}
if(response) {
infof(data, "Ctrl conn has data while waiting for data conn");
+ if(pp->overflow > 3) {
+ char *r = Curl_dyn_ptr(&pp->recvbuf);
+
+ DEBUGASSERT((pp->overflow + pp->nfinal) <=
+ Curl_dyn_len(&pp->recvbuf));
+ /* move over the most recently handled response line */
+ r += pp->nfinal;
+
+ if(LASTLINE(r)) {
+ int status = curlx_sltosi(strtol(r, NULL, 10));
+ if(status == 226) {
+ /* funny timing situation where we get the final message on the
+ control connection before traffic on the data connection has been
+ noticed. Leave the 226 in there and use this as a trigger to read
+ the data socket. */
+ infof(data, "Got 226 before data activity");
+ *received = TRUE;
+ return CURLE_OK;
+ }
+ }
+ }
+
(void)Curl_GetFTPResponse(data, &nread, &ftpcode);
+ infof(data, "FTP code: %03d", ftpcode);
+
if(ftpcode/100 > 3)
return CURLE_FTP_ACCEPT_FAILED;
@@ -457,12 +581,12 @@ static CURLcode InitiateTransfer(struct Curl_easy *data)
/* set the SO_SNDBUF for the secondary socket for those who need it */
Curl_sndbufset(conn->sock[SECONDARYSOCKET]);
- Curl_setup_transfer(data, -1, -1, FALSE, SECONDARYSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, SECONDARYSOCKET);
}
else {
/* FTP download: */
- Curl_setup_transfer(data, SECONDARYSOCKET,
- conn->proto.ftpc.retr_size_saved, FALSE, -1);
+ Curl_xfer_setup(data, SECONDARYSOCKET,
+ conn->proto.ftpc.retr_size_saved, FALSE, -1);
}
conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */
@@ -525,14 +649,6 @@ out:
return result;
}
-/* macro to check for a three-digit ftp status code at the start of the
- given string */
-#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \
- ISDIGIT(line[2]))
-
-/* macro to check for the last line in an FTP server response */
-#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3]))
-
static bool ftp_endofresp(struct Curl_easy *data, struct connectdata *conn,
char *line, size_t len, int *code)
{
@@ -548,13 +664,13 @@ static bool ftp_endofresp(struct Curl_easy *data, struct connectdata *conn,
}
static CURLcode ftp_readresp(struct Curl_easy *data,
- curl_socket_t sockfd,
+ int sockindex,
struct pingpong *pp,
int *ftpcode, /* return the ftp-code if done */
size_t *size) /* size of the response */
{
int code;
- CURLcode result = Curl_pp_readresp(data, sockfd, pp, &code, size);
+ CURLcode result = Curl_pp_readresp(data, sockindex, pp, &code, size);
#ifdef HAVE_GSSAPI
{
@@ -689,7 +805,7 @@ CURLcode Curl_GetFTPResponse(struct Curl_easy *data,
break;
}
}
- result = ftp_readresp(data, sockfd, pp, ftpcode, &nread);
+ result = ftp_readresp(data, FIRSTSOCKET, pp, ftpcode, &nread);
if(result)
break;
@@ -821,24 +937,18 @@ static int ftp_domore_getsock(struct Curl_easy *data,
* remote site, or we could wait for that site to connect to us. Or just
* handle ordinary commands.
*/
-
DEBUGF(infof(data, "ftp_domore_getsock()"));
- if(conn->cfilter[SECONDARYSOCKET]
- && !Curl_conn_is_connected(conn, SECONDARYSOCKET))
- return 0;
if(FTP_STOP == ftpc->state) {
- int bits = GETSOCK_READSOCK(0);
-
/* if stopped and still in this state, then we're also waiting for a
connect on the secondary connection */
+ DEBUGASSERT(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD ||
+ (conn->cfilter[SECONDARYSOCKET] &&
+ !Curl_conn_is_connected(conn, SECONDARYSOCKET)));
socks[0] = conn->sock[FIRSTSOCKET];
- if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
- socks[1] = conn->sock[SECONDARYSOCKET];
- bits |= GETSOCK_WRITESOCK(1) | GETSOCK_READSOCK(1);
- }
-
- return bits;
+ /* An unconnected SECONDARY will add its socket by itself
+ * via its adjust_pollset() */
+ return GETSOCK_READSOCK(0);
}
return Curl_pp_getsock(data, &conn->proto.ftpc.pp, socks);
}
@@ -1179,6 +1289,12 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
conn->bits.ftp_use_eprt = TRUE;
#endif
+ /* Replace any filter on SECONDARY with one listening on this socket */
+ result = Curl_conn_tcp_listen_set(data, conn, SECONDARYSOCKET, &portsock);
+ if(result)
+ goto out;
+ portsock = CURL_SOCKET_BAD; /* now held in filter */
+
for(; fcmd != DONE; fcmd++) {
if(!conn->bits.ftp_use_eprt && (EPRT == fcmd))
@@ -1252,11 +1368,6 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data,
/* store which command was sent */
ftpc->count1 = fcmd;
- /* Replace any filter on SECONDARY with one listening on this socket */
- result = Curl_conn_tcp_listen_set(data, conn, SECONDARYSOCKET, &portsock);
- if(result)
- goto out;
- portsock = CURL_SOCKET_BAD; /* now held in filter */
ftp_state(data, FTP_PORT);
out:
@@ -1572,10 +1683,10 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
append = TRUE;
/* Let's read off the proper amount of bytes from the input. */
- if(conn->seek_func) {
+ if(data->set.seek_func) {
Curl_set_in_callback(data, true);
- seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
- SEEK_SET);
+ seekerr = data->set.seek_func(data->set.seek_client,
+ data->state.resume_from, SEEK_SET);
Curl_set_in_callback(data, false);
}
@@ -1614,7 +1725,7 @@ static CURLcode ftp_state_ul_setup(struct Curl_easy *data,
infof(data, "File already completely uploaded");
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
/* Set ->transfer so that we won't get any error in
* ftp_done() because we didn't transfer anything! */
@@ -1792,7 +1903,7 @@ static char *control_address(struct connectdata *conn)
if(conn->bits.tunnel_proxy || conn->bits.socksproxy)
return conn->host.name;
#endif
- return conn->primary_ip;
+ return conn->primary.remote_ip;
}
static bool match_pasv_6nums(const char *p,
@@ -1929,14 +2040,14 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
*/
const char * const host_name = conn->bits.socksproxy ?
conn->socks_proxy.host.name : conn->http_proxy.host.name;
- rc = Curl_resolv(data, host_name, conn->port, FALSE, &addr);
+ rc = Curl_resolv(data, host_name, conn->primary.remote_port, FALSE, &addr);
if(rc == CURLRESOLV_PENDING)
/* BLOCKING, ignores the return code but 'addr' will be NULL in
case of failure */
(void)Curl_resolver_wait_resolv(data, &addr);
- connectport =
- (unsigned short)conn->port; /* we connect to the proxy's port */
+ /* we connect to the proxy's port */
+ connectport = (unsigned short)conn->primary.remote_port;
if(!addr) {
failf(data, "Can't resolve proxy host %s:%hu", host_name, connectport);
@@ -2285,7 +2396,7 @@ static CURLcode ftp_state_retr(struct Curl_easy *data,
if(ftp->downloadsize == 0) {
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded");
/* Set ->transfer so that we won't get any error in ftp_done()
@@ -2692,7 +2803,6 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
struct connectdata *conn)
{
CURLcode result;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
int ftpcode;
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct pingpong *pp = &ftpc->pp;
@@ -2702,7 +2812,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
if(pp->sendleft)
return Curl_pp_flushsend(data, pp);
- result = ftp_readresp(data, sock, pp, &ftpcode, &nread);
+ result = ftp_readresp(data, FIRSTSOCKET, pp, &ftpcode, &nread);
if(result)
return result;
@@ -3702,7 +3812,7 @@ static CURLcode ftp_do_more(struct Curl_easy *data, int *completep)
}
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
if(!ftpc->wait_data_conn) {
/* no waiting for the data connection so this is now complete */
@@ -4011,6 +4121,24 @@ static CURLcode ftp_do(struct Curl_easy *data, bool *done)
*done = FALSE; /* default to false */
ftpc->wait_data_conn = FALSE; /* default to no such wait */
+#ifdef CURL_DO_LINEEND_CONV
+ {
+ /* FTP data may need conversion. */
+ struct Curl_cwriter *ftp_lc_writer;
+
+ result = Curl_cwriter_create(&ftp_lc_writer, data, &ftp_cw_lc,
+ CURL_CW_CONTENT_DECODE);
+ if(result)
+ return result;
+
+ result = Curl_cwriter_add(data, ftp_lc_writer);
+ if(result) {
+ Curl_cwriter_free(data, ftp_lc_writer);
+ return result;
+ }
+ }
+#endif /* CURL_DO_LINEEND_CONV */
+
if(data->state.wildcardmatch) {
result = wc_statemach(data);
if(data->wildcard->state == CURLWC_SKIP ||
@@ -4287,7 +4415,7 @@ static CURLcode ftp_dophase_done(struct Curl_easy *data, bool connected)
if(ftp->transfer != PPTRANSFER_BODY)
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
else if(!connected)
/* since we didn't connect now, we want do_more to get called */
conn->bits.do_more = TRUE;
diff --git a/Utilities/cmcurl/lib/getinfo.c b/Utilities/cmcurl/lib/getinfo.c
index 2f74629..dd43643 100644
--- a/Utilities/cmcurl/lib/getinfo.c
+++ b/Utilities/cmcurl/lib/getinfo.c
@@ -76,10 +76,10 @@ CURLcode Curl_initinfo(struct Curl_easy *data)
free(info->wouldredirect);
info->wouldredirect = NULL;
- info->conn_primary_ip[0] = '\0';
- info->conn_local_ip[0] = '\0';
- info->conn_primary_port = 0;
- info->conn_local_port = 0;
+ info->primary.remote_ip[0] = '\0';
+ info->primary.local_ip[0] = '\0';
+ info->primary.remote_port = 0;
+ info->primary.local_port = 0;
info->retry_after = 0;
info->conn_scheme = 0;
@@ -153,12 +153,12 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
break;
case CURLINFO_PRIMARY_IP:
/* Return the ip address of the most recent (primary) connection */
- *param_charp = data->info.conn_primary_ip;
+ *param_charp = data->info.primary.remote_ip;
break;
case CURLINFO_LOCAL_IP:
/* Return the source/local ip address of the most recent (primary)
connection */
- *param_charp = data->info.conn_local_ip;
+ *param_charp = data->info.primary.local_ip;
break;
case CURLINFO_RTSP_SESSION_ID:
*param_charp = data->set.str[STRING_RTSP_SESSION_ID];
@@ -180,7 +180,6 @@ static CURLcode getinfo_char(struct Curl_easy *data, CURLINFO info,
*param_charp = NULL;
#endif
break;
-
default:
return CURLE_UNKNOWN_OPTION;
}
@@ -285,11 +284,11 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
break;
case CURLINFO_PRIMARY_PORT:
/* Return the (remote) port of the most recent (primary) connection */
- *param_longp = data->info.conn_primary_port;
+ *param_longp = data->info.primary.remote_port;
break;
case CURLINFO_LOCAL_PORT:
/* Return the local port of the most recent (primary) connection */
- *param_longp = data->info.conn_local_port;
+ *param_longp = data->info.primary.local_port;
break;
case CURLINFO_PROXY_ERROR:
*param_longp = (long)data->info.pxcode;
@@ -334,6 +333,15 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
case CURLINFO_PROTOCOL:
*param_longp = data->info.conn_protocol;
break;
+ case CURLINFO_USED_PROXY:
+ *param_longp =
+#ifdef CURL_DISABLE_PROXY
+ 0
+#else
+ data->info.used_proxy
+#endif
+ ;
+ break;
default:
return CURLE_UNKNOWN_OPTION;
}
diff --git a/Utilities/cmcurl/lib/gopher.c b/Utilities/cmcurl/lib/gopher.c
index 9ca0828..e1a1ba6 100644
--- a/Utilities/cmcurl/lib/gopher.c
+++ b/Utilities/cmcurl/lib/gopher.c
@@ -139,8 +139,8 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
char *sel = NULL;
char *sel_org = NULL;
timediff_t timeout_ms;
- ssize_t amount, k;
- size_t len;
+ ssize_t k;
+ size_t amount, len;
int what;
*done = TRUE; /* unconditionally */
@@ -185,7 +185,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
if(strlen(sel) < 1)
break;
- result = Curl_nwrite(data, FIRSTSOCKET, sel, k, &amount);
+ result = Curl_xfer_send(data, sel, k, &amount);
if(!result) { /* Which may not have written it all! */
result = Curl_client_write(data, CLIENTWRITE_HEADER, sel, amount);
if(result)
@@ -227,7 +227,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
free(sel_org);
if(!result)
- result = Curl_nwrite(data, FIRSTSOCKET, "\r\n", 2, &amount);
+ result = Curl_xfer_send(data, "\r\n", 2, &amount);
if(result) {
failf(data, "Failed sending Gopher request");
return result;
@@ -236,7 +236,7 @@ static CURLcode gopher_do(struct Curl_easy *data, bool *done)
if(result)
return result;
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
return CURLE_OK;
}
#endif /* CURL_DISABLE_GOPHER */
diff --git a/Utilities/cmcurl/lib/headers.c b/Utilities/cmcurl/lib/headers.c
index 8a3264a..0c53dec 100644
--- a/Utilities/cmcurl/lib/headers.c
+++ b/Utilities/cmcurl/lib/headers.c
@@ -27,6 +27,7 @@
#include "urldata.h"
#include "strdup.h"
#include "strcase.h"
+#include "sendf.h"
#include "headers.h"
/* The last 3 #include files should be in this order */
@@ -337,14 +338,68 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
}
/*
- * Curl_headers_init(). Init the headers subsystem.
+ * Curl_headers_reset(). Reset the headers subsystem.
*/
-static void headers_init(struct Curl_easy *data)
+static void headers_reset(struct Curl_easy *data)
{
Curl_llist_init(&data->state.httphdrs, NULL);
data->state.prevhead = NULL;
}
+struct hds_cw_collect_ctx {
+ struct Curl_cwriter super;
+};
+
+static CURLcode hds_cw_collect_write(struct Curl_easy *data,
+ struct Curl_cwriter *writer, int type,
+ const char *buf, size_t blen)
+{
+ if((type & CLIENTWRITE_HEADER) && !(type & CLIENTWRITE_STATUS)) {
+ unsigned char htype = (unsigned char)
+ (type & CLIENTWRITE_CONNECT ? CURLH_CONNECT :
+ (type & CLIENTWRITE_1XX ? CURLH_1XX :
+ (type & CLIENTWRITE_TRAILER ? CURLH_TRAILER :
+ CURLH_HEADER)));
+ CURLcode result = Curl_headers_push(data, buf, htype);
+ if(result)
+ return result;
+ }
+ return Curl_cwriter_write(data, writer->next, type, buf, blen);
+}
+
+static const struct Curl_cwtype hds_cw_collect = {
+ "hds-collect",
+ NULL,
+ Curl_cwriter_def_init,
+ hds_cw_collect_write,
+ Curl_cwriter_def_close,
+ sizeof(struct hds_cw_collect_ctx)
+};
+
+CURLcode Curl_headers_init(struct Curl_easy *data)
+{
+ struct Curl_cwriter *writer;
+ CURLcode result;
+
+ if(data->conn && (data->conn->handler->protocol & PROTO_FAMILY_HTTP)) {
+ /* avoid installing it twice */
+ if(Curl_cwriter_get_by_name(data, hds_cw_collect.name))
+ return CURLE_OK;
+
+ result = Curl_cwriter_create(&writer, data, &hds_cw_collect,
+ CURL_CW_PROTOCOL);
+ if(result)
+ return result;
+
+ result = Curl_cwriter_add(data, writer);
+ if(result) {
+ Curl_cwriter_free(data, writer);
+ return result;
+ }
+ }
+ return CURLE_OK;
+}
+
/*
* Curl_headers_cleanup(). Free all stored headers and associated memory.
*/
@@ -358,7 +413,7 @@ CURLcode Curl_headers_cleanup(struct Curl_easy *data)
n = e->next;
free(hs);
}
- headers_init(data);
+ headers_reset(data);
return CURLE_OK;
}
diff --git a/Utilities/cmcurl/lib/headers.h b/Utilities/cmcurl/lib/headers.h
index a5229ea..d981338 100644
--- a/Utilities/cmcurl/lib/headers.h
+++ b/Utilities/cmcurl/lib/headers.h
@@ -37,6 +37,12 @@ struct Curl_header_store {
};
/*
+ * Initialize header collecting for a transfer.
+ * Will add a client writer that catches CLIENTWRITE_HEADER writes.
+ */
+CURLcode Curl_headers_init(struct Curl_easy *data);
+
+/*
* Curl_headers_push() gets passed a full header to store.
*/
CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
@@ -48,6 +54,7 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
CURLcode Curl_headers_cleanup(struct Curl_easy *data);
#else
+#define Curl_headers_init(x) CURLE_OK
#define Curl_headers_push(x,y,z) CURLE_OK
#define Curl_headers_cleanup(x) Curl_nop_stmt
#endif
diff --git a/Utilities/cmcurl/lib/hostip.c b/Utilities/cmcurl/lib/hostip.c
index 4f44d34..442817d 100644
--- a/Utilities/cmcurl/lib/hostip.c
+++ b/Utilities/cmcurl/lib/hostip.c
@@ -288,7 +288,7 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
size_t entry_len = create_hostcache_id(hostname, 0, port,
entry_id, sizeof(entry_id));
- /* See if its already in our dns cache */
+ /* See if it's already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
/* No entry found in cache, check if we might have a wildcard entry */
diff --git a/Utilities/cmcurl/lib/hsts.c b/Utilities/cmcurl/lib/hsts.c
index 8725a35..607755e 100644
--- a/Utilities/cmcurl/lib/hsts.c
+++ b/Utilities/cmcurl/lib/hsts.c
@@ -511,7 +511,6 @@ static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h)
static CURLcode hsts_load(struct hsts *h, const char *file)
{
CURLcode result = CURLE_OK;
- char *line = NULL;
FILE *fp;
/* we need a private copy of the file name so that the hsts cache file
@@ -523,11 +522,10 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
fp = fopen(file, FOPEN_READTEXT);
if(fp) {
- line = malloc(MAX_HSTS_LINE);
- if(!line)
- goto fail;
- while(Curl_get_line(line, MAX_HSTS_LINE, fp)) {
- char *lineptr = line;
+ struct dynbuf buf;
+ Curl_dyn_init(&buf, MAX_HSTS_LINE);
+ while(Curl_get_line(&buf, fp)) {
+ char *lineptr = Curl_dyn_ptr(&buf);
while(*lineptr && ISBLANK(*lineptr))
lineptr++;
if(*lineptr == '#')
@@ -536,15 +534,10 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
hsts_add(h, lineptr);
}
- free(line); /* free the line buffer */
+ Curl_dyn_free(&buf); /* free the line buffer */
fclose(fp);
}
return result;
-
-fail:
- Curl_safefree(h->filename);
- fclose(fp);
- return CURLE_OUT_OF_MEMORY;
}
/*
diff --git a/Utilities/cmcurl/lib/http.c b/Utilities/cmcurl/lib/http.c
index 679931e..92c04e6 100644
--- a/Utilities/cmcurl/lib/http.c
+++ b/Utilities/cmcurl/lib/http.c
@@ -73,6 +73,7 @@
#include "hostip.h"
#include "dynhds.h"
#include "http.h"
+#include "headers.h"
#include "select.h"
#include "parsedate.h" /* for the week day and month names */
#include "strtoofft.h"
@@ -101,6 +102,9 @@
*/
static bool http_should_fail(struct Curl_easy *data);
+static bool http_exp100_is_waiting(struct Curl_easy *data);
+static CURLcode http_exp100_add_reader(struct Curl_easy *data);
+static void http_exp100_send_anyway(struct Curl_easy *data);
/*
* HTTP handler interface.
@@ -404,150 +408,88 @@ static bool pickoneauth(struct auth *pick, unsigned long mask)
/*
* http_perhapsrewind()
*
- * If we are doing POST or PUT {
- * If we have more data to send {
- * If we are doing NTLM {
- * Keep sending since we must not disconnect
- * }
- * else {
- * If there is more than just a little data left to send, close
- * the current connection by force.
- * }
- * }
- * If we have sent any data {
- * If we don't have track of all the data {
- * call app to tell it to rewind
- * }
- * else {
- * rewind internally so that the operation can restart fine
- * }
- * }
- * }
+ * The current request needs to be done again - maybe due to a follow
+ * or authentication negotiation. Check if:
+ * 1) a rewind of the data sent to the server is necessary
+ * 2) the current transfer should continue or be stopped early
*/
static CURLcode http_perhapsrewind(struct Curl_easy *data,
struct connectdata *conn)
{
- struct HTTP *http = data->req.p.http;
- curl_off_t bytessent;
- curl_off_t expectsend = -1; /* default is unknown */
-
- if(!http)
- /* If this is still NULL, we have not reach very far and we can safely
- skip this rewinding stuff */
+ curl_off_t bytessent = data->req.writebytecount;
+ curl_off_t expectsend = Curl_creader_total_length(data);
+ curl_off_t upload_remain = (expectsend >= 0)? (expectsend - bytessent) : -1;
+ bool little_upload_remains = (upload_remain >= 0 && upload_remain < 2000);
+ bool needs_rewind = Curl_creader_needs_rewind(data);
+ /* By default, we'd like to abort the transfer when little or
+ * unknown amount remains. But this may be overridden by authentications
+ * further below! */
+ bool abort_upload = (!data->req.upload_done && !little_upload_remains);
+ const char *ongoing_auth = NULL;
+
+ /* We need a rewind before uploading client read data again. The
+ * checks below just influence of the upload is to be continued
+ * or aborted early.
+ * This depends on how much remains to be sent and in what state
+ * the authentication is. Some auth schemes such as NTLM do not work
+ * for a new connection. */
+ if(needs_rewind) {
+ infof(data, "Need to rewind upload for next request");
+ Curl_creader_set_rewind(data, TRUE);
+ }
+
+ if(conn->bits.close)
+ /* If we already decided to close this connection, we cannot veto. */
return CURLE_OK;
- switch(data->state.httpreq) {
- case HTTPREQ_GET:
- case HTTPREQ_HEAD:
- return CURLE_OK;
- default:
- break;
- }
-
- bytessent = data->req.writebytecount;
-
- if(conn->bits.authneg) {
- /* This is a state where we are known to be negotiating and we don't send
- any data then. */
- expectsend = 0;
- }
- else if(!conn->bits.protoconnstart) {
- /* HTTP CONNECT in progress: there is no body */
- expectsend = 0;
- }
- else {
- /* figure out how much data we are expected to send */
- switch(data->state.httpreq) {
- case HTTPREQ_POST:
- case HTTPREQ_PUT:
- if(data->state.infilesize != -1)
- expectsend = data->state.infilesize;
- break;
- case HTTPREQ_POST_FORM:
- case HTTPREQ_POST_MIME:
- expectsend = http->postsize;
- break;
- default:
- break;
- }
- }
-
- data->state.rewindbeforesend = FALSE; /* default */
-
- if((expectsend == -1) || (expectsend > bytessent)) {
+ if(abort_upload) {
+ /* We'd like to abort the upload - but should we? */
#if defined(USE_NTLM)
- /* There is still data left to send */
if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
(data->state.authhost.picked == CURLAUTH_NTLM) ||
(data->state.authproxy.picked == CURLAUTH_NTLM_WB) ||
(data->state.authhost.picked == CURLAUTH_NTLM_WB)) {
- if(((expectsend - bytessent) < 2000) ||
- (conn->http_ntlm_state != NTLMSTATE_NONE) ||
+ ongoing_auth = "NTML";
+ if((conn->http_ntlm_state != NTLMSTATE_NONE) ||
(conn->proxy_ntlm_state != NTLMSTATE_NONE)) {
- /* The NTLM-negotiation has started *OR* there is just a little (<2K)
- data left to send, keep on sending. */
-
- /* rewind data when completely done sending! */
- if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
- data->state.rewindbeforesend = TRUE;
- infof(data, "Rewind stream before next send");
- }
-
- return CURLE_OK;
+ /* The NTLM-negotiation has started, keep on sending.
+ * Need to do further work on same connection */
+ abort_upload = FALSE;
}
-
- if(conn->bits.close)
- /* this is already marked to get closed */
- return CURLE_OK;
-
- infof(data, "NTLM send, close instead of sending %"
- CURL_FORMAT_CURL_OFF_T " bytes",
- (curl_off_t)(expectsend - bytessent));
}
#endif
#if defined(USE_SPNEGO)
/* There is still data left to send */
if((data->state.authproxy.picked == CURLAUTH_NEGOTIATE) ||
(data->state.authhost.picked == CURLAUTH_NEGOTIATE)) {
- if(((expectsend - bytessent) < 2000) ||
- (conn->http_negotiate_state != GSS_AUTHNONE) ||
+ ongoing_auth = "NEGOTIATE";
+ if((conn->http_negotiate_state != GSS_AUTHNONE) ||
(conn->proxy_negotiate_state != GSS_AUTHNONE)) {
- /* The NEGOTIATE-negotiation has started *OR*
- there is just a little (<2K) data left to send, keep on sending. */
-
- /* rewind data when completely done sending! */
- if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) {
- data->state.rewindbeforesend = TRUE;
- infof(data, "Rewind stream before next send");
- }
-
- return CURLE_OK;
+ /* The NEGOTIATE-negotiation has started, keep on sending.
+ * Need to do further work on same connection */
+ abort_upload = FALSE;
}
-
- if(conn->bits.close)
- /* this is already marked to get closed */
- return CURLE_OK;
-
- infof(data, "NEGOTIATE send, close instead of sending %"
- CURL_FORMAT_CURL_OFF_T " bytes",
- (curl_off_t)(expectsend - bytessent));
}
#endif
+ }
- /* This is not NEGOTIATE/NTLM or many bytes left to send: close */
+ if(abort_upload) {
+ if(upload_remain >= 0)
+ infof(data, "%s%sclose instead of sending %"
+ CURL_FORMAT_CURL_OFF_T " more bytes",
+ ongoing_auth? ongoing_auth : "",
+ ongoing_auth? " send, " : "",
+ upload_remain);
+ else
+ infof(data, "%s%sclose instead of sending unknown amount "
+ "of more bytes",
+ ongoing_auth? ongoing_auth : "",
+ ongoing_auth? " send, " : "");
+ /* We decided to abort the ongoing transfer */
streamclose(conn, "Mid-auth HTTP and much data left to send");
+ /* FIXME: questionable manipulation here, can we do this differently? */
data->req.size = 0; /* don't download any more than 0 bytes */
-
- /* There still is data left to send, but this connection is marked for
- closure so we can safely do the rewind right now */
}
-
- if(bytessent) {
- /* mark for rewind since if we already sent something */
- data->state.rewindbeforesend = TRUE;
- infof(data, "Please rewind output before next send");
- }
-
return CURLE_OK;
}
@@ -578,7 +520,7 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
if((data->state.aptr.user || data->set.str[STRING_BEARER]) &&
((data->req.httpcode == 401) ||
- (conn->bits.authneg && data->req.httpcode < 300))) {
+ (data->req.authneg && data->req.httpcode < 300))) {
pickhost = pickoneauth(&data->state.authhost, authmask);
if(!pickhost)
data->state.authproblem = TRUE;
@@ -592,7 +534,7 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
#ifndef CURL_DISABLE_PROXY
if(conn->bits.proxy_user_passwd &&
((data->req.httpcode == 407) ||
- (conn->bits.authneg && data->req.httpcode < 300))) {
+ (data->req.authneg && data->req.httpcode < 300))) {
pickproxy = pickoneauth(&data->state.authproxy,
authmask & ~CURLAUTH_BEARER);
if(!pickproxy)
@@ -601,13 +543,10 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
#endif
if(pickhost || pickproxy) {
- if((data->state.httpreq != HTTPREQ_GET) &&
- (data->state.httpreq != HTTPREQ_HEAD) &&
- !data->state.rewindbeforesend) {
- result = http_perhapsrewind(data, conn);
- if(result)
- return result;
- }
+ result = http_perhapsrewind(data, conn);
+ if(result)
+ return result;
+
/* In case this is GSS auth, the newurl field is already allocated so
we must make sure to free it before allocating a new one. As figured
out in bug #2284386 */
@@ -618,7 +557,7 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data)
}
else if((data->req.httpcode < 300) &&
(!data->state.authhost.done) &&
- conn->bits.authneg) {
+ data->req.authneg) {
/* no (known) authentication available,
authentication is not "done" yet and
no authentication seems to be required and
@@ -863,10 +802,10 @@ Curl_http_output_auth(struct Curl_easy *data,
(httpreq != HTTPREQ_HEAD)) {
/* Auth is required and we are not authenticated yet. Make a PUT or POST
with content-length zero as a "probe". */
- conn->bits.authneg = TRUE;
+ data->req.authneg = TRUE;
}
else
- conn->bits.authneg = FALSE;
+ data->req.authneg = FALSE;
return result;
}
@@ -1174,274 +1113,6 @@ static bool http_should_fail(struct Curl_easy *data)
}
/*
- * readmoredata() is a "fread() emulation" to provide POST and/or request
- * data. It is used when a huge POST is to be made and the entire chunk wasn't
- * sent in the first send(). This function will then be called from the
- * transfer.c loop when more data is to be sent to the peer.
- *
- * Returns the amount of bytes it filled the buffer with.
- */
-static size_t readmoredata(char *buffer,
- size_t size,
- size_t nitems,
- void *userp)
-{
- struct HTTP *http = (struct HTTP *)userp;
- struct Curl_easy *data = http->backup.data;
- size_t fullsize = size * nitems;
-
- if(!http->postsize)
- /* nothing to return */
- return 0;
-
- /* make sure that an HTTP request is never sent away chunked! */
- data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE;
-
- if(data->set.max_send_speed &&
- (data->set.max_send_speed < (curl_off_t)fullsize) &&
- (data->set.max_send_speed < http->postsize))
- /* speed limit */
- fullsize = (size_t)data->set.max_send_speed;
-
- else if(http->postsize <= (curl_off_t)fullsize) {
- memcpy(buffer, http->postdata, (size_t)http->postsize);
- fullsize = (size_t)http->postsize;
-
- if(http->backup.postsize) {
- /* move backup data into focus and continue on that */
- http->postdata = http->backup.postdata;
- http->postsize = http->backup.postsize;
- data->state.fread_func = http->backup.fread_func;
- data->state.in = http->backup.fread_in;
-
- http->sending++; /* move one step up */
-
- http->backup.postsize = 0;
- }
- else
- http->postsize = 0;
-
- return fullsize;
- }
-
- memcpy(buffer, http->postdata, fullsize);
- http->postdata += fullsize;
- http->postsize -= fullsize;
-
- return fullsize;
-}
-
-/*
- * Curl_buffer_send() sends a header buffer and frees all associated
- * memory. Body data may be appended to the header data if desired.
- *
- * Returns CURLcode
- */
-CURLcode Curl_buffer_send(struct dynbuf *in,
- struct Curl_easy *data,
- struct HTTP *http,
- /* add the number of sent bytes to this
- counter */
- curl_off_t *bytes_written,
- /* how much of the buffer contains body data */
- curl_off_t included_body_bytes,
- int sockindex)
-{
- ssize_t amount;
- CURLcode result;
- char *ptr;
- size_t size;
- struct connectdata *conn = data->conn;
- size_t sendsize;
- size_t headersize;
-
- DEBUGASSERT(sockindex <= SECONDARYSOCKET && sockindex >= 0);
-
- /* The looping below is required since we use non-blocking sockets, but due
- to the circumstances we will just loop and try again and again etc */
-
- ptr = Curl_dyn_ptr(in);
- size = Curl_dyn_len(in);
-
- headersize = size - (size_t)included_body_bytes; /* the initial part that
- isn't body is header */
-
- DEBUGASSERT(size > (size_t)included_body_bytes);
-
- if((conn->handler->flags & PROTOPT_SSL
-#ifndef CURL_DISABLE_PROXY
- || IS_HTTPS_PROXY(conn->http_proxy.proxytype)
-#endif
- )
- && conn->httpversion < 20) {
- /* Make sure this doesn't send more body bytes than what the max send
- speed says. The request bytes do not count to the max speed.
- */
- if(data->set.max_send_speed &&
- (included_body_bytes > data->set.max_send_speed)) {
- curl_off_t overflow = included_body_bytes - data->set.max_send_speed;
- DEBUGASSERT((size_t)overflow < size);
- sendsize = size - (size_t)overflow;
- }
- else
- sendsize = size;
-
- /* OpenSSL is very picky and we must send the SAME buffer pointer to the
- library when we attempt to re-send this buffer. Sending the same data
- is not enough, we must use the exact same address. For this reason, we
- must copy the data to the uploadbuffer first, since that is the buffer
- we will be using if this send is retried later.
- */
- result = Curl_get_upload_buffer(data);
- if(result) {
- /* malloc failed, free memory and return to the caller */
- Curl_dyn_free(in);
- return result;
- }
- /* We never send more than upload_buffer_size bytes in one single chunk
- when we speak HTTPS, as if only a fraction of it is sent now, this data
- needs to fit into the normal read-callback buffer later on and that
- buffer is using this size.
- */
- if(sendsize > (size_t)data->set.upload_buffer_size)
- sendsize = (size_t)data->set.upload_buffer_size;
-
- memcpy(data->state.ulbuf, ptr, sendsize);
- ptr = data->state.ulbuf;
- }
- else {
-#ifdef CURLDEBUG
- /* Allow debug builds to override this logic to force short initial
- sends
- */
- char *p = getenv("CURL_SMALLREQSEND");
- if(p) {
- size_t altsize = (size_t)strtoul(p, NULL, 10);
- if(altsize)
- sendsize = CURLMIN(size, altsize);
- else
- sendsize = size;
- }
- else
-#endif
- {
- /* Make sure this doesn't send more body bytes than what the max send
- speed says. The request bytes do not count to the max speed.
- */
- if(data->set.max_send_speed &&
- (included_body_bytes > data->set.max_send_speed)) {
- curl_off_t overflow = included_body_bytes - data->set.max_send_speed;
- DEBUGASSERT((size_t)overflow < size);
- sendsize = size - (size_t)overflow;
- }
- else
- sendsize = size;
- }
-
- /* We currently cannot send more that this for http here:
- * - if sending blocks, it return 0 as amount
- * - we then whisk aside the `in` into the `http` struct
- * and install our own `data->state.fread_func` that
- * on subsequent calls reads `in` empty.
- * - when the whisked away `in` is empty, the `fread_func`
- * is restored to its original state.
- * The problem is that `fread_func` can only return
- * `upload_buffer_size` lengths. If the send we do here
- * is larger and blocks, we do re-sending with smaller
- * amounts of data and connection filters do not like
- * that.
- */
- if(http && (sendsize > (size_t)data->set.upload_buffer_size))
- sendsize = (size_t)data->set.upload_buffer_size;
- }
-
- result = Curl_nwrite(data, sockindex, ptr, sendsize, &amount);
-
- if(!result) {
- /*
- * Note that we may not send the entire chunk at once, and we have a set
- * number of data bytes at the end of the big buffer (out of which we may
- * only send away a part).
- */
- /* how much of the header that was sent */
- size_t headlen = (size_t)amount>headersize ? headersize : (size_t)amount;
- size_t bodylen = amount - headlen;
-
- /* this data _may_ contain binary stuff */
- Curl_debug(data, CURLINFO_HEADER_OUT, ptr, headlen);
- if(bodylen)
- /* there was body data sent beyond the initial header part, pass that on
- to the debug callback too */
- Curl_debug(data, CURLINFO_DATA_OUT, ptr + headlen, bodylen);
-
- /* 'amount' can never be a very large value here so typecasting it so a
- signed 31 bit value should not cause problems even if ssize_t is
- 64bit */
- *bytes_written += (long)amount;
-
- if(http) {
- /* if we sent a piece of the body here, up the byte counter for it
- accordingly */
- data->req.writebytecount += bodylen;
- Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
-
- if((size_t)amount != size) {
- /* The whole request could not be sent in one system call. We must
- queue it up and send it later when we get the chance. We must not
- loop here and wait until it might work again. */
-
- size -= amount;
-
- ptr = Curl_dyn_ptr(in) + amount;
-
- /* backup the currently set pointers */
- http->backup.fread_func = data->state.fread_func;
- http->backup.fread_in = data->state.in;
- http->backup.postdata = http->postdata;
- http->backup.postsize = http->postsize;
- http->backup.data = data;
-
- /* set the new pointers for the request-sending */
- data->state.fread_func = (curl_read_callback)readmoredata;
- data->state.in = (void *)http;
- http->postdata = ptr;
- http->postsize = (curl_off_t)size;
-
- /* this much data is remaining header: */
- data->req.pendingheader = headersize - headlen;
-
- http->send_buffer = *in; /* copy the whole struct */
- http->sending = HTTPSEND_REQUEST;
- return CURLE_OK;
- }
- http->sending = HTTPSEND_BODY;
- /* the full buffer was sent, clean up and return */
- }
- else {
- if((size_t)amount != size)
- /* We have no continue-send mechanism now, fail. This can only happen
- when this function is used from the CONNECT sending function. We
- currently (stupidly) assume that the whole request is always sent
- away in the first single chunk.
-
- This needs FIXing.
- */
- return CURLE_SEND_ERROR;
- }
- }
- Curl_dyn_free(in);
-
- /* no remaining header data */
- data->req.pendingheader = 0;
- return result;
-}
-
-/* end of the add_buffer functions */
-/* ------------------------------------------------------------------------- */
-
-
-
-/*
* Curl_compareheader()
*
* Returns TRUE if 'headerline' contains the 'header' with given 'content'.
@@ -1543,17 +1214,11 @@ CURLcode Curl_http_done(struct Curl_easy *data,
data->state.authhost.multipass = FALSE;
data->state.authproxy.multipass = FALSE;
- /* set the proper values (possibly modified on POST) */
- conn->seek_func = data->set.seek_func; /* restore */
- conn->seek_client = data->set.seek_client; /* restore */
-
if(!http)
return CURLE_OK;
- Curl_dyn_free(&http->send_buffer);
Curl_dyn_reset(&data->state.headerb);
Curl_hyper_done(data);
- Curl_ws_done(data);
if(status)
return status;
@@ -1613,83 +1278,12 @@ static const char *get_http_string(const struct Curl_easy *data,
}
#endif
-/* check and possibly add an Expect: header */
-static CURLcode expect100(struct Curl_easy *data,
- struct connectdata *conn,
- struct dynbuf *req)
-{
- CURLcode result = CURLE_OK;
- if(!data->state.disableexpect && Curl_use_http_1_1plus(data, conn) &&
- (conn->httpversion < 20)) {
- /* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an
- Expect: 100-continue to the headers which actually speeds up post
- operations (as there is one packet coming back from the web server) */
- const char *ptr = Curl_checkheaders(data, STRCONST("Expect"));
- if(ptr) {
- data->state.expect100header =
- Curl_compareheader(ptr, STRCONST("Expect:"), STRCONST("100-continue"));
- }
- else {
- result = Curl_dyn_addn(req, STRCONST("Expect: 100-continue\r\n"));
- if(!result)
- data->state.expect100header = TRUE;
- }
- }
-
- return result;
-}
-
enum proxy_use {
HEADER_SERVER, /* direct to server */
HEADER_PROXY, /* regular request to proxy */
HEADER_CONNECT /* sending CONNECT to a proxy */
};
-/* used to compile the provided trailers into one buffer
- will return an error code if one of the headers is
- not formatted correctly */
-CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
- struct dynbuf *b,
- struct Curl_easy *handle)
-{
- char *ptr = NULL;
- CURLcode result = CURLE_OK;
- const char *endofline_native = NULL;
- const char *endofline_network = NULL;
-
- if(
-#ifdef CURL_DO_LINEEND_CONV
- (handle->state.prefer_ascii) ||
-#endif
- (handle->set.crlf)) {
- /* \n will become \r\n later on */
- endofline_native = "\n";
- endofline_network = "\x0a";
- }
- else {
- endofline_native = "\r\n";
- endofline_network = "\x0d\x0a";
- }
-
- while(trailers) {
- /* only add correctly formatted trailers */
- ptr = strchr(trailers->data, ':');
- if(ptr && *(ptr + 1) == ' ') {
- result = Curl_dyn_add(b, trailers->data);
- if(result)
- return result;
- result = Curl_dyn_add(b, endofline_native);
- if(result)
- return result;
- }
- else
- infof(handle, "Malformatted trailing header, skipping trailer");
- trailers = trailers->next;
- }
- result = Curl_dyn_add(b, endofline_network);
- return result;
-}
-
static bool hd_name_eq(const char *n1, size_t n1len,
const char *n2, size_t n2len)
{
@@ -1808,7 +1402,7 @@ CURLcode Curl_dynhds_add_custom(struct Curl_easy *data,
/* this header is sent later */
hd_name_eq(name, namelen, STRCONST("Content-Type:")))
;
- else if(conn->bits.authneg &&
+ else if(data->req.authneg &&
/* while doing auth neg, don't allow the custom length since
we will force length zero then */
hd_name_eq(name, namelen, STRCONST("Content-Length:")))
@@ -1954,7 +1548,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
/* this header is sent later */
checkprefix("Content-Type:", compare))
;
- else if(conn->bits.authneg &&
+ else if(data->req.authneg &&
/* while doing auth neg, don't allow the custom length since
we will force length zero then */
checkprefix("Content-Length:", compare))
@@ -2335,18 +1929,17 @@ CURLcode Curl_http_target(struct Curl_easy *data,
return result;
}
-CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
- Curl_HttpReq httpreq, const char **tep)
+#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
+static CURLcode set_post_reader(struct Curl_easy *data, Curl_HttpReq httpreq)
{
- CURLcode result = CURLE_OK;
- const char *ptr;
- struct HTTP *http = data->req.p.http;
- http->postsize = 0;
+ CURLcode result;
switch(httpreq) {
+#ifndef CURL_DISABLE_MIME
case HTTPREQ_POST_MIME:
data->state.mimepost = &data->set.mimepost;
break;
+#endif
#ifndef CURL_DISABLE_FORM_API
case HTTPREQ_POST_FORM:
/* Convert the form structure into a mime structure, then keep
@@ -2368,35 +1961,154 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
#endif
default:
data->state.mimepost = NULL;
+ break;
}
+ switch(httpreq) {
+ case HTTPREQ_POST_FORM:
+ case HTTPREQ_POST_MIME:
+ /* This is form posting using mime data. */
#ifndef CURL_DISABLE_MIME
- if(data->state.mimepost) {
- const char *cthdr = Curl_checkheaders(data, STRCONST("Content-Type"));
+ if(data->state.mimepost) {
+ const char *cthdr = Curl_checkheaders(data, STRCONST("Content-Type"));
- /* Read and seek body only. */
- data->state.mimepost->flags |= MIME_BODY_ONLY;
+ /* Read and seek body only. */
+ data->state.mimepost->flags |= MIME_BODY_ONLY;
- /* Prepare the mime structure headers & set content type. */
+ /* Prepare the mime structure headers & set content type. */
- if(cthdr)
- for(cthdr += 13; *cthdr == ' '; cthdr++)
- ;
- else if(data->state.mimepost->kind == MIMEKIND_MULTIPART)
- cthdr = "multipart/form-data";
+ if(cthdr)
+ for(cthdr += 13; *cthdr == ' '; cthdr++)
+ ;
+ else if(data->state.mimepost->kind == MIMEKIND_MULTIPART)
+ cthdr = "multipart/form-data";
- curl_mime_headers(data->state.mimepost, data->set.headers, 0);
- result = Curl_mime_prepare_headers(data, data->state.mimepost, cthdr,
- NULL, MIMESTRATEGY_FORM);
- curl_mime_headers(data->state.mimepost, NULL, 0);
- if(!result)
- result = Curl_mime_rewind(data->state.mimepost);
- if(result)
- return result;
- http->postsize = Curl_mime_size(data->state.mimepost);
+ curl_mime_headers(data->state.mimepost, data->set.headers, 0);
+ result = Curl_mime_prepare_headers(data, data->state.mimepost, cthdr,
+ NULL, MIMESTRATEGY_FORM);
+ if(result)
+ return result;
+ curl_mime_headers(data->state.mimepost, NULL, 0);
+ result = Curl_creader_set_mime(data, data->state.mimepost);
+ if(result)
+ return result;
+ }
+ else
+#endif
+ {
+ result = Curl_creader_set_null(data);
+ }
+ data->state.infilesize = Curl_creader_total_length(data);
+ return result;
+
+ default:
+ return Curl_creader_set_null(data);
}
+ /* never reached */
+}
#endif
+static CURLcode set_reader(struct Curl_easy *data, Curl_HttpReq httpreq)
+{
+ CURLcode result = CURLE_OK;
+ curl_off_t postsize = data->state.infilesize;
+
+ DEBUGASSERT(data->conn);
+
+ if(data->req.authneg) {
+ return Curl_creader_set_null(data);
+ }
+
+ switch(httpreq) {
+ case HTTPREQ_PUT: /* Let's PUT the data to the server! */
+ if(!postsize)
+ result = Curl_creader_set_null(data);
+ else
+ result = Curl_creader_set_fread(data, postsize);
+ return result;
+
+#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
+ case HTTPREQ_POST_FORM:
+ case HTTPREQ_POST_MIME:
+ return set_post_reader(data, httpreq);
+#endif
+
+ case HTTPREQ_POST:
+ /* this is the simple POST, using x-www-form-urlencoded style */
+ /* the size of the post body */
+ if(!postsize) {
+ result = Curl_creader_set_null(data);
+ }
+ else if(data->set.postfields) {
+ if(postsize > 0)
+ result = Curl_creader_set_buf(data, data->set.postfields,
+ (size_t)postsize);
+ else
+ result = Curl_creader_set_null(data);
+ }
+ else { /* we read the bytes from the callback */
+ result = Curl_creader_set_fread(data, postsize);
+ }
+ return result;
+
+ default:
+ /* HTTP GET/HEAD download, has no body, needs no Content-Length */
+ data->state.infilesize = 0;
+ return Curl_creader_set_null(data);
+ }
+ /* not reached */
+}
+
+static CURLcode http_resume(struct Curl_easy *data, Curl_HttpReq httpreq)
+{
+ if((HTTPREQ_POST == httpreq || HTTPREQ_PUT == httpreq) &&
+ data->state.resume_from) {
+ /**********************************************************************
+ * Resuming upload in HTTP means that we PUT or POST and that we have
+ * got a resume_from value set. The resume value has already created
+ * a Range: header that will be passed along. We need to "fast forward"
+ * the file the given number of bytes and decrease the assume upload
+ * file size before we continue this venture in the dark lands of HTTP.
+ * Resuming mime/form posting at an offset > 0 has no sense and is ignored.
+ *********************************************************************/
+
+ if(data->state.resume_from < 0) {
+ /*
+ * This is meant to get the size of the present remote-file by itself.
+ * We don't support this now. Bail out!
+ */
+ data->state.resume_from = 0;
+ }
+
+ if(data->state.resume_from && !data->req.authneg) {
+ /* only act on the first request */
+ CURLcode result;
+ result = Curl_creader_resume_from(data, data->state.resume_from);
+ if(result) {
+ failf(data, "Unable to resume from offset %" CURL_FORMAT_CURL_OFF_T,
+ data->state.resume_from);
+ return result;
+ }
+ }
+ }
+ return CURLE_OK;
+}
+
+CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
+ Curl_HttpReq httpreq,
+ const char **tep)
+{
+ CURLcode result = CURLE_OK;
+ const char *ptr;
+
+ result = set_reader(data, httpreq);
+ if(result)
+ return result;
+
+ result = http_resume(data, httpreq);
+ if(result)
+ return result;
+
ptr = Curl_checkheaders(data, STRCONST("Transfer-Encoding"));
if(ptr) {
/* Some kind of TE is requested, check if 'chunked' is chosen */
@@ -2405,18 +2117,14 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
STRCONST("Transfer-Encoding:"), STRCONST("chunked"));
}
else {
- if((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
- (((httpreq == HTTPREQ_POST_MIME || httpreq == HTTPREQ_POST_FORM) &&
- http->postsize < 0) ||
- ((data->state.upload || httpreq == HTTPREQ_POST) &&
- data->state.infilesize == -1))) {
- if(conn->bits.authneg)
- /* don't enable chunked during auth neg */
- ;
- else if(Curl_use_http_1_1plus(data, conn)) {
- if(conn->httpversion < 20)
- /* HTTP, upload, unknown file size and not HTTP 1.0 */
- data->req.upload_chunky = TRUE;
+ curl_off_t req_clen = Curl_creader_total_length(data);
+
+ if(req_clen < 0) {
+ /* indeterminate request content length */
+ if(Curl_use_http_1_1plus(data, data->conn)) {
+ /* On HTTP/1.1, enable chunked, on HTTP/2 and later we do not
+ * need it */
+ data->req.upload_chunky = (data->conn->httpversion < 20);
}
else {
failf(data, "Chunky upload is not supported by HTTP 1.0");
@@ -2434,330 +2142,126 @@ CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
return result;
}
-static CURLcode addexpect(struct Curl_easy *data, struct connectdata *conn,
- struct dynbuf *r)
+static CURLcode addexpect(struct Curl_easy *data, struct dynbuf *r,
+ bool *announced_exp100)
{
- data->state.expect100header = FALSE;
+ CURLcode result;
+ char *ptr;
+
+ *announced_exp100 = FALSE;
/* Avoid Expect: 100-continue if Upgrade: is used */
- if(data->req.upgr101 == UPGR101_INIT) {
- struct HTTP *http = data->req.p.http;
- /* For really small puts we don't use Expect: headers at all, and for
- the somewhat bigger ones we allow the app to disable it. Just make
- sure that the expect100header is always set to the preferred value
- here. */
- char *ptr = Curl_checkheaders(data, STRCONST("Expect"));
- if(ptr) {
- data->state.expect100header =
- Curl_compareheader(ptr, STRCONST("Expect:"),
- STRCONST("100-continue"));
+ if(data->req.upgr101 != UPGR101_INIT)
+ return CURLE_OK;
+
+ /* For really small puts we don't use Expect: headers at all, and for
+ the somewhat bigger ones we allow the app to disable it. Just make
+ sure that the expect100header is always set to the preferred value
+ here. */
+ ptr = Curl_checkheaders(data, STRCONST("Expect"));
+ if(ptr) {
+ *announced_exp100 =
+ Curl_compareheader(ptr, STRCONST("Expect:"), STRCONST("100-continue"));
+ }
+ else if(!data->state.disableexpect &&
+ Curl_use_http_1_1plus(data, data->conn) &&
+ (data->conn->httpversion < 20)) {
+ /* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an
+ Expect: 100-continue to the headers which actually speeds up post
+ operations (as there is one packet coming back from the web server) */
+ curl_off_t client_len = Curl_creader_client_length(data);
+ if(client_len > EXPECT_100_THRESHOLD || client_len < 0) {
+ result = Curl_dyn_addn(r, STRCONST("Expect: 100-continue\r\n"));
+ if(result)
+ return result;
+ *announced_exp100 = TRUE;
}
- else if(http->postsize > EXPECT_100_THRESHOLD || http->postsize < 0)
- return expect100(data, conn, r);
}
return CURLE_OK;
}
-CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn,
- struct dynbuf *r, Curl_HttpReq httpreq)
+CURLcode Curl_http_req_complete(struct Curl_easy *data,
+ struct dynbuf *r, Curl_HttpReq httpreq)
{
-#ifndef USE_HYPER
- /* Hyper always handles the body separately */
- curl_off_t included_body = 0;
-#else
- /* from this point down, this function should not be used */
-#define Curl_buffer_send(a,b,c,d,e,f) CURLE_OK
-#endif
CURLcode result = CURLE_OK;
- struct HTTP *http = data->req.p.http;
-
- switch(httpreq) {
- case HTTPREQ_PUT: /* Let's PUT the data to the server! */
+ curl_off_t req_clen;
+ bool announced_exp100 = FALSE;
- if(conn->bits.authneg)
- http->postsize = 0;
- else
- http->postsize = data->state.infilesize;
-
- if((http->postsize != -1) && !data->req.upload_chunky &&
- (conn->bits.authneg ||
- !Curl_checkheaders(data, STRCONST("Content-Length")))) {
- /* only add Content-Length if not uploading chunked */
- result = Curl_dyn_addf(r, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", http->postsize);
- if(result)
- return result;
- }
-
- result = addexpect(data, conn, r);
- if(result)
- return result;
-
- /* end of headers */
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
-
- /* set the upload size to the progress meter */
- Curl_pgrsSetUploadSize(data, http->postsize);
-
- /* this sends the buffer and frees all the buffer resources */
- result = Curl_buffer_send(r, data, data->req.p.http,
- &data->info.request_size, 0,
- FIRSTSOCKET);
- if(result)
- failf(data, "Failed sending PUT request");
- else
- /* prepare for transfer */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE,
- http->postsize?FIRSTSOCKET:-1);
+ DEBUGASSERT(data->conn);
+#ifndef USE_HYPER
+ if(data->req.upload_chunky) {
+ result = Curl_httpchunk_add_reader(data);
if(result)
return result;
- break;
+ }
+#endif
+ /* Get the request body length that has been set up */
+ req_clen = Curl_creader_total_length(data);
+ switch(httpreq) {
+ case HTTPREQ_PUT:
+ case HTTPREQ_POST:
+#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
case HTTPREQ_POST_FORM:
case HTTPREQ_POST_MIME:
- /* This is form posting using mime data. */
- if(conn->bits.authneg) {
- /* nothing to post! */
- result = Curl_dyn_addn(r, STRCONST("Content-Length: 0\r\n\r\n"));
- if(result)
- return result;
-
- result = Curl_buffer_send(r, data, data->req.p.http,
- &data->info.request_size, 0,
- FIRSTSOCKET);
- if(result)
- failf(data, "Failed sending POST request");
- else
- /* setup variables for the upcoming transfer */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
- break;
- }
-
- data->state.infilesize = http->postsize;
-
+#endif
/* We only set Content-Length and allow a custom Content-Length if
we don't upload data chunked, as RFC2616 forbids us to set both
- kinds of headers (Transfer-Encoding: chunked and Content-Length) */
- if(http->postsize != -1 && !data->req.upload_chunky &&
- (!Curl_checkheaders(data, STRCONST("Content-Length")))) {
+ kinds of headers (Transfer-Encoding: chunked and Content-Length).
+ We do not override a custom "Content-Length" header, but during
+ authentication negotiation that header is suppressed.
+ */
+ if(req_clen >= 0 && !data->req.upload_chunky &&
+ (data->req.authneg ||
+ !Curl_checkheaders(data, STRCONST("Content-Length")))) {
/* we allow replacing this header if not during auth negotiation,
although it isn't very wise to actually set your own */
result = Curl_dyn_addf(r,
"Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", http->postsize);
- if(result)
- return result;
+ "\r\n", req_clen);
}
+ if(result)
+ goto out;
#ifndef CURL_DISABLE_MIME
/* Output mime-generated headers. */
- {
+ if(data->state.mimepost &&
+ ((httpreq == HTTPREQ_POST_FORM) || (httpreq == HTTPREQ_POST_MIME))) {
struct curl_slist *hdr;
for(hdr = data->state.mimepost->curlheaders; hdr; hdr = hdr->next) {
result = Curl_dyn_addf(r, "%s\r\n", hdr->data);
if(result)
- return result;
- }
- }
-#endif
-
- result = addexpect(data, conn, r);
- if(result)
- return result;
-
- /* make the request end in a true CRLF */
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
-
- /* set the upload size to the progress meter */
- Curl_pgrsSetUploadSize(data, http->postsize);
-
- /* Read from mime structure. */
- data->state.fread_func = (curl_read_callback) Curl_mime_read;
- data->state.in = (void *) data->state.mimepost;
- http->sending = HTTPSEND_BODY;
-
- /* this sends the buffer and frees all the buffer resources */
- result = Curl_buffer_send(r, data, data->req.p.http,
- &data->info.request_size, 0,
- FIRSTSOCKET);
- if(result)
- failf(data, "Failed sending POST request");
- else
- /* prepare for transfer */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE,
- http->postsize?FIRSTSOCKET:-1);
- if(result)
- return result;
-
- break;
-
- case HTTPREQ_POST:
- /* this is the simple POST, using x-www-form-urlencoded style */
-
- if(conn->bits.authneg)
- http->postsize = 0;
- else
- /* the size of the post body */
- http->postsize = data->state.infilesize;
-
- /* We only set Content-Length and allow a custom Content-Length if
- we don't upload data chunked, as RFC2616 forbids us to set both
- kinds of headers (Transfer-Encoding: chunked and Content-Length) */
- if((http->postsize != -1) && !data->req.upload_chunky &&
- (conn->bits.authneg ||
- !Curl_checkheaders(data, STRCONST("Content-Length")))) {
- /* we allow replacing this header if not during auth negotiation,
- although it isn't very wise to actually set your own */
- result = Curl_dyn_addf(r, "Content-Length: %" CURL_FORMAT_CURL_OFF_T
- "\r\n", http->postsize);
- if(result)
- return result;
- }
-
- if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
- result = Curl_dyn_addn(r, STRCONST("Content-Type: application/"
- "x-www-form-urlencoded\r\n"));
- if(result)
- return result;
- }
-
- result = addexpect(data, conn, r);
- if(result)
- return result;
-
-#ifndef USE_HYPER
- /* With Hyper the body is always passed on separately */
- if(data->set.postfields) {
- if(!data->state.expect100header &&
- (http->postsize < MAX_INITIAL_POST_SIZE)) {
- /* if we don't use expect: 100 AND
- postsize is less than MAX_INITIAL_POST_SIZE
-
- then append the post data to the HTTP request header. This limit
- is no magic limit but only set to prevent really huge POSTs to
- get the data duplicated with malloc() and family. */
-
- /* end of headers! */
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
-
- if(!data->req.upload_chunky) {
- /* We're not sending it 'chunked', append it to the request
- already now to reduce the number of send() calls */
- result = Curl_dyn_addn(r, data->set.postfields,
- (size_t)http->postsize);
- included_body = http->postsize;
- }
- else {
- if(http->postsize) {
- char chunk[16];
- /* Append the POST data chunky-style */
- msnprintf(chunk, sizeof(chunk), "%x\r\n", (int)http->postsize);
- result = Curl_dyn_add(r, chunk);
- if(!result) {
- included_body = http->postsize + strlen(chunk);
- result = Curl_dyn_addn(r, data->set.postfields,
- (size_t)http->postsize);
- if(!result)
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- included_body += 2;
- }
- }
- if(!result) {
- result = Curl_dyn_addn(r, STRCONST("\x30\x0d\x0a\x0d\x0a"));
- /* 0 CR LF CR LF */
- included_body += 5;
- }
- }
- if(result)
- return result;
- /* Make sure the progress information is accurate */
- Curl_pgrsSetUploadSize(data, http->postsize);
- }
- else {
- /* A huge POST coming up, do data separate from the request */
- http->postdata = data->set.postfields;
- http->sending = HTTPSEND_BODY;
- http->backup.data = data;
- data->state.fread_func = (curl_read_callback)readmoredata;
- data->state.in = (void *)http;
-
- /* set the upload size to the progress meter */
- Curl_pgrsSetUploadSize(data, http->postsize);
-
- /* end of headers! */
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
+ goto out;
}
}
- else
#endif
- {
- /* end of headers! */
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
-
- if(data->req.upload_chunky && conn->bits.authneg) {
- /* Chunky upload is selected and we're negotiating auth still, send
- end-of-data only */
- result = Curl_dyn_addn(r, (char *)STRCONST("\x30\x0d\x0a\x0d\x0a"));
- /* 0 CR LF CR LF */
+ if(httpreq == HTTPREQ_POST) {
+ if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
+ result = Curl_dyn_addn(r, STRCONST("Content-Type: application/"
+ "x-www-form-urlencoded\r\n"));
if(result)
- return result;
- }
-
- else if(data->state.infilesize) {
- /* set the upload size to the progress meter */
- Curl_pgrsSetUploadSize(data, http->postsize?http->postsize:-1);
-
- /* set the pointer to mark that we will send the post body using the
- read callback, but only if we're not in authenticate negotiation */
- if(!conn->bits.authneg)
- http->postdata = (char *)&http->postdata;
+ goto out;
}
}
- /* issue the request */
- result = Curl_buffer_send(r, data, data->req.p.http,
- &data->info.request_size, included_body,
- FIRSTSOCKET);
-
+ result = addexpect(data, r, &announced_exp100);
if(result)
- failf(data, "Failed sending HTTP POST request");
- else
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE,
- http->postdata?FIRSTSOCKET:-1);
+ goto out;
break;
-
default:
- result = Curl_dyn_addn(r, STRCONST("\r\n"));
- if(result)
- return result;
-
- /* issue the request */
- result = Curl_buffer_send(r, data, data->req.p.http,
- &data->info.request_size, 0,
- FIRSTSOCKET);
- if(result)
- failf(data, "Failed sending HTTP request");
-#ifdef USE_WEBSOCKETS
- else if((conn->handler->protocol & (CURLPROTO_WS|CURLPROTO_WSS)) &&
- !(data->set.connect_only))
- /* Set up the transfer for two-way since without CONNECT_ONLY set, this
- request probably wants to send data too post upgrade */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, FIRSTSOCKET);
-#endif
- else
- /* HTTP GET/HEAD download: */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
+ break;
}
+ /* end of headers */
+ result = Curl_dyn_addn(r, STRCONST("\r\n"));
+ Curl_pgrsSetUploadSize(data, req_clen);
+ if(announced_exp100)
+ result = http_exp100_add_reader(data);
+
+out:
+ if(!result) {
+ /* setup variables for the upcoming transfer */
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, TRUE, FIRSTSOCKET);
+ }
return result;
}
@@ -2857,7 +2361,7 @@ CURLcode Curl_http_range(struct Curl_easy *data,
}
else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) &&
!Curl_checkheaders(data, STRCONST("Content-Range"))) {
-
+ curl_off_t req_clen = Curl_creader_total_length(data);
/* if a line like this was already allocated, free the previous one */
free(data->state.aptr.rangeline);
@@ -2868,25 +2372,28 @@ CURLcode Curl_http_range(struct Curl_easy *data,
data->state.aptr.rangeline =
aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
- data->state.infilesize - 1, data->state.infilesize);
+ req_clen - 1, req_clen);
}
else if(data->state.resume_from) {
/* This is because "resume" was selected */
- curl_off_t total_expected_size =
- data->state.resume_from + data->state.infilesize;
+ /* TODO: not sure if we want to send this header during authentication
+ * negotiation, but test1084 checks for it. In which case we have a
+ * "null" client reader installed that gives an unexpected length. */
+ curl_off_t total_len = data->req.authneg?
+ data->state.infilesize :
+ (data->state.resume_from + req_clen);
data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
- data->state.range, total_expected_size-1,
- total_expected_size);
+ data->state.range, total_len-1, total_len);
}
else {
/* Range was selected and then we just pass the incoming range and
append total size */
data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n",
- data->state.range, data->state.infilesize);
+ data->state.range, req_clen);
}
if(!data->state.aptr.rangeline)
return CURLE_OUT_OF_MEMORY;
@@ -2895,100 +2402,17 @@ CURLcode Curl_http_range(struct Curl_easy *data,
return CURLE_OK;
}
-CURLcode Curl_http_resume(struct Curl_easy *data,
- struct connectdata *conn,
- Curl_HttpReq httpreq)
-{
- if((HTTPREQ_POST == httpreq || HTTPREQ_PUT == httpreq) &&
- data->state.resume_from) {
- /**********************************************************************
- * Resuming upload in HTTP means that we PUT or POST and that we have
- * got a resume_from value set. The resume value has already created
- * a Range: header that will be passed along. We need to "fast forward"
- * the file the given number of bytes and decrease the assume upload
- * file size before we continue this venture in the dark lands of HTTP.
- * Resuming mime/form posting at an offset > 0 has no sense and is ignored.
- *********************************************************************/
-
- if(data->state.resume_from < 0) {
- /*
- * This is meant to get the size of the present remote-file by itself.
- * We don't support this now. Bail out!
- */
- data->state.resume_from = 0;
- }
-
- if(data->state.resume_from && !data->state.followlocation) {
- /* only act on the first request */
-
- /* Now, let's read off the proper amount of bytes from the
- input. */
- int seekerr = CURL_SEEKFUNC_CANTSEEK;
- if(conn->seek_func) {
- Curl_set_in_callback(data, true);
- seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
- SEEK_SET);
- Curl_set_in_callback(data, false);
- }
-
- if(seekerr != CURL_SEEKFUNC_OK) {
- curl_off_t passed = 0;
-
- if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
- failf(data, "Could not seek stream");
- return CURLE_READ_ERROR;
- }
- /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
- do {
- char scratch[4*1024];
- size_t readthisamountnow =
- (data->state.resume_from - passed > (curl_off_t)sizeof(scratch)) ?
- sizeof(scratch) :
- curlx_sotouz(data->state.resume_from - passed);
-
- size_t actuallyread =
- data->state.fread_func(scratch, 1, readthisamountnow,
- data->state.in);
-
- passed += actuallyread;
- if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
- /* this checks for greater-than only to make sure that the
- CURL_READFUNC_ABORT return code still aborts */
- failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T
- " bytes from the input", passed);
- return CURLE_READ_ERROR;
- }
- } while(passed < data->state.resume_from);
- }
-
- /* now, decrease the size of the read */
- if(data->state.infilesize>0) {
- data->state.infilesize -= data->state.resume_from;
-
- if(data->state.infilesize <= 0) {
- failf(data, "File already completely uploaded");
- return CURLE_PARTIAL_FILE;
- }
- }
- /* we've passed, proceed as normal */
- }
- }
- return CURLE_OK;
-}
-
-CURLcode Curl_http_firstwrite(struct Curl_easy *data,
- struct connectdata *conn,
- bool *done)
+CURLcode Curl_http_firstwrite(struct Curl_easy *data)
{
+ struct connectdata *conn = data->conn;
struct SingleRequest *k = &data->req;
- *done = FALSE;
if(data->req.newurl) {
if(conn->bits.close) {
/* Abort after the headers if "follow Location" is set
and we're set to close anyway. */
k->keepon &= ~KEEP_RECV;
- *done = TRUE;
+ k->done = TRUE;
return CURLE_OK;
}
/* We have a new url to load, but since we want to be able to reuse this
@@ -3007,7 +2431,7 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data,
streamclose(conn, "already downloaded");
/* Abort download */
k->keepon &= ~KEEP_RECV;
- *done = TRUE;
+ k->done = TRUE;
return CURLE_OK;
}
@@ -3025,7 +2449,7 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data,
action for an HTTP/1.1 client */
if(!Curl_meets_timecondition(data, k->timeofdoc)) {
- *done = TRUE;
+ k->done = TRUE;
/* We're simulating an HTTP 304 from server so we return
what should have been returned from the server */
data->info.httpcode = 304;
@@ -3083,7 +2507,6 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
{
struct connectdata *conn = data->conn;
CURLcode result = CURLE_OK;
- struct HTTP *http;
Curl_HttpReq httpreq;
const char *te = ""; /* transfer-encoding */
const char *request;
@@ -3128,8 +2551,12 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
break;
}
- http = data->req.p.http;
- DEBUGASSERT(http);
+ /* Add collecting of headers written to client. For a new connection,
+ * we might have done that already, but reuse
+ * or multiplex needs it here as well. */
+ result = Curl_headers_init(data);
+ if(result)
+ goto fail;
result = Curl_http_host(data, conn);
if(result)
@@ -3181,17 +2608,13 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto fail;
#endif
- result = Curl_http_body(data, conn, httpreq, &te);
+ result = Curl_http_req_set_reader(data, httpreq, &te);
if(result)
goto fail;
p_accept = Curl_checkheaders(data,
STRCONST("Accept"))?NULL:"Accept: */*\r\n";
- result = Curl_http_resume(data, conn, httpreq);
- if(result)
- goto fail;
-
result = Curl_http_range(data, httpreq);
if(result)
goto fail;
@@ -3309,46 +2732,14 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
result = Curl_add_custom_headers(data, FALSE, &req);
if(!result) {
- http->postdata = NULL; /* nothing to post at this point */
- if((httpreq == HTTPREQ_GET) ||
- (httpreq == HTTPREQ_HEAD))
- Curl_pgrsSetUploadSize(data, 0); /* nothing */
-
- /* bodysend takes ownership of the 'req' memory on success */
- result = Curl_http_bodysend(data, conn, &req, httpreq);
+ /* req_send takes ownership of the 'req' memory on success */
+ result = Curl_http_req_complete(data, &req, httpreq);
+ if(!result)
+ result = Curl_req_send(data, &req);
}
- if(result) {
- Curl_dyn_free(&req);
+ Curl_dyn_free(&req);
+ if(result)
goto fail;
- }
-
- if((http->postsize > -1) &&
- (http->postsize <= data->req.writebytecount) &&
- (http->sending != HTTPSEND_REQUEST))
- data->req.upload_done = TRUE;
-
- if(data->req.writebytecount) {
- /* if a request-body has been sent off, we make sure this progress is noted
- properly */
- Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
- if(Curl_pgrsUpdate(data))
- result = CURLE_ABORTED_BY_CALLBACK;
-
- if(!http->postsize) {
- /* already sent the entire request body, mark the "upload" as
- complete */
- infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T
- " out of %" CURL_FORMAT_CURL_OFF_T " bytes",
- data->req.writebytecount, http->postsize);
- data->req.upload_done = TRUE;
- data->req.keepon &= ~KEEP_SEND; /* we're done writing */
- data->req.exp100 = EXP100_SEND_DATA; /* already sent */
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
- }
- }
-
- if(data->req.upload_done)
- Curl_conn_ev_data_done_send(data);
if((conn->httpversion >= 20) && data->req.upload_chunky)
/* upload_chunky was set above to set up the request in a chunky fashion,
@@ -3433,325 +2824,368 @@ checkprotoprefix(struct Curl_easy *data, struct connectdata *conn,
return checkhttpprefix(data, s, len);
}
+/* HTTP header has field name `n` (a string constant) */
+#define HD_IS(hd, hdlen, n) \
+ (((hdlen) >= (sizeof(n)-1)) && curl_strnequal((n), (hd), (sizeof(n)-1)))
+
+#define HD_VAL(hd, hdlen, n) \
+ ((((hdlen) >= (sizeof(n)-1)) && \
+ curl_strnequal((n), (hd), (sizeof(n)-1)))? (hd + (sizeof(n)-1)) : NULL)
+
+/* HTTP header has field name `n` (a string constant) and contains `v`
+ * (a string constant) in its value(s) */
+#define HD_IS_AND_SAYS(hd, hdlen, n, v) \
+ (HD_IS(hd, hdlen, n) && \
+ ((hdlen) > ((sizeof(n)-1) + (sizeof(v)-1))) && \
+ Curl_compareheader(hd, STRCONST(n), STRCONST(v)))
+
/*
* Curl_http_header() parses a single response header.
*/
CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
- char *headp)
+ char *hd, size_t hdlen)
{
CURLcode result;
struct SingleRequest *k = &data->req;
- /* Check for Content-Length: header lines to get size */
- if(!k->http_bodyless &&
- !data->set.ignorecl && checkprefix("Content-Length:", headp)) {
- curl_off_t contentlength;
- CURLofft offt = curlx_strtoofft(headp + strlen("Content-Length:"),
- NULL, 10, &contentlength);
-
- if(offt == CURL_OFFT_OK) {
- k->size = contentlength;
- k->maxdownload = k->size;
+ const char *v;
+
+ switch(hd[0]) {
+ case 'a':
+ case 'A':
+#ifndef CURL_DISABLE_ALTSVC
+ v = (data->asi &&
+ ((conn->handler->flags & PROTOPT_SSL) ||
+#ifdef CURLDEBUG
+ /* allow debug builds to circumvent the HTTPS restriction */
+ getenv("CURL_ALTSVC_HTTP")
+#else
+ 0
+#endif
+ ))? HD_VAL(hd, hdlen, "Alt-Svc:") : NULL;
+ if(v) {
+ /* the ALPN of the current request */
+ enum alpnid id = (conn->httpversion == 30)? ALPN_h3 :
+ (conn->httpversion == 20) ? ALPN_h2 : ALPN_h1;
+ return Curl_altsvc_parse(data, data->asi, v, id, conn->host.name,
+ curlx_uitous((unsigned int)conn->remote_port));
}
- else if(offt == CURL_OFFT_FLOW) {
- /* out of range */
- if(data->set.max_filesize) {
- failf(data, "Maximum file size exceeded");
- return CURLE_FILESIZE_EXCEEDED;
+#endif
+ break;
+ case 'c':
+ case 'C':
+ /* Check for Content-Length: header lines to get size */
+ v = (!k->http_bodyless && !data->set.ignorecl)?
+ HD_VAL(hd, hdlen, "Content-Length:") : NULL;
+ if(v) {
+ curl_off_t contentlength;
+ CURLofft offt = curlx_strtoofft(v, NULL, 10, &contentlength);
+
+ if(offt == CURL_OFFT_OK) {
+ k->size = contentlength;
+ k->maxdownload = k->size;
+ }
+ else if(offt == CURL_OFFT_FLOW) {
+ /* out of range */
+ if(data->set.max_filesize) {
+ failf(data, "Maximum file size exceeded");
+ return CURLE_FILESIZE_EXCEEDED;
+ }
+ streamclose(conn, "overflow content-length");
+ infof(data, "Overflow Content-Length: value");
}
- streamclose(conn, "overflow content-length");
- infof(data, "Overflow Content-Length: value");
+ else {
+ /* negative or just rubbish - bad HTTP */
+ failf(data, "Invalid Content-Length: value");
+ return CURLE_WEIRD_SERVER_REPLY;
+ }
+ return CURLE_OK;
}
- else {
- /* negative or just rubbish - bad HTTP */
- failf(data, "Invalid Content-Length: value");
- return CURLE_WEIRD_SERVER_REPLY;
+ v = (!k->http_bodyless && data->set.str[STRING_ENCODING])?
+ HD_VAL(hd, hdlen, "Content-Encoding:") : NULL;
+ if(v) {
+ /*
+ * Process Content-Encoding. Look for the values: identity,
+ * gzip, deflate, compress, x-gzip and x-compress. x-gzip and
+ * x-compress are the same as gzip and compress. (Sec 3.5 RFC
+ * 2616). zlib cannot handle compress. However, errors are
+ * handled further down when the response body is processed
+ */
+ return Curl_build_unencoding_stack(data, v, FALSE);
}
- }
- /* check for Content-Type: header lines to get the MIME-type */
- else if(checkprefix("Content-Type:", headp)) {
- char *contenttype = Curl_copy_header_value(headp);
- if(!contenttype)
- return CURLE_OUT_OF_MEMORY;
- if(!*contenttype)
- /* ignore empty data */
- free(contenttype);
- else {
- Curl_safefree(data->info.contenttype);
- data->info.contenttype = contenttype;
+ /* check for Content-Type: header lines to get the MIME-type */
+ v = HD_VAL(hd, hdlen, "Content-Type:");
+ if(v) {
+ char *contenttype = Curl_copy_header_value(hd);
+ if(!contenttype)
+ return CURLE_OUT_OF_MEMORY;
+ if(!*contenttype)
+ /* ignore empty data */
+ free(contenttype);
+ else {
+ Curl_safefree(data->info.contenttype);
+ data->info.contenttype = contenttype;
+ }
+ return CURLE_OK;
}
- }
-#ifndef CURL_DISABLE_PROXY
- else if((conn->httpversion == 10) &&
- conn->bits.httpproxy &&
- Curl_compareheader(headp,
- STRCONST("Proxy-Connection:"),
- STRCONST("keep-alive"))) {
- /*
- * When an HTTP/1.0 reply comes when using a proxy, the
- * 'Proxy-Connection: keep-alive' line tells us the
- * connection will be kept alive for our pleasure.
- * Default action for 1.0 is to close.
- */
- connkeep(conn, "Proxy-Connection keep-alive"); /* don't close */
- infof(data, "HTTP/1.0 proxy connection set to keep alive");
- }
- else if((conn->httpversion == 11) &&
- conn->bits.httpproxy &&
- Curl_compareheader(headp,
- STRCONST("Proxy-Connection:"),
- STRCONST("close"))) {
- /*
- * We get an HTTP/1.1 response from a proxy and it says it'll
- * close down after this transfer.
- */
- connclose(conn, "Proxy-Connection: asked to close after done");
- infof(data, "HTTP/1.1 proxy connection set close");
- }
-#endif
- else if((conn->httpversion == 10) &&
- Curl_compareheader(headp,
- STRCONST("Connection:"),
- STRCONST("keep-alive"))) {
- /*
- * An HTTP/1.0 reply with the 'Connection: keep-alive' line
- * tells us the connection will be kept alive for our
- * pleasure. Default action for 1.0 is to close.
- *
- * [RFC2068, section 19.7.1] */
- connkeep(conn, "Connection keep-alive");
- infof(data, "HTTP/1.0 connection set to keep alive");
- }
- else if(Curl_compareheader(headp,
- STRCONST("Connection:"), STRCONST("close"))) {
- /*
- * [RFC 2616, section 8.1.2.1]
- * "Connection: close" is HTTP/1.1 language and means that
- * the connection will close when this request has been
- * served.
- */
- streamclose(conn, "Connection: close used");
- }
- else if(!k->http_bodyless && checkprefix("Transfer-Encoding:", headp)) {
- /* One or more encodings. We check for chunked and/or a compression
- algorithm. */
- /*
- * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
- * means that the server will send a series of "chunks". Each
- * chunk starts with line with info (including size of the
- * coming block) (terminated with CRLF), then a block of data
- * with the previously mentioned size. There can be any amount
- * of chunks, and a chunk-data set to zero signals the
- * end-of-chunks. */
-
- result = Curl_build_unencoding_stack(data,
- headp + strlen("Transfer-Encoding:"),
- TRUE);
- if(result)
- return result;
- if(!k->chunk && data->set.http_transfer_encoding) {
- /* if this isn't chunked, only close can signal the end of this transfer
- as Content-Length is said not to be trusted for transfer-encoding! */
- connclose(conn, "HTTP/1.1 transfer-encoding without chunks");
- k->ignore_cl = TRUE;
+ if(HD_IS_AND_SAYS(hd, hdlen, "Connection:", "close")) {
+ /*
+ * [RFC 2616, section 8.1.2.1]
+ * "Connection: close" is HTTP/1.1 language and means that
+ * the connection will close when this request has been
+ * served.
+ */
+ streamclose(conn, "Connection: close used");
+ return CURLE_OK;
}
- }
- else if(!k->http_bodyless && checkprefix("Content-Encoding:", headp) &&
- data->set.str[STRING_ENCODING]) {
- /*
- * Process Content-Encoding. Look for the values: identity,
- * gzip, deflate, compress, x-gzip and x-compress. x-gzip and
- * x-compress are the same as gzip and compress. (Sec 3.5 RFC
- * 2616). zlib cannot handle compress. However, errors are
- * handled further down when the response body is processed
- */
- result = Curl_build_unencoding_stack(data,
- headp + strlen("Content-Encoding:"),
- FALSE);
- if(result)
- return result;
- }
- else if(checkprefix("Retry-After:", headp)) {
- /* Retry-After = HTTP-date / delay-seconds */
- curl_off_t retry_after = 0; /* zero for unknown or "now" */
- /* Try it as a decimal number, if it works it is not a date */
- (void)curlx_strtoofft(headp + strlen("Retry-After:"),
- NULL, 10, &retry_after);
- if(!retry_after) {
- time_t date = Curl_getdate_capped(headp + strlen("Retry-After:"));
- if(-1 != date)
- /* convert date to number of seconds into the future */
- retry_after = date - time(NULL);
+ if((conn->httpversion == 10) &&
+ HD_IS_AND_SAYS(hd, hdlen, "Connection:", "keep-alive")) {
+ /*
+ * An HTTP/1.0 reply with the 'Connection: keep-alive' line
+ * tells us the connection will be kept alive for our
+ * pleasure. Default action for 1.0 is to close.
+ *
+ * [RFC2068, section 19.7.1] */
+ connkeep(conn, "Connection keep-alive");
+ infof(data, "HTTP/1.0 connection set to keep alive");
+ return CURLE_OK;
}
- data->info.retry_after = retry_after; /* store it */
- }
- else if(!k->http_bodyless && checkprefix("Content-Range:", headp)) {
- /* Content-Range: bytes [num]-
- Content-Range: bytes: [num]-
- Content-Range: [num]-
- Content-Range: [asterisk]/[total]
-
- The second format was added since Sun's webserver
- JavaWebServer/1.1.1 obviously sends the header this way!
- The third added since some servers use that!
- The fourth means the requested range was unsatisfied.
- */
-
- char *ptr = headp + strlen("Content-Range:");
-
- /* Move forward until first digit or asterisk */
- while(*ptr && !ISDIGIT(*ptr) && *ptr != '*')
- ptr++;
-
- /* if it truly stopped on a digit */
- if(ISDIGIT(*ptr)) {
- if(!curlx_strtoofft(ptr, NULL, 10, &k->offset)) {
- if(data->state.resume_from == k->offset)
- /* we asked for a resume and we got it */
- k->content_range = TRUE;
+ v = !k->http_bodyless? HD_VAL(hd, hdlen, "Content-Range:") : NULL;
+ if(v) {
+ /* Content-Range: bytes [num]-
+ Content-Range: bytes: [num]-
+ Content-Range: [num]-
+ Content-Range: [asterisk]/[total]
+
+ The second format was added since Sun's webserver
+ JavaWebServer/1.1.1 obviously sends the header this way!
+ The third added since some servers use that!
+ The fourth means the requested range was unsatisfied.
+ */
+
+ const char *ptr = v;
+
+ /* Move forward until first digit or asterisk */
+ while(*ptr && !ISDIGIT(*ptr) && *ptr != '*')
+ ptr++;
+
+ /* if it truly stopped on a digit */
+ if(ISDIGIT(*ptr)) {
+ if(!curlx_strtoofft(ptr, NULL, 10, &k->offset)) {
+ if(data->state.resume_from == k->offset)
+ /* we asked for a resume and we got it */
+ k->content_range = TRUE;
+ }
}
+ else if(k->httpcode < 300)
+ data->state.resume_from = 0; /* get everything */
}
- else if(k->httpcode < 300)
- data->state.resume_from = 0; /* get everything */
- }
-#if !defined(CURL_DISABLE_COOKIES)
- else if(data->cookies && data->state.cookie_engine &&
- checkprefix("Set-Cookie:", headp)) {
- /* If there is a custom-set Host: name, use it here, or else use real peer
- host name. */
- const char *host = data->state.aptr.cookiehost?
- data->state.aptr.cookiehost:conn->host.name;
- const bool secure_context =
- conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
- strcasecompare("localhost", host) ||
- !strcmp(host, "127.0.0.1") ||
- !strcmp(host, "::1") ? TRUE : FALSE;
-
- Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
- CURL_LOCK_ACCESS_SINGLE);
- Curl_cookie_add(data, data->cookies, TRUE, FALSE,
- headp + strlen("Set-Cookie:"), host,
- data->state.up.path, secure_context);
- Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
- }
-#endif
- else if(!k->http_bodyless && checkprefix("Last-Modified:", headp) &&
- (data->set.timecondition || data->set.get_filetime) ) {
- k->timeofdoc = Curl_getdate_capped(headp + strlen("Last-Modified:"));
- if(data->set.get_filetime)
- data->info.filetime = k->timeofdoc;
- }
- else if((checkprefix("WWW-Authenticate:", headp) &&
- (401 == k->httpcode)) ||
- (checkprefix("Proxy-authenticate:", headp) &&
- (407 == k->httpcode))) {
-
- bool proxy = (k->httpcode == 407) ? TRUE : FALSE;
- char *auth = Curl_copy_header_value(headp);
- if(!auth)
- return CURLE_OUT_OF_MEMORY;
+ break;
+ case 'l':
+ case 'L':
+ v = (!k->http_bodyless &&
+ (data->set.timecondition || data->set.get_filetime))?
+ HD_VAL(hd, hdlen, "Last-Modified:") : NULL;
+ if(v) {
+ k->timeofdoc = Curl_getdate_capped(v);
+ if(data->set.get_filetime)
+ data->info.filetime = k->timeofdoc;
+ return CURLE_OK;
+ }
+ if((k->httpcode >= 300 && k->httpcode < 400) &&
+ HD_IS(hd, hdlen, "Location:") &&
+ !data->req.location) {
+ /* this is the URL that the server advises us to use instead */
+ char *location = Curl_copy_header_value(hd);
+ if(!location)
+ return CURLE_OUT_OF_MEMORY;
+ if(!*location)
+ /* ignore empty data */
+ free(location);
+ else {
+ data->req.location = location;
- result = Curl_http_input_auth(data, proxy, auth);
+ if(data->set.http_follow_location) {
+ DEBUGASSERT(!data->req.newurl);
+ data->req.newurl = strdup(data->req.location); /* clone */
+ if(!data->req.newurl)
+ return CURLE_OUT_OF_MEMORY;
- free(auth);
+ /* some cases of POST and PUT etc needs to rewind the data
+ stream at this point */
+ result = http_perhapsrewind(data, conn);
+ if(result)
+ return result;
- if(result)
+ /* mark the next request as a followed location: */
+ data->state.this_is_a_follow = TRUE;
+ }
+ }
+ }
+ break;
+ case 'p':
+ case 'P':
+#ifndef CURL_DISABLE_PROXY
+ v = HD_VAL(hd, hdlen, "Proxy-Connection:");
+ if(v) {
+ if((conn->httpversion == 10) && conn->bits.httpproxy &&
+ HD_IS_AND_SAYS(hd, hdlen, "Proxy-Connection:", "keep-alive")) {
+ /*
+ * When an HTTP/1.0 reply comes when using a proxy, the
+ * 'Proxy-Connection: keep-alive' line tells us the
+ * connection will be kept alive for our pleasure.
+ * Default action for 1.0 is to close.
+ */
+ connkeep(conn, "Proxy-Connection keep-alive"); /* don't close */
+ infof(data, "HTTP/1.0 proxy connection set to keep alive");
+ }
+ else if((conn->httpversion == 11) && conn->bits.httpproxy &&
+ HD_IS_AND_SAYS(hd, hdlen, "Proxy-Connection:", "close")) {
+ /*
+ * We get an HTTP/1.1 response from a proxy and it says it'll
+ * close down after this transfer.
+ */
+ connclose(conn, "Proxy-Connection: asked to close after done");
+ infof(data, "HTTP/1.1 proxy connection set close");
+ }
+ return CURLE_OK;
+ }
+#endif
+ if((407 == k->httpcode) && HD_IS(hd, hdlen, "Proxy-authenticate:")) {
+ char *auth = Curl_copy_header_value(hd);
+ if(!auth)
+ return CURLE_OUT_OF_MEMORY;
+ result = Curl_http_input_auth(data, TRUE, auth);
+ free(auth);
return result;
- }
+ }
#ifdef USE_SPNEGO
- else if(checkprefix("Persistent-Auth:", headp)) {
- struct negotiatedata *negdata = &conn->negotiate;
- struct auth *authp = &data->state.authhost;
- if(authp->picked == CURLAUTH_NEGOTIATE) {
- char *persistentauth = Curl_copy_header_value(headp);
- if(!persistentauth)
- return CURLE_OUT_OF_MEMORY;
- negdata->noauthpersist = checkprefix("false", persistentauth)?
- TRUE:FALSE;
- negdata->havenoauthpersist = TRUE;
- infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
- negdata->noauthpersist, persistentauth);
- free(persistentauth);
+ if(HD_IS(hd, hdlen, "Persistent-Auth:")) {
+ struct negotiatedata *negdata = &conn->negotiate;
+ struct auth *authp = &data->state.authhost;
+ if(authp->picked == CURLAUTH_NEGOTIATE) {
+ char *persistentauth = Curl_copy_header_value(hd);
+ if(!persistentauth)
+ return CURLE_OUT_OF_MEMORY;
+ negdata->noauthpersist = checkprefix("false", persistentauth)?
+ TRUE:FALSE;
+ negdata->havenoauthpersist = TRUE;
+ infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
+ negdata->noauthpersist, persistentauth);
+ free(persistentauth);
+ }
}
- }
#endif
- else if((k->httpcode >= 300 && k->httpcode < 400) &&
- checkprefix("Location:", headp) &&
- !data->req.location) {
- /* this is the URL that the server advises us to use instead */
- char *location = Curl_copy_header_value(headp);
- if(!location)
- return CURLE_OUT_OF_MEMORY;
- if(!*location)
- /* ignore empty data */
- free(location);
- else {
- data->req.location = location;
-
- if(data->set.http_follow_location) {
- DEBUGASSERT(!data->req.newurl);
- data->req.newurl = strdup(data->req.location); /* clone */
- if(!data->req.newurl)
- return CURLE_OUT_OF_MEMORY;
-
- /* some cases of POST and PUT etc needs to rewind the data
- stream at this point */
- result = http_perhapsrewind(data, conn);
- if(result)
- return result;
-
- /* mark the next request as a followed location: */
- data->state.this_is_a_follow = TRUE;
+ break;
+ case 'r':
+ case 'R':
+ v = HD_VAL(hd, hdlen, "Retry-After:");
+ if(v) {
+ /* Retry-After = HTTP-date / delay-seconds */
+ curl_off_t retry_after = 0; /* zero for unknown or "now" */
+ /* Try it as a decimal number, if it works it is not a date */
+ (void)curlx_strtoofft(v, NULL, 10, &retry_after);
+ if(!retry_after) {
+ time_t date = Curl_getdate_capped(v);
+ if(-1 != date)
+ /* convert date to number of seconds into the future */
+ retry_after = date - time(NULL);
}
+ data->info.retry_after = retry_after; /* store it */
+ return CURLE_OK;
}
- }
+ break;
+ case 's':
+ case 'S':
+#if !defined(CURL_DISABLE_COOKIES)
+ v = (data->cookies && data->state.cookie_engine)?
+ HD_VAL(hd, hdlen, "Set-Cookie:") : NULL;
+ if(v) {
+ /* If there is a custom-set Host: name, use it here, or else use
+ * real peer host name. */
+ const char *host = data->state.aptr.cookiehost?
+ data->state.aptr.cookiehost:conn->host.name;
+ const bool secure_context =
+ conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
+ strcasecompare("localhost", host) ||
+ !strcmp(host, "127.0.0.1") ||
+ !strcmp(host, "::1") ? TRUE : FALSE;
+ Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
+ CURL_LOCK_ACCESS_SINGLE);
+ Curl_cookie_add(data, data->cookies, TRUE, FALSE, v, host,
+ data->state.up.path, secure_context);
+ Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE);
+ return CURLE_OK;
+ }
+#endif
#ifndef CURL_DISABLE_HSTS
- /* If enabled, the header is incoming and this is over HTTPS */
- else if(data->hsts && checkprefix("Strict-Transport-Security:", headp) &&
- ((conn->handler->flags & PROTOPT_SSL) ||
+ /* If enabled, the header is incoming and this is over HTTPS */
+ v = (data->hsts &&
+ ((conn->handler->flags & PROTOPT_SSL) ||
#ifdef CURLDEBUG
/* allow debug builds to circumvent the HTTPS restriction */
getenv("CURL_HSTS_HTTP")
#else
0
#endif
- )) {
- CURLcode check =
- Curl_hsts_parse(data->hsts, conn->host.name,
- headp + strlen("Strict-Transport-Security:"));
- if(check)
- infof(data, "Illegal STS header skipped");
+ )
+ )? HD_VAL(hd, hdlen, "Strict-Transport-Security:") : NULL;
+ if(v) {
+ CURLcode check =
+ Curl_hsts_parse(data->hsts, conn->host.name, v);
+ if(check)
+ infof(data, "Illegal STS header skipped");
#ifdef DEBUGBUILD
- else
- infof(data, "Parsed STS header fine (%zu entries)",
- data->hsts->list.size);
-#endif
- }
+ else
+ infof(data, "Parsed STS header fine (%zu entries)",
+ data->hsts->list.size);
#endif
-#ifndef CURL_DISABLE_ALTSVC
- /* If enabled, the header is incoming and this is over HTTPS */
- else if(data->asi && checkprefix("Alt-Svc:", headp) &&
- ((conn->handler->flags & PROTOPT_SSL) ||
-#ifdef CURLDEBUG
- /* allow debug builds to circumvent the HTTPS restriction */
- getenv("CURL_ALTSVC_HTTP")
-#else
- 0
+ }
#endif
- )) {
- /* the ALPN of the current request */
- enum alpnid id = (conn->httpversion == 30)? ALPN_h3 :
- (conn->httpversion == 20) ? ALPN_h2 : ALPN_h1;
- result = Curl_altsvc_parse(data, data->asi,
- headp + strlen("Alt-Svc:"),
- id, conn->host.name,
- curlx_uitous((unsigned int)conn->remote_port));
- if(result)
+ break;
+ case 't':
+ case 'T':
+ v = !k->http_bodyless? HD_VAL(hd, hdlen, "Transfer-Encoding:") : NULL;
+ if(v) {
+ /* One or more encodings. We check for chunked and/or a compression
+ algorithm. */
+ /*
+ * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
+ * means that the server will send a series of "chunks". Each
+ * chunk starts with line with info (including size of the
+ * coming block) (terminated with CRLF), then a block of data
+ * with the previously mentioned size. There can be any amount
+ * of chunks, and a chunk-data set to zero signals the
+ * end-of-chunks. */
+
+ result = Curl_build_unencoding_stack(data, v, TRUE);
+ if(result)
+ return result;
+ if(!k->chunk && data->set.http_transfer_encoding) {
+ /* if this isn't chunked, only close can signal the end of this
+ * transfer as Content-Length is said not to be trusted for
+ * transfer-encoding! */
+ connclose(conn, "HTTP/1.1 transfer-encoding without chunks");
+ k->ignore_cl = TRUE;
+ }
+ return CURLE_OK;
+ }
+ break;
+ case 'w':
+ case 'W':
+ if((401 == k->httpcode) && HD_IS(hd, hdlen, "WWW-Authenticate:")) {
+ char *auth = Curl_copy_header_value(hd);
+ if(!auth)
+ return CURLE_OUT_OF_MEMORY;
+ result = Curl_http_input_auth(data, FALSE, auth);
+ free(auth);
return result;
+ }
+ break;
}
-#endif
- else if(conn->handler->protocol & CURLPROTO_RTSP) {
- result = Curl_rtsp_parseheader(data, headp);
+
+ if(conn->handler->protocol & CURLPROTO_RTSP) {
+ result = Curl_rtsp_parseheader(data, hd);
if(result)
return result;
}
@@ -3762,18 +3196,38 @@ CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
* Called after the first HTTP response line (the status line) has been
* received and parsed.
*/
-
CURLcode Curl_http_statusline(struct Curl_easy *data,
struct connectdata *conn)
{
struct SingleRequest *k = &data->req;
+
+ switch(k->httpversion) {
+ case 10:
+ case 11:
+#ifdef USE_HTTP2
+ case 20:
+#endif
+#ifdef ENABLE_QUIC
+ case 30:
+#endif
+ /* TODO: we should verify that responses do not switch major
+ * HTTP version of the connection. Now, it seems we might accept
+ * a HTTP/2 response on a HTTP/1.1 connection, which is wrong. */
+ conn->httpversion = (unsigned char)k->httpversion;
+ break;
+ default:
+ failf(data, "Unsupported HTTP version (%u.%d) in response",
+ k->httpversion/10, k->httpversion%10);
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
+
data->info.httpcode = k->httpcode;
+ data->info.httpversion = k->httpversion;
+ conn->httpversion = (unsigned char)k->httpversion;
- data->info.httpversion = conn->httpversion;
- if(!data->state.httpversion ||
- data->state.httpversion > conn->httpversion)
+ if(!data->state.httpversion || data->state.httpversion > k->httpversion)
/* store the lowest server version we encounter */
- data->state.httpversion = conn->httpversion;
+ data->state.httpversion = (unsigned char)k->httpversion;
/*
* This code executes as part of processing the header. As a
@@ -3790,25 +3244,23 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
k->ignorebody = TRUE; /* Avoid appending error msg to good data. */
}
- if(conn->httpversion == 10) {
+ if(k->httpversion == 10) {
/* Default action for HTTP/1.0 must be to close, unless
we get one of those fancy headers that tell us the
server keeps it open for us! */
infof(data, "HTTP 1.0, assume close after body");
connclose(conn, "HTTP/1.0 close after body");
}
- else if(conn->httpversion == 20 ||
+ else if(k->httpversion == 20 ||
(k->upgr101 == UPGR101_H2 && k->httpcode == 101)) {
DEBUGF(infof(data, "HTTP/2 found, allow multiplexing"));
/* HTTP/2 cannot avoid multiplexing since it is a core functionality
of the protocol */
conn->bundle->multiuse = BUNDLE_MULTIPLEX;
}
- else if(conn->httpversion >= 11 &&
- !conn->bits.close) {
+ else if(k->httpversion >= 11 && !conn->bits.close) {
/* If HTTP version is >= 1.1 and connection is persistent */
- DEBUGF(infof(data,
- "HTTP 1.1 or later with persistent connection"));
+ DEBUGF(infof(data, "HTTP 1.1 or later with persistent connection"));
}
k->http_bodyless = k->httpcode >= 100 && k->httpcode < 200;
@@ -3916,6 +3368,285 @@ CURLcode Curl_bump_headersize(struct Curl_easy *data,
}
+static CURLcode http_on_response(struct Curl_easy *data,
+ const char *buf, size_t blen,
+ size_t *pconsumed)
+{
+ struct connectdata *conn = data->conn;
+ CURLcode result = CURLE_OK;
+ struct SingleRequest *k = &data->req;
+ bool switch_to_h2 = FALSE;
+
+ (void)buf; /* not used without HTTP2 enabled */
+ *pconsumed = 0;
+
+ if(k->upgr101 == UPGR101_RECEIVED) {
+ /* supposedly upgraded to http2 now */
+ if(conn->httpversion != 20)
+ infof(data, "Lying server, not serving HTTP/2");
+ }
+ if(conn->httpversion < 20) {
+ conn->bundle->multiuse = BUNDLE_NO_MULTIUSE;
+ }
+
+ if(k->httpcode < 100) {
+ failf(data, "Unsupported response code in HTTP response");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
+ else if(k->httpcode < 200) {
+ /* "A user agent MAY ignore unexpected 1xx status responses." */
+ switch(k->httpcode) {
+ case 100:
+ /*
+ * We have made an HTTP PUT or POST and this is 1.1-lingo
+ * that tells us that the server is OK with this and ready
+ * to receive the data.
+ * However, we'll get more headers now so we must get
+ * back into the header-parsing state!
+ */
+ k->header = TRUE;
+ k->headerline = 0; /* restart the header line counter */
+
+ /* if we did wait for this do enable write now! */
+ Curl_http_exp100_got100(data);
+ break;
+ case 101:
+ if(conn->httpversion == 11) {
+ /* Switching Protocols only allowed from HTTP/1.1 */
+ if(k->upgr101 == UPGR101_H2) {
+ /* Switching to HTTP/2 */
+ infof(data, "Received 101, Switching to HTTP/2");
+ k->upgr101 = UPGR101_RECEIVED;
+
+ /* we'll get more headers (HTTP/2 response) */
+ k->header = TRUE;
+ k->headerline = 0; /* restart the header line counter */
+ switch_to_h2 = TRUE;
+ }
+#ifdef USE_WEBSOCKETS
+ else if(k->upgr101 == UPGR101_WS) {
+ /* verify the response */
+ result = Curl_ws_accept(data, buf, blen);
+ if(result)
+ return result;
+ k->header = FALSE; /* no more header to parse! */
+ *pconsumed += blen; /* ws accept handled the data */
+ blen = 0;
+ if(data->set.connect_only)
+ k->keepon &= ~KEEP_RECV; /* read no more content */
+ }
+#endif
+ else {
+ /* Not switching to another protocol */
+ k->header = FALSE; /* no more header to parse! */
+ }
+ }
+ else {
+ /* invalid for other HTTP versions */
+ failf(data, "unexpected 101 response code");
+ return CURLE_WEIRD_SERVER_REPLY;
+ }
+ break;
+ default:
+ /* the status code 1xx indicates a provisional response, so
+ we'll get another set of headers */
+ k->header = TRUE;
+ k->headerline = 0; /* restart the header line counter */
+ break;
+ }
+ }
+ else {
+ /* k->httpcode >= 200, final response */
+ k->header = FALSE;
+
+ if(k->upgr101 == UPGR101_H2) {
+ /* A requested upgrade was denied, poke the multi handle to possibly
+ allow a pending pipewait to continue */
+ Curl_multi_connchanged(data->multi);
+ }
+
+ if((k->size == -1) && !k->chunk && !conn->bits.close &&
+ (conn->httpversion == 11) &&
+ !(conn->handler->protocol & CURLPROTO_RTSP) &&
+ data->state.httpreq != HTTPREQ_HEAD) {
+ /* On HTTP 1.1, when connection is not to get closed, but no
+ Content-Length nor Transfer-Encoding chunked have been
+ received, according to RFC2616 section 4.4 point 5, we
+ assume that the server will close the connection to
+ signal the end of the document. */
+ infof(data, "no chunk, no close, no size. Assume close to "
+ "signal end");
+ streamclose(conn, "HTTP: No end-of-message indicator");
+ }
+ }
+
+ if(!k->header) {
+ result = Curl_http_size(data);
+ if(result)
+ return result;
+ }
+
+ /* At this point we have some idea about the fate of the connection.
+ If we are closing the connection it may result auth failure. */
+#if defined(USE_NTLM)
+ if(conn->bits.close &&
+ (((data->req.httpcode == 401) &&
+ (conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
+ ((data->req.httpcode == 407) &&
+ (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
+ infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
+ data->state.authproblem = TRUE;
+ }
+#endif
+#if defined(USE_SPNEGO)
+ if(conn->bits.close &&
+ (((data->req.httpcode == 401) &&
+ (conn->http_negotiate_state == GSS_AUTHRECV)) ||
+ ((data->req.httpcode == 407) &&
+ (conn->proxy_negotiate_state == GSS_AUTHRECV)))) {
+ infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
+ data->state.authproblem = TRUE;
+ }
+ if((conn->http_negotiate_state == GSS_AUTHDONE) &&
+ (data->req.httpcode != 401)) {
+ conn->http_negotiate_state = GSS_AUTHSUCC;
+ }
+ if((conn->proxy_negotiate_state == GSS_AUTHDONE) &&
+ (data->req.httpcode != 407)) {
+ conn->proxy_negotiate_state = GSS_AUTHSUCC;
+ }
+#endif
+
+ /*
+ * When all the headers have been parsed, see if we should give
+ * up and return an error.
+ */
+ if(http_should_fail(data)) {
+ failf(data, "The requested URL returned error: %d",
+ k->httpcode);
+ return CURLE_HTTP_RETURNED_ERROR;
+ }
+
+#ifdef USE_WEBSOCKETS
+ /* All non-101 HTTP status codes are bad when wanting to upgrade to
+ websockets */
+ if(data->req.upgr101 == UPGR101_WS) {
+ failf(data, "Refused WebSockets upgrade: %d", k->httpcode);
+ return CURLE_HTTP_RETURNED_ERROR;
+ }
+#endif
+
+
+ /* Curl_http_auth_act() checks what authentication methods
+ * that are available and decides which one (if any) to
+ * use. It will set 'newurl' if an auth method was picked. */
+ result = Curl_http_auth_act(data);
+
+ if(result)
+ return result;
+
+ if(k->httpcode >= 300) {
+ if((!data->req.authneg) && !conn->bits.close &&
+ !Curl_creader_will_rewind(data)) {
+ /*
+ * General treatment of errors when about to send data. Including :
+ * "417 Expectation Failed", while waiting for 100-continue.
+ *
+ * The check for close above is done simply because of something
+ * else has already deemed the connection to get closed then
+ * something else should've considered the big picture and we
+ * avoid this check.
+ *
+ */
+
+ switch(data->state.httpreq) {
+ case HTTPREQ_PUT:
+ case HTTPREQ_POST:
+ case HTTPREQ_POST_FORM:
+ case HTTPREQ_POST_MIME:
+ /* We got an error response. If this happened before the whole
+ * request body has been sent we stop sending and mark the
+ * connection for closure after we've read the entire response.
+ */
+ if(!Curl_req_done_sending(data)) {
+ if((k->httpcode == 417) && Curl_http_exp100_is_selected(data)) {
+ /* 417 Expectation Failed - try again without the Expect
+ header */
+ if(!k->writebytecount && http_exp100_is_waiting(data)) {
+ infof(data, "Got HTTP failure 417 while waiting for a 100");
+ }
+ else {
+ infof(data, "Got HTTP failure 417 while sending data");
+ streamclose(conn,
+ "Stop sending data before everything sent");
+ result = http_perhapsrewind(data, conn);
+ if(result)
+ return result;
+ }
+ data->state.disableexpect = TRUE;
+ DEBUGASSERT(!data->req.newurl);
+ data->req.newurl = strdup(data->state.url);
+ Curl_req_abort_sending(data);
+ }
+ else if(data->set.http_keep_sending_on_error) {
+ infof(data, "HTTP error before end of send, keep sending");
+ http_exp100_send_anyway(data);
+ }
+ else {
+ infof(data, "HTTP error before end of send, stop sending");
+ streamclose(conn, "Stop sending data before everything sent");
+ result = Curl_req_abort_sending(data);
+ if(result)
+ return result;
+ }
+ }
+ break;
+
+ default: /* default label present to avoid compiler warnings */
+ break;
+ }
+ }
+
+ if(Curl_creader_will_rewind(data) && !Curl_req_done_sending(data)) {
+ /* We rewind before next send, continue sending now */
+ infof(data, "Keep sending data to get tossed away");
+ k->keepon |= KEEP_SEND;
+ }
+ }
+
+ if(!k->header) {
+ /*
+ * really end-of-headers.
+ *
+ * If we requested a "no body", this is a good time to get
+ * out and return home.
+ */
+ if(data->req.no_body)
+ k->download_done = TRUE;
+
+ /* If max download size is *zero* (nothing) we already have
+ nothing and can safely return ok now! But for HTTP/2, we'd
+ like to call http2_handle_stream_close to properly close a
+ stream. In order to do this, we keep reading until we
+ close the stream. */
+ if(0 == k->maxdownload
+ && !Curl_conn_is_http2(data, conn, FIRSTSOCKET)
+ && !Curl_conn_is_http3(data, conn, FIRSTSOCKET))
+ k->download_done = TRUE;
+ }
+
+ if(switch_to_h2) {
+ /* Having handled the headers, we can do the HTTP/2 switch.
+ * Any remaining `buf` bytes are already HTTP/2 and passed to
+ * be processed. */
+ result = Curl_http2_upgrade(data, conn, FIRSTSOCKET, buf, blen);
+ if(result)
+ return result;
+ *pconsumed += blen;
+ }
+
+ return CURLE_OK;
+}
/*
* Read any HTTP header lines from the server and pass them to the client app.
*/
@@ -3926,7 +3657,8 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
struct connectdata *conn = data->conn;
CURLcode result = CURLE_OK;
struct SingleRequest *k = &data->req;
- char *headp;
+ char *hd;
+ size_t hdlen;
char *end_ptr;
bool leftover_body = FALSE;
@@ -3958,6 +3690,10 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
/* this is not the beginning of a protocol first header line */
k->header = FALSE;
streamclose(conn, "bad HTTP: No end-of-message indicator");
+ if(conn->httpversion >= 10) {
+ failf(data, "Invalid status line");
+ return CURLE_WEIRD_SERVER_REPLY;
+ }
if(!data->set.http09_allowed) {
failf(data, "Received HTTP/0.9 when not allowed");
return CURLE_UNSUPPORTED_PROTOCOL;
@@ -3991,6 +3727,10 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
if(st == STATUS_BAD) {
streamclose(conn, "bad HTTP: No end-of-message indicator");
/* this is not the beginning of a protocol first header line */
+ if(conn->httpversion >= 10) {
+ failf(data, "Invalid status line");
+ return CURLE_WEIRD_SERVER_REPLY;
+ }
if(!data->set.http09_allowed) {
failf(data, "Received HTTP/0.9 when not allowed");
return CURLE_UNSUPPORTED_PROTOCOL;
@@ -4003,308 +3743,44 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
/* headers are in network encoding so use 0x0a and 0x0d instead of '\n'
and '\r' */
- headp = Curl_dyn_ptr(&data->state.headerb);
- if((0x0a == *headp) || (0x0d == *headp)) {
- size_t headerlen;
- bool switch_to_h2 = FALSE;
- /* Zero-length header line means end of headers! */
-
- if('\r' == *headp)
- headp++; /* pass the \r byte */
- if('\n' == *headp)
- headp++; /* pass the \n byte */
-
- if(100 <= k->httpcode && 199 >= k->httpcode) {
- /* "A user agent MAY ignore unexpected 1xx status responses." */
- switch(k->httpcode) {
- case 100:
- /*
- * We have made an HTTP PUT or POST and this is 1.1-lingo
- * that tells us that the server is OK with this and ready
- * to receive the data.
- * However, we'll get more headers now so we must get
- * back into the header-parsing state!
- */
- k->header = TRUE;
- k->headerline = 0; /* restart the header line counter */
-
- /* if we did wait for this do enable write now! */
- if(k->exp100 > EXP100_SEND_DATA) {
- k->exp100 = EXP100_SEND_DATA;
- k->keepon |= KEEP_SEND;
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
- }
- break;
- case 101:
- if(conn->httpversion == 11) {
- /* Switching Protocols only allowed from HTTP/1.1 */
- if(k->upgr101 == UPGR101_H2) {
- /* Switching to HTTP/2 */
- infof(data, "Received 101, Switching to HTTP/2");
- k->upgr101 = UPGR101_RECEIVED;
-
- /* we'll get more headers (HTTP/2 response) */
- k->header = TRUE;
- k->headerline = 0; /* restart the header line counter */
- switch_to_h2 = TRUE;
- }
-#ifdef USE_WEBSOCKETS
- else if(k->upgr101 == UPGR101_WS) {
- /* verify the response */
- result = Curl_ws_accept(data, buf, blen);
- if(result)
- return result;
- k->header = FALSE; /* no more header to parse! */
- *pconsumed += blen; /* ws accept handled the data */
- blen = 0;
- if(data->set.connect_only)
- k->keepon &= ~KEEP_RECV; /* read no more content */
- }
-#endif
- else {
- /* Not switching to another protocol */
- k->header = FALSE; /* no more header to parse! */
- }
- }
- else {
- /* invalid for other HTTP versions */
- failf(data, "unexpected 101 response code");
- return CURLE_WEIRD_SERVER_REPLY;
- }
- break;
- default:
- /* the status code 1xx indicates a provisional response, so
- we'll get another set of headers */
- k->header = TRUE;
- k->headerline = 0; /* restart the header line counter */
- break;
- }
- }
- else {
- if(k->upgr101 == UPGR101_H2) {
- /* A requested upgrade was denied, poke the multi handle to possibly
- allow a pending pipewait to continue */
- Curl_multi_connchanged(data->multi);
- }
- k->header = FALSE; /* no more header to parse! */
-
- if((k->size == -1) && !k->chunk && !conn->bits.close &&
- (conn->httpversion == 11) &&
- !(conn->handler->protocol & CURLPROTO_RTSP) &&
- data->state.httpreq != HTTPREQ_HEAD) {
- /* On HTTP 1.1, when connection is not to get closed, but no
- Content-Length nor Transfer-Encoding chunked have been
- received, according to RFC2616 section 4.4 point 5, we
- assume that the server will close the connection to
- signal the end of the document. */
- infof(data, "no chunk, no close, no size. Assume close to "
- "signal end");
- streamclose(conn, "HTTP: No end-of-message indicator");
- }
- }
-
- if(!k->header) {
- result = Curl_http_size(data);
- if(result)
- return result;
- }
-
- /* At this point we have some idea about the fate of the connection.
- If we are closing the connection it may result auth failure. */
-#if defined(USE_NTLM)
- if(conn->bits.close &&
- (((data->req.httpcode == 401) &&
- (conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
- ((data->req.httpcode == 407) &&
- (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
- infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
- data->state.authproblem = TRUE;
- }
-#endif
-#if defined(USE_SPNEGO)
- if(conn->bits.close &&
- (((data->req.httpcode == 401) &&
- (conn->http_negotiate_state == GSS_AUTHRECV)) ||
- ((data->req.httpcode == 407) &&
- (conn->proxy_negotiate_state == GSS_AUTHRECV)))) {
- infof(data, "Connection closure while negotiating auth (HTTP 1.0?)");
- data->state.authproblem = TRUE;
- }
- if((conn->http_negotiate_state == GSS_AUTHDONE) &&
- (data->req.httpcode != 401)) {
- conn->http_negotiate_state = GSS_AUTHSUCC;
- }
- if((conn->proxy_negotiate_state == GSS_AUTHDONE) &&
- (data->req.httpcode != 407)) {
- conn->proxy_negotiate_state = GSS_AUTHSUCC;
- }
-#endif
+ hd = Curl_dyn_ptr(&data->state.headerb);
+ hdlen = Curl_dyn_len(&data->state.headerb);
+ if((0x0a == *hd) || (0x0d == *hd)) {
+ /* Empty header line means end of headers! */
+ size_t consumed;
/* now, only output this if the header AND body are requested:
*/
+ Curl_debug(data, CURLINFO_HEADER_IN, hd, hdlen);
+
writetype = CLIENTWRITE_HEADER |
((k->httpcode/100 == 1) ? CLIENTWRITE_1XX : 0);
- headerlen = Curl_dyn_len(&data->state.headerb);
- result = Curl_client_write(data, writetype,
- Curl_dyn_ptr(&data->state.headerb),
- headerlen);
+ result = Curl_client_write(data, writetype, hd, hdlen);
if(result)
return result;
- result = Curl_bump_headersize(data, headerlen, FALSE);
+ result = Curl_bump_headersize(data, hdlen, FALSE);
if(result)
return result;
-
- /*
- * When all the headers have been parsed, see if we should give
- * up and return an error.
- */
- if(http_should_fail(data)) {
- failf(data, "The requested URL returned error: %d",
- k->httpcode);
- return CURLE_HTTP_RETURNED_ERROR;
- }
-
-#ifdef USE_WEBSOCKETS
- /* All non-101 HTTP status codes are bad when wanting to upgrade to
- websockets */
- if(data->req.upgr101 == UPGR101_WS) {
- failf(data, "Refused WebSockets upgrade: %d", k->httpcode);
- return CURLE_HTTP_RETURNED_ERROR;
- }
-#endif
-
+ /* We are done with this line. We reset because response
+ * processing might switch to HTTP/2 and that might call us
+ * directly again. */
+ Curl_dyn_reset(&data->state.headerb);
data->req.deductheadercount =
(100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0;
- /* Curl_http_auth_act() checks what authentication methods
- * that are available and decides which one (if any) to
- * use. It will set 'newurl' if an auth method was picked. */
- result = Curl_http_auth_act(data);
-
+ /* analyze the response to find out what to do */
+ result = http_on_response(data, buf, blen, &consumed);
if(result)
return result;
+ *pconsumed += consumed;
+ blen -= consumed;
+ buf += consumed;
- if(k->httpcode >= 300) {
- if((!conn->bits.authneg) && !conn->bits.close &&
- !data->state.rewindbeforesend) {
- /*
- * General treatment of errors when about to send data. Including :
- * "417 Expectation Failed", while waiting for 100-continue.
- *
- * The check for close above is done simply because of something
- * else has already deemed the connection to get closed then
- * something else should've considered the big picture and we
- * avoid this check.
- *
- * rewindbeforesend indicates that something has told libcurl to
- * continue sending even if it gets discarded
- */
-
- switch(data->state.httpreq) {
- case HTTPREQ_PUT:
- case HTTPREQ_POST:
- case HTTPREQ_POST_FORM:
- case HTTPREQ_POST_MIME:
- /* We got an error response. If this happened before the whole
- * request body has been sent we stop sending and mark the
- * connection for closure after we've read the entire response.
- */
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
- if(!k->upload_done) {
- if((k->httpcode == 417) && data->state.expect100header) {
- /* 417 Expectation Failed - try again without the Expect
- header */
- if(!k->writebytecount &&
- k->exp100 == EXP100_AWAITING_CONTINUE) {
- infof(data, "Got HTTP failure 417 while waiting for a 100");
- }
- else {
- infof(data, "Got HTTP failure 417 while sending data");
- streamclose(conn,
- "Stop sending data before everything sent");
- result = http_perhapsrewind(data, conn);
- if(result)
- return result;
- }
- data->state.disableexpect = TRUE;
- DEBUGASSERT(!data->req.newurl);
- data->req.newurl = strdup(data->state.url);
- Curl_done_sending(data, k);
- }
- else if(data->set.http_keep_sending_on_error) {
- infof(data, "HTTP error before end of send, keep sending");
- if(k->exp100 > EXP100_SEND_DATA) {
- k->exp100 = EXP100_SEND_DATA;
- k->keepon |= KEEP_SEND;
- }
- }
- else {
- infof(data, "HTTP error before end of send, stop sending");
- streamclose(conn, "Stop sending data before everything sent");
- result = Curl_done_sending(data, k);
- if(result)
- return result;
- k->upload_done = TRUE;
- if(data->state.expect100header)
- k->exp100 = EXP100_FAILED;
- }
- }
- break;
-
- default: /* default label present to avoid compiler warnings */
- break;
- }
- }
-
- if(data->state.rewindbeforesend &&
- (conn->writesockfd != CURL_SOCKET_BAD)) {
- /* We rewind before next send, continue sending now */
- infof(data, "Keep sending data to get tossed away");
- k->keepon |= KEEP_SEND;
- }
- }
-
- if(!k->header) {
- /*
- * really end-of-headers.
- *
- * If we requested a "no body", this is a good time to get
- * out and return home.
- */
- if(data->req.no_body)
- k->download_done = TRUE;
-
- /* If max download size is *zero* (nothing) we already have
- nothing and can safely return ok now! But for HTTP/2, we'd
- like to call http2_handle_stream_close to properly close a
- stream. In order to do this, we keep reading until we
- close the stream. */
- if(0 == k->maxdownload
- && !Curl_conn_is_http2(data, conn, FIRSTSOCKET)
- && !Curl_conn_is_http3(data, conn, FIRSTSOCKET))
- k->download_done = TRUE;
-
- Curl_debug(data, CURLINFO_HEADER_IN,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
+ if(!k->header || !blen)
goto out; /* exit header line loop */
- }
-
- /* We continue reading headers, reset the line-based header */
- Curl_dyn_reset(&data->state.headerb);
- if(switch_to_h2) {
- /* Having handled the headers, we can do the HTTP/2 switch.
- * Any remaining `buf` bytes are already HTTP/2 and passed to
- * be processed. */
- result = Curl_http2_upgrade(data, conn, FIRSTSOCKET, buf, blen);
- if(result)
- return result;
- *pconsumed += blen;
- blen = 0;
- }
continue;
}
@@ -4318,6 +3794,8 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
/* This is the first header, it MUST be the error code line
or else we consider this to be the body right away! */
bool fine_statusline = FALSE;
+
+ k->httpversion = 0; /* Don't know yet */
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
/*
* https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
@@ -4326,8 +3804,7 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
* says. We allow any three-digit number here, but we cannot make
* guarantees on future behaviors since it isn't within the protocol.
*/
- int httpversion = 0;
- char *p = headp;
+ char *p = hd;
while(*p && ISBLANK(*p))
p++;
@@ -4338,7 +3815,7 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
p++;
if((p[0] == '.') && (p[1] == '0' || p[1] == '1')) {
if(ISBLANK(p[2])) {
- httpversion = 10 + (p[1] - '0');
+ k->httpversion = 10 + (p[1] - '0');
p += 3;
if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
@@ -4358,7 +3835,7 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
case '3':
if(!ISBLANK(p[1]))
break;
- httpversion = (*p - '0') * 10;
+ k->httpversion = (*p - '0') * 10;
p += 2;
if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
@@ -4375,54 +3852,20 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
}
}
- if(fine_statusline) {
- if(k->httpcode < 100) {
- failf(data, "Unsupported response code in HTTP response");
- return CURLE_UNSUPPORTED_PROTOCOL;
- }
- switch(httpversion) {
- case 10:
- case 11:
-#ifdef USE_HTTP2
- case 20:
-#endif
-#ifdef ENABLE_QUIC
- case 30:
-#endif
- conn->httpversion = (unsigned char)httpversion;
- break;
- default:
- failf(data, "Unsupported HTTP version (%u.%d) in response",
- httpversion/10, httpversion%10);
- return CURLE_UNSUPPORTED_PROTOCOL;
- }
-
- if(k->upgr101 == UPGR101_RECEIVED) {
- /* supposedly upgraded to http2 now */
- if(conn->httpversion != 20)
- infof(data, "Lying server, not serving HTTP/2");
- }
- if(conn->httpversion < 20) {
- conn->bundle->multiuse = BUNDLE_NO_MULTIUSE;
- }
- }
- else {
+ if(!fine_statusline) {
/* If user has set option HTTP200ALIASES,
compare header line against list of aliases
*/
- statusline check =
- checkhttpprefix(data,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
+ statusline check = checkhttpprefix(data, hd, hdlen);
if(check == STATUS_DONE) {
fine_statusline = TRUE;
k->httpcode = 200;
- conn->httpversion = 10;
+ k->httpversion = 10;
}
}
}
else if(conn->handler->protocol & CURLPROTO_RTSP) {
- char *p = headp;
+ char *p = hd;
while(*p && ISBLANK(*p))
p++;
if(!strncmp(p, "RTSP/", 5)) {
@@ -4438,7 +3881,7 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
p += 3;
if(ISSPACE(*p)) {
fine_statusline = TRUE;
- conn->httpversion = 11; /* RTSP acts like HTTP 1.1 */
+ k->httpversion = 11; /* RTSP acts like HTTP 1.1 */
}
}
}
@@ -4465,26 +3908,22 @@ static CURLcode http_rw_headers(struct Curl_easy *data,
if(result)
return result;
- result = Curl_http_header(data, conn, headp);
+ result = Curl_http_header(data, conn, hd, hdlen);
if(result)
return result;
/*
- * End of header-checks. Write them to the client.
+ * Taken in one (more) header. Write it to the client.
*/
+ Curl_debug(data, CURLINFO_HEADER_IN, hd, hdlen);
+
if(k->httpcode/100 == 1)
writetype |= CLIENTWRITE_1XX;
-
- Curl_debug(data, CURLINFO_HEADER_IN, headp,
- Curl_dyn_len(&data->state.headerb));
-
- result = Curl_client_write(data, writetype, headp,
- Curl_dyn_len(&data->state.headerb));
+ result = Curl_client_write(data, writetype, hd, hdlen);
if(result)
return result;
- result = Curl_bump_headersize(data, Curl_dyn_len(&data->state.headerb),
- FALSE);
+ result = Curl_bump_headersize(data, hdlen, FALSE);
if(result)
return result;
@@ -4508,10 +3947,8 @@ out:
*/
CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
const char *buf, size_t blen,
- size_t *pconsumed,
- bool *done)
+ size_t *pconsumed)
{
- *done = FALSE;
if(!data->req.header) {
*pconsumed = 0;
return CURLE_OK;
@@ -4522,7 +3959,7 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
result = http_rw_headers(data, buf, blen, pconsumed);
if(!result && !data->req.header) {
/* we have successfully finished parsing the HEADERs */
- result = Curl_http_firstwrite(data, data->conn, done);
+ result = Curl_http_firstwrite(data);
if(!data->req.no_body && Curl_dyn_len(&data->state.headerb)) {
/* leftover from parsing something that turned out not
@@ -4540,23 +3977,21 @@ CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
CURLcode Curl_http_write_resp(struct Curl_easy *data,
const char *buf, size_t blen,
- bool is_eos,
- bool *done)
+ bool is_eos)
{
CURLcode result;
size_t consumed;
int flags;
- *done = FALSE;
- result = Curl_http_write_resp_hds(data, buf, blen, &consumed, done);
- if(result || *done)
+ result = Curl_http_write_resp_hds(data, buf, blen, &consumed);
+ if(result || data->req.done)
goto out;
DEBUGASSERT(consumed <= blen);
blen -= consumed;
buf += consumed;
/* either all was consumed in header parsing, or we have data left
- * and are done with heders, e.g. it is BODY data */
+ * and are done with headers, e.g. it is BODY data */
DEBUGASSERT(!blen || !data->req.header);
if(!data->req.header && (blen || is_eos)) {
/* BODY data after header been parsed, write and consume */
@@ -4938,4 +4373,142 @@ void Curl_http_resp_free(struct http_resp *resp)
}
}
+struct cr_exp100_ctx {
+ struct Curl_creader super;
+ struct curltime start; /* time started waiting */
+ enum expect100 state;
+};
+
+/* Expect: 100-continue client reader, blocking uploads */
+
+static void http_exp100_continue(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_exp100_ctx *ctx = reader->ctx;
+ if(ctx->state > EXP100_SEND_DATA) {
+ ctx->state = EXP100_SEND_DATA;
+ data->req.keepon |= KEEP_SEND;
+ data->req.keepon &= ~KEEP_SEND_TIMED;
+ Curl_expire_done(data, EXPIRE_100_TIMEOUT);
+ }
+}
+
+static CURLcode cr_exp100_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *nread, bool *eos)
+{
+ struct cr_exp100_ctx *ctx = reader->ctx;
+ timediff_t ms;
+
+ switch(ctx->state) {
+ case EXP100_SENDING_REQUEST:
+ /* We are now waiting for a reply from the server or
+ * a timeout on our side */
+ DEBUGF(infof(data, "cr_exp100_read, start AWAITING_CONTINUE"));
+ ctx->state = EXP100_AWAITING_CONTINUE;
+ ctx->start = Curl_now();
+ Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
+ data->req.keepon &= ~KEEP_SEND;
+ data->req.keepon |= KEEP_SEND_TIMED;
+ *nread = 0;
+ *eos = FALSE;
+ return CURLE_OK;
+ case EXP100_FAILED:
+ DEBUGF(infof(data, "cr_exp100_read, expectation failed, error"));
+ *nread = 0;
+ *eos = FALSE;
+ return CURLE_READ_ERROR;
+ case EXP100_AWAITING_CONTINUE:
+ ms = Curl_timediff(Curl_now(), ctx->start);
+ if(ms < data->set.expect_100_timeout) {
+ DEBUGF(infof(data, "cr_exp100_read, AWAITING_CONTINUE, not expired"));
+ data->req.keepon &= ~KEEP_SEND;
+ data->req.keepon |= KEEP_SEND_TIMED;
+ *nread = 0;
+ *eos = FALSE;
+ return CURLE_OK;
+ }
+ /* we've waited long enough, continue anyway */
+ http_exp100_continue(data, reader);
+ infof(data, "Done waiting for 100-continue");
+ FALLTHROUGH();
+ default:
+ DEBUGF(infof(data, "cr_exp100_read, pass through"));
+ return Curl_creader_read(data, reader->next, buf, blen, nread, eos);
+ }
+}
+
+static void cr_exp100_done(struct Curl_easy *data,
+ struct Curl_creader *reader, int premature)
+{
+ struct cr_exp100_ctx *ctx = reader->ctx;
+ ctx->state = premature? EXP100_FAILED : EXP100_SEND_DATA;
+ data->req.keepon &= ~KEEP_SEND_TIMED;
+ Curl_expire_done(data, EXPIRE_100_TIMEOUT);
+}
+
+static const struct Curl_crtype cr_exp100 = {
+ "cr-exp100",
+ Curl_creader_def_init,
+ cr_exp100_read,
+ Curl_creader_def_close,
+ Curl_creader_def_needs_rewind,
+ Curl_creader_def_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ cr_exp100_done,
+ sizeof(struct cr_exp100_ctx)
+};
+
+static CURLcode http_exp100_add_reader(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result;
+
+ result = Curl_creader_create(&reader, data, &cr_exp100,
+ CURL_CR_PROTOCOL);
+ if(!result)
+ result = Curl_creader_add(data, reader);
+ if(!result) {
+ struct cr_exp100_ctx *ctx = reader->ctx;
+ ctx->state = EXP100_SENDING_REQUEST;
+ }
+
+ if(result && reader)
+ Curl_creader_free(data, reader);
+ return result;
+}
+
+void Curl_http_exp100_got100(struct Curl_easy *data)
+{
+ struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
+ if(r)
+ http_exp100_continue(data, r);
+}
+
+static bool http_exp100_is_waiting(struct Curl_easy *data)
+{
+ struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
+ if(r) {
+ struct cr_exp100_ctx *ctx = r->ctx;
+ return (ctx->state == EXP100_AWAITING_CONTINUE);
+ }
+ return FALSE;
+}
+
+static void http_exp100_send_anyway(struct Curl_easy *data)
+{
+ struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
+ if(r)
+ http_exp100_continue(data, r);
+}
+
+bool Curl_http_exp100_is_selected(struct Curl_easy *data)
+{
+ struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
+ return r? TRUE : FALSE;
+}
+
#endif /* CURL_DISABLE_HTTP */
diff --git a/Utilities/cmcurl/lib/http.h b/Utilities/cmcurl/lib/http.h
index ad2697c..047709f 100644
--- a/Utilities/cmcurl/lib/http.h
+++ b/Utilities/cmcurl/lib/http.h
@@ -74,12 +74,6 @@ char *Curl_checkProxyheaders(struct Curl_easy *data,
const char *thisheader,
const size_t thislen);
struct HTTP; /* see below */
-CURLcode Curl_buffer_send(struct dynbuf *in,
- struct Curl_easy *data,
- struct HTTP *http,
- curl_off_t *bytes_written,
- curl_off_t included_body_bytes,
- int socketindex);
CURLcode Curl_add_timecondition(struct Curl_easy *data,
#ifndef USE_HYPER
@@ -100,10 +94,6 @@ CURLcode Curl_dynhds_add_custom(struct Curl_easy *data,
bool is_connect,
struct dynhds *hds);
-CURLcode Curl_http_compile_trailers(struct curl_slist *trailers,
- struct dynbuf *buf,
- struct Curl_easy *handle);
-
void Curl_http_method(struct Curl_easy *data, struct connectdata *conn,
const char **method, Curl_HttpReq *);
CURLcode Curl_http_useragent(struct Curl_easy *data);
@@ -113,13 +103,13 @@ CURLcode Curl_http_target(struct Curl_easy *data, struct connectdata *conn,
CURLcode Curl_http_statusline(struct Curl_easy *data,
struct connectdata *conn);
CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn,
- char *headp);
+ char *headp, size_t hdlen);
CURLcode Curl_transferencode(struct Curl_easy *data);
-CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn,
- Curl_HttpReq httpreq,
- const char **teep);
-CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn,
- struct dynbuf *r, Curl_HttpReq httpreq);
+CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
+ Curl_HttpReq httpreq,
+ const char **tep);
+CURLcode Curl_http_req_complete(struct Curl_easy *data,
+ struct dynbuf *r, Curl_HttpReq httpreq);
bool Curl_use_http_1_1plus(const struct Curl_easy *data,
const struct connectdata *conn);
#ifndef CURL_DISABLE_COOKIES
@@ -129,14 +119,9 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
#else
#define Curl_http_cookies(a,b,c) CURLE_OK
#endif
-CURLcode Curl_http_resume(struct Curl_easy *data,
- struct connectdata *conn,
- Curl_HttpReq httpreq);
CURLcode Curl_http_range(struct Curl_easy *data,
Curl_HttpReq httpreq);
-CURLcode Curl_http_firstwrite(struct Curl_easy *data,
- struct connectdata *conn,
- bool *done);
+CURLcode Curl_http_firstwrite(struct Curl_easy *data);
/* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http_setup_conn(struct Curl_easy *data,
@@ -148,8 +133,7 @@ int Curl_http_getsock_do(struct Curl_easy *data, struct connectdata *conn,
curl_socket_t *socks);
CURLcode Curl_http_write_resp(struct Curl_easy *data,
const char *buf, size_t blen,
- bool is_eos,
- bool *done);
+ bool is_eos);
/* These functions are in http.c */
CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
@@ -192,34 +176,20 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data);
version. This count includes CONNECT response headers. */
#define MAX_HTTP_RESP_HEADER_SIZE (300*1024)
+bool Curl_http_exp100_is_selected(struct Curl_easy *data);
+void Curl_http_exp100_got100(struct Curl_easy *data);
+
#endif /* CURL_DISABLE_HTTP */
/****************************************************************************
* HTTP unique setup
***************************************************************************/
struct HTTP {
- curl_off_t postsize; /* off_t to handle large file sizes */
- const char *postdata;
- struct back {
- curl_read_callback fread_func; /* backup storage for fread pointer */
- void *fread_in; /* backup storage for fread_in pointer */
- const char *postdata;
- curl_off_t postsize;
- struct Curl_easy *data;
- } backup;
-
- enum {
- HTTPSEND_NADA, /* init */
- HTTPSEND_REQUEST, /* sending a request */
- HTTPSEND_BODY /* sending body */
- } sending;
-
#ifndef CURL_DISABLE_HTTP
void *h2_ctx; /* HTTP/2 implementation context */
void *h3_ctx; /* HTTP/3 implementation context */
- struct dynbuf send_buffer; /* used if the request couldn't be sent in one
- chunk, points to an allocated send_buffer
- struct */
+#else
+ char unused;
#endif
};
@@ -227,8 +197,7 @@ CURLcode Curl_http_size(struct Curl_easy *data);
CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
const char *buf, size_t blen,
- size_t *pconsumed,
- bool *done);
+ size_t *pconsumed);
/**
* Curl_http_output_auth() setups the authentication headers for the
diff --git a/Utilities/cmcurl/lib/http2.c b/Utilities/cmcurl/lib/http2.c
index c3157d1..99d7f3b 100644
--- a/Utilities/cmcurl/lib/http2.c
+++ b/Utilities/cmcurl/lib/http2.c
@@ -121,7 +121,6 @@ static ssize_t populate_binsettings(uint8_t *binsettings,
struct cf_h2_ctx {
nghttp2_session *h2;
- uint32_t max_concurrent_streams;
/* The easy handle used in the current filter call, cleared at return */
struct cf_call_data call_data;
@@ -130,6 +129,7 @@ struct cf_h2_ctx {
struct bufc_pool stream_bufcp; /* spares for stream buffers */
size_t drain_total; /* sum of all stream's UrlState drain */
+ uint32_t max_concurrent_streams;
int32_t goaway_error;
int32_t last_stream_id;
BIT(conn_closed);
@@ -169,11 +169,9 @@ static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
struct Curl_easy *data);
/**
- * All about the H3 internals of a stream
+ * All about the H2 internals of a stream
*/
-struct stream_ctx {
- /*********** for HTTP/2 we store stream-local data here *************/
- int32_t id; /* HTTP/2 protocol identifier for stream */
+struct h2_stream_ctx {
struct bufq recvbuf; /* response buffer */
struct bufq sendbuf; /* request buffer */
struct h1_req_parser h1; /* parsing the request */
@@ -181,6 +179,7 @@ struct stream_ctx {
size_t resp_hds_len; /* amount of response header bytes in recvbuf */
size_t upload_blocked_len;
curl_off_t upload_left; /* number of request bytes left to upload */
+ curl_off_t nrcvd_data; /* number of DATA bytes received */
char **push_headers; /* allocated array */
size_t push_headers_used; /* number of entries filled in */
@@ -189,16 +188,18 @@ struct stream_ctx {
int status_code; /* HTTP response status code */
uint32_t error; /* stream error code */
uint32_t local_window_size; /* the local recv window size */
- bool resp_hds_complete; /* we have a complete, final response */
- bool closed; /* TRUE on stream close */
- bool reset; /* TRUE on stream reset */
- bool close_handled; /* TRUE if stream closure is handled by libcurl */
- bool bodystarted;
- bool send_closed; /* transfer is done sending, we might have still
- buffered data in stream->sendbuf to upload. */
+ int32_t id; /* HTTP/2 protocol identifier for stream */
+ BIT(resp_hds_complete); /* we have a complete, final response */
+ BIT(closed); /* TRUE on stream close */
+ BIT(reset); /* TRUE on stream reset */
+ BIT(close_handled); /* TRUE if stream closure is handled by libcurl */
+ BIT(bodystarted);
+ BIT(send_closed); /* transfer is done sending, we might have still
+ buffered data in stream->sendbuf to upload. */
};
-#define H2_STREAM_CTX(d) ((struct stream_ctx *)(((d) && (d)->req.p.http)? \
+#define H2_STREAM_CTX(d) ((struct h2_stream_ctx *)(((d) && \
+ (d)->req.p.http)? \
((struct HTTP *)(d)->req.p.http)->h2_ctx \
: NULL))
#define H2_STREAM_LCTX(d) ((struct HTTP *)(d)->req.p.http)->h2_ctx
@@ -210,7 +211,7 @@ struct stream_ctx {
*/
static void drain_stream(struct Curl_cfilter *cf,
struct Curl_easy *data,
- struct stream_ctx *stream)
+ struct h2_stream_ctx *stream)
{
unsigned char bits;
@@ -229,10 +230,10 @@ static void drain_stream(struct Curl_cfilter *cf,
static CURLcode http2_data_setup(struct Curl_cfilter *cf,
struct Curl_easy *data,
- struct stream_ctx **pstream)
+ struct h2_stream_ctx **pstream)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
(void)cf;
DEBUGASSERT(data);
@@ -253,8 +254,6 @@ static CURLcode http2_data_setup(struct Curl_cfilter *cf,
stream->id = -1;
Curl_bufq_initp(&stream->sendbuf, &ctx->stream_bufcp,
H2_STREAM_SEND_CHUNKS, BUFQ_OPT_NONE);
- Curl_bufq_initp(&stream->recvbuf, &ctx->stream_bufcp,
- H2_STREAM_RECV_CHUNKS, BUFQ_OPT_SOFT_LIMIT);
Curl_h1_req_parse_init(&stream->h1, H1_PARSE_DEFAULT_MAX_LINE_LEN);
Curl_dynhds_init(&stream->resp_trailers, 0, DYN_HTTP_REQUEST);
stream->resp_hds_len = 0;
@@ -265,20 +264,28 @@ static CURLcode http2_data_setup(struct Curl_cfilter *cf,
stream->error = NGHTTP2_NO_ERROR;
stream->local_window_size = H2_STREAM_WINDOW_SIZE;
stream->upload_left = 0;
+ stream->nrcvd_data = 0;
H2_STREAM_LCTX(data) = stream;
*pstream = stream;
return CURLE_OK;
}
-static void http2_data_done(struct Curl_cfilter *cf,
- struct Curl_easy *data, bool premature)
+static void free_push_headers(struct h2_stream_ctx *stream)
+{
+ size_t i;
+ for(i = 0; i<stream->push_headers_used; i++)
+ free(stream->push_headers[i]);
+ Curl_safefree(stream->push_headers);
+ stream->push_headers_used = 0;
+}
+
+static void http2_data_done(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
DEBUGASSERT(ctx);
- (void)premature;
if(!stream)
return;
@@ -298,34 +305,15 @@ static void http2_data_done(struct Curl_cfilter *cf,
stream->id, NGHTTP2_STREAM_CLOSED);
flush_egress = TRUE;
}
- if(!Curl_bufq_is_empty(&stream->recvbuf)) {
- /* Anything in the recvbuf is still being counted
- * in stream and connection window flow control. Need
- * to free that space or the connection window might get
- * exhausted eventually. */
- nghttp2_session_consume(ctx->h2, stream->id,
- Curl_bufq_len(&stream->recvbuf));
- /* give WINDOW_UPATE a chance to be sent, but ignore any error */
- flush_egress = TRUE;
- }
if(flush_egress)
nghttp2_session_send(ctx->h2);
}
Curl_bufq_free(&stream->sendbuf);
- Curl_bufq_free(&stream->recvbuf);
Curl_h1_req_parse_free(&stream->h1);
Curl_dynhds_free(&stream->resp_trailers);
- if(stream->push_headers) {
- /* if they weren't used and then freed before */
- for(; stream->push_headers_used > 0; --stream->push_headers_used) {
- free(stream->push_headers[stream->push_headers_used - 1]);
- }
- free(stream->push_headers);
- stream->push_headers = NULL;
- }
-
+ free_push_headers(stream);
free(stream);
H2_STREAM_LCTX(data) = NULL;
}
@@ -411,7 +399,7 @@ static CURLcode cf_h2_ctx_init(struct Curl_cfilter *cf,
bool via_h1_upgrade)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
CURLcode result = CURLE_OUT_OF_MEMORY;
int rc;
nghttp2_session_callbacks *cbs = NULL;
@@ -731,7 +719,7 @@ char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num)
if(!h || !GOOD_EASY_HANDLE(h->data))
return NULL;
else {
- struct stream_ctx *stream = H2_STREAM_CTX(h->data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(h->data);
if(stream && num < stream->push_headers_used)
return stream->push_headers[num];
}
@@ -743,7 +731,7 @@ char *curl_pushheader_bynum(struct curl_pushheaders *h, size_t num)
*/
char *curl_pushheader_byname(struct curl_pushheaders *h, const char *header)
{
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
size_t len;
size_t i;
/* Verify that we got a good easy handle in the push header struct,
@@ -783,7 +771,7 @@ static struct Curl_easy *h2_duphandle(struct Curl_cfilter *cf,
(void)Curl_close(&second);
}
else {
- struct stream_ctx *second_stream;
+ struct h2_stream_ctx *second_stream;
second->req.p.http = http;
http2_data_setup(cf, second, &second_stream);
@@ -850,9 +838,8 @@ fail:
static void discard_newhandle(struct Curl_cfilter *cf,
struct Curl_easy *newhandle)
{
- if(!newhandle->req.p.http) {
- http2_data_done(cf, newhandle, TRUE);
- newhandle->req.p.http = NULL;
+ if(newhandle->req.p.http) {
+ http2_data_done(cf, newhandle);
}
(void)Curl_close(&newhandle);
}
@@ -867,12 +854,11 @@ static int push_promise(struct Curl_cfilter *cf,
CURL_TRC_CF(data, cf, "[%d] PUSH_PROMISE received",
frame->promised_stream_id);
if(data->multi->push_cb) {
- struct stream_ctx *stream;
- struct stream_ctx *newstream;
+ struct h2_stream_ctx *stream;
+ struct h2_stream_ctx *newstream;
struct curl_pushheaders heads;
CURLMcode rc;
CURLcode result;
- size_t i;
/* clone the parent */
struct Curl_easy *newhandle = h2_duphandle(cf, data);
if(!newhandle) {
@@ -917,11 +903,7 @@ static int push_promise(struct Curl_cfilter *cf,
Curl_set_in_callback(data, false);
/* free the headers again */
- for(i = 0; i<stream->push_headers_used; i++)
- free(stream->push_headers[i]);
- free(stream->push_headers);
- stream->push_headers = NULL;
- stream->push_headers_used = 0;
+ free_push_headers(stream);
if(rv) {
DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
@@ -967,18 +949,8 @@ static CURLcode recvbuf_write_hds(struct Curl_cfilter *cf,
struct Curl_easy *data,
const char *buf, size_t blen)
{
- struct stream_ctx *stream = H2_STREAM_CTX(data);
- ssize_t nwritten;
- CURLcode result;
-
(void)cf;
- nwritten = Curl_bufq_write(&stream->recvbuf,
- (const unsigned char *)buf, blen, &result);
- if(nwritten < 0)
- return result;
- stream->resp_hds_len += (size_t)nwritten;
- DEBUGASSERT((size_t)nwritten == blen);
- return CURLE_OK;
+ return Curl_xfer_write_resp(data, (char *)buf, blen, FALSE);
}
static CURLcode on_stream_frame(struct Curl_cfilter *cf,
@@ -986,10 +958,9 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf,
const nghttp2_frame *frame)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
int32_t stream_id = frame->hd.stream_id;
CURLcode result;
- size_t rbuflen;
int rv;
if(!stream) {
@@ -999,9 +970,8 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf,
switch(frame->hd.type) {
case NGHTTP2_DATA:
- rbuflen = Curl_bufq_len(&stream->recvbuf);
- CURL_TRC_CF(data, cf, "[%d] DATA, buffered=%zu, window=%d/%d",
- stream_id, rbuflen,
+ CURL_TRC_CF(data, cf, "[%d] DATA, window=%d/%d",
+ stream_id,
nghttp2_session_get_stream_effective_recv_data_length(
ctx->h2, stream->id),
nghttp2_session_get_stream_effective_local_window_size(
@@ -1018,20 +988,6 @@ static CURLcode on_stream_frame(struct Curl_cfilter *cf,
if(frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
drain_stream(cf, data, stream);
}
- else if(rbuflen > stream->local_window_size) {
- int32_t wsize = nghttp2_session_get_stream_local_window_size(
- ctx->h2, stream->id);
- if(wsize > 0 && (uint32_t)wsize != stream->local_window_size) {
- /* H2 flow control is not absolute, as the server might not have the
- * same view, yet. When we receive more than we want, we enforce
- * the local window size again to make nghttp2 send WINDOW_UPATEs
- * accordingly. */
- nghttp2_session_set_local_window_size(ctx->h2,
- NGHTTP2_FLAG_NONE,
- stream->id,
- stream->local_window_size);
- }
- }
break;
case NGHTTP2_HEADERS:
if(stream->bodystarted) {
@@ -1233,7 +1189,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame,
* servers send an explicit WINDOW_UPDATE, but not all seem to do that.
* To be safe, we UNHOLD a stream in order not to stall. */
if(CURL_WANT_SEND(data)) {
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
if(stream)
drain_stream(cf, data, stream);
}
@@ -1270,9 +1226,9 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
const uint8_t *mem, size_t len, void *userp)
{
struct Curl_cfilter *cf = userp;
- struct stream_ctx *stream;
+ struct cf_h2_ctx *ctx = cf->ctx;
+ struct h2_stream_ctx *stream;
struct Curl_easy *data_s;
- ssize_t nwritten;
CURLcode result;
(void)flags;
@@ -1296,18 +1252,15 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
- nwritten = Curl_bufq_write(&stream->recvbuf, mem, len, &result);
- if(nwritten < 0) {
- if(result != CURLE_AGAIN)
- return NGHTTP2_ERR_CALLBACK_FAILURE;
+ result = Curl_xfer_write_resp(data_s, (char *)mem, len, FALSE);
+ if(result && result != CURLE_AGAIN)
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
- nwritten = 0;
- }
+ nghttp2_session_consume(ctx->h2, stream_id, len);
+ stream->nrcvd_data += (curl_off_t)len;
/* if we receive data for another handle, wake that up */
drain_stream(cf, data_s, stream);
-
- DEBUGASSERT((size_t)nwritten == len);
return 0;
}
@@ -1316,7 +1269,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
{
struct Curl_cfilter *cf = userp;
struct Curl_easy *data_s, *call_data = CF_DATA_CURRENT(cf);
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
int rv;
(void)session;
@@ -1374,7 +1327,7 @@ static int on_begin_headers(nghttp2_session *session,
const nghttp2_frame *frame, void *userp)
{
struct Curl_cfilter *cf = userp;
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
struct Curl_easy *data_s = NULL;
(void)cf;
@@ -1403,7 +1356,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
void *userp)
{
struct Curl_cfilter *cf = userp;
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
struct Curl_easy *data_s;
int32_t stream_id = frame->hd.stream_id;
CURLcode result;
@@ -1459,7 +1412,7 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
stream->push_headers = malloc(stream->push_headers_alloc *
sizeof(char *));
if(!stream->push_headers)
- return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
stream->push_headers_used = 0;
}
else if(stream->push_headers_used ==
@@ -1468,15 +1421,15 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
if(stream->push_headers_alloc > 1000) {
/* this is beyond crazy many headers, bail out */
failf(data_s, "Too many PUSH_PROMISE headers");
- Curl_safefree(stream->push_headers);
- return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
+ free_push_headers(stream);
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
}
stream->push_headers_alloc *= 2;
- headp = Curl_saferealloc(stream->push_headers,
- stream->push_headers_alloc * sizeof(char *));
+ headp = realloc(stream->push_headers,
+ stream->push_headers_alloc * sizeof(char *));
if(!headp) {
- stream->push_headers = NULL;
- return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
+ free_push_headers(stream);
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
}
stream->push_headers = headp;
}
@@ -1565,7 +1518,7 @@ static ssize_t req_body_read_callback(nghttp2_session *session,
{
struct Curl_cfilter *cf = userp;
struct Curl_easy *data_s;
- struct stream_ctx *stream = NULL;
+ struct h2_stream_ctx *stream = NULL;
CURLcode result;
ssize_t nread;
(void)source;
@@ -1667,7 +1620,7 @@ static CURLcode http2_data_done_send(struct Curl_cfilter *cf,
{
struct cf_h2_ctx *ctx = cf->ctx;
CURLcode result = CURLE_OK;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
if(!ctx || !ctx->h2 || !stream)
goto out;
@@ -1691,7 +1644,7 @@ out:
static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf,
struct Curl_easy *data,
- struct stream_ctx *stream,
+ struct h2_stream_ctx *stream,
CURLcode *err)
{
ssize_t rv = 0;
@@ -1713,7 +1666,7 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf,
}
else if(stream->reset) {
failf(data, "HTTP/2 stream %u was reset", stream->id);
- *err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
+ *err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
return -1;
}
@@ -1787,7 +1740,7 @@ static void h2_pri_spec(struct Curl_easy *data,
nghttp2_priority_spec *pri_spec)
{
struct Curl_data_priority *prio = &data->set.priority;
- struct stream_ctx *depstream = H2_STREAM_CTX(prio->parent);
+ struct h2_stream_ctx *depstream = H2_STREAM_CTX(prio->parent);
int32_t depstream_id = depstream? depstream->id:0;
nghttp2_priority_spec_init(pri_spec, depstream_id,
sweight_wanted(data),
@@ -1805,7 +1758,7 @@ static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
struct Curl_easy *data)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
int rv = 0;
if(stream && stream->id > 0 &&
@@ -1838,40 +1791,26 @@ out:
}
static ssize_t stream_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
- struct stream_ctx *stream,
+ struct h2_stream_ctx *stream,
char *buf, size_t len, CURLcode *err)
{
struct cf_h2_ctx *ctx = cf->ctx;
ssize_t nread = -1;
+ (void)buf;
*err = CURLE_AGAIN;
- if(!Curl_bufq_is_empty(&stream->recvbuf)) {
- nread = Curl_bufq_read(&stream->recvbuf,
- (unsigned char *)buf, len, err);
- if(nread < 0)
- goto out;
- DEBUGASSERT(nread > 0);
- }
-
- if(nread < 0) {
- if(stream->closed) {
- CURL_TRC_CF(data, cf, "[%d] returning CLOSE", stream->id);
- nread = http2_handle_stream_close(cf, data, stream, err);
- }
- else if(stream->reset ||
- (ctx->conn_closed && Curl_bufq_is_empty(&ctx->inbufq)) ||
- (ctx->goaway && ctx->last_stream_id < stream->id)) {
- CURL_TRC_CF(data, cf, "[%d] returning ERR", stream->id);
- *err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
- nread = -1;
- }
- }
- else if(nread == 0) {
- *err = CURLE_AGAIN;
+ if(stream->closed) {
+ CURL_TRC_CF(data, cf, "[%d] returning CLOSE", stream->id);
+ nread = http2_handle_stream_close(cf, data, stream, err);
+ }
+ else if(stream->reset ||
+ (ctx->conn_closed && Curl_bufq_is_empty(&ctx->inbufq)) ||
+ (ctx->goaway && ctx->last_stream_id < stream->id)) {
+ CURL_TRC_CF(data, cf, "[%d] returning ERR", stream->id);
+ *err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP2;
nread = -1;
}
-out:
if(nread < 0 && *err != CURLE_AGAIN)
CURL_TRC_CF(data, cf, "[%d] stream_recv(len=%zu) -> %zd, %d",
stream->id, len, nread, *err);
@@ -1879,10 +1818,11 @@ out:
}
static CURLcode h2_progress_ingress(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ size_t data_max_bytes)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream;
+ struct h2_stream_ctx *stream;
CURLcode result = CURLE_OK;
ssize_t nread;
@@ -1899,16 +1839,17 @@ static CURLcode h2_progress_ingress(struct Curl_cfilter *cf,
* all network input */
while(!ctx->conn_closed && Curl_bufq_is_empty(&ctx->inbufq)) {
stream = H2_STREAM_CTX(data);
- if(stream && (stream->closed || Curl_bufq_is_full(&stream->recvbuf))) {
+ if(stream && (stream->closed || !data_max_bytes)) {
/* We would like to abort here and stop processing, so that
* the transfer loop can handle the data/close here. However,
* this may leave data in underlying buffers that will not
* be consumed. */
if(!cf->next || !cf->next->cft->has_data_pending(cf->next, data))
- break;
+ drain_stream(cf, data, stream);
+ break;
}
- nread = Curl_bufq_slurp(&ctx->inbufq, nw_in_reader, cf, &result);
+ nread = Curl_bufq_sipn(&ctx->inbufq, 0, nw_in_reader, cf, &result);
if(nread < 0) {
if(result != CURLE_AGAIN) {
failf(data, "Failed receiving HTTP2 data: %d(%s)", result,
@@ -1923,8 +1864,9 @@ static CURLcode h2_progress_ingress(struct Curl_cfilter *cf,
break;
}
else {
- CURL_TRC_CF(data, cf, "[0] ingress: read %zd bytes",
- nread);
+ CURL_TRC_CF(data, cf, "[0] ingress: read %zd bytes", nread);
+ data_max_bytes = (data_max_bytes > (size_t)nread)?
+ (data_max_bytes - (size_t)nread) : 0;
}
if(h2_process_pending_input(cf, data, &result))
@@ -1942,7 +1884,7 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
char *buf, size_t len, CURLcode *err)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
ssize_t nread = -1;
CURLcode result;
struct cf_call_data save;
@@ -1966,7 +1908,7 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
goto out;
if(nread < 0) {
- *err = h2_progress_ingress(cf, data);
+ *err = h2_progress_ingress(cf, data, len);
if(*err)
goto out;
@@ -2011,9 +1953,8 @@ out:
nread = -1;
}
CURL_TRC_CF(data, cf, "[%d] cf_recv(len=%zu) -> %zd %d, "
- "buffered=%zu, window=%d/%d, connection %d/%d",
+ "window=%d/%d, connection %d/%d",
stream->id, len, nread, *err,
- Curl_bufq_len(&stream->recvbuf),
nghttp2_session_get_stream_effective_recv_data_length(
ctx->h2, stream->id),
nghttp2_session_get_stream_effective_local_window_size(
@@ -2025,12 +1966,13 @@ out:
return nread;
}
-static ssize_t h2_submit(struct stream_ctx **pstream,
+static ssize_t h2_submit(struct h2_stream_ctx **pstream,
struct Curl_cfilter *cf, struct Curl_easy *data,
- const void *buf, size_t len, CURLcode *err)
+ const void *buf, size_t len,
+ size_t *phdslen, CURLcode *err)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = NULL;
+ struct h2_stream_ctx *stream = NULL;
struct dynhds h2_headers;
nghttp2_nv *nva = NULL;
const void *body = NULL;
@@ -2040,6 +1982,7 @@ static ssize_t h2_submit(struct stream_ctx **pstream,
nghttp2_priority_spec pri_spec;
ssize_t nwritten;
+ *phdslen = 0;
Curl_dynhds_init(&h2_headers, 0, DYN_HTTP_REQUEST);
*err = http2_data_setup(cf, data, &stream);
@@ -2051,6 +1994,7 @@ static ssize_t h2_submit(struct stream_ctx **pstream,
nwritten = Curl_h1_req_parse_read(&stream->h1, buf, len, NULL, 0, err);
if(nwritten < 0)
goto out;
+ *phdslen = (size_t)nwritten;
if(!stream->h1.done) {
/* need more data */
goto out;
@@ -2169,10 +2113,11 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
const void *buf, size_t len, CURLcode *err)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
struct cf_call_data save;
int rv;
ssize_t nwritten;
+ size_t hdslen = 0;
CURLcode result;
int blocked = 0, was_blocked = 0;
@@ -2236,11 +2181,12 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
}
}
else {
- nwritten = h2_submit(&stream, cf, data, buf, len, err);
+ nwritten = h2_submit(&stream, cf, data, buf, len, &hdslen, err);
if(nwritten < 0) {
goto out;
}
DEBUGASSERT(stream);
+ DEBUGASSERT(hdslen <= (size_t)nwritten);
}
/* Call the nghttp2 send loop and flush to write ALL buffered data,
@@ -2275,18 +2221,26 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
* frame buffer or our network out buffer. */
size_t rwin = nghttp2_session_get_stream_remote_window_size(ctx->h2,
stream->id);
- /* Whatever the cause, we need to return CURL_EAGAIN for this call.
- * We have unwritten state that needs us being invoked again and EAGAIN
- * is the only way to ensure that. */
- stream->upload_blocked_len = nwritten;
+ /* At the start of a stream, we are called with request headers
+ * and, possibly, parts of the body. Later, only body data.
+ * If we cannot send pure body data, we EAGAIN. If there had been
+ * header, we return that *they* have been written and remember the
+ * block on the data length only. */
+ stream->upload_blocked_len = ((size_t)nwritten) - hdslen;
CURL_TRC_CF(data, cf, "[%d] cf_send(len=%zu) BLOCK: win %u/%zu "
- "blocked_len=%zu",
+ "hds_len=%zu blocked_len=%zu",
stream->id, len,
nghttp2_session_get_remote_window_size(ctx->h2), rwin,
- nwritten);
- *err = CURLE_AGAIN;
- nwritten = -1;
- goto out;
+ hdslen, stream->upload_blocked_len);
+ if(hdslen) {
+ *err = CURLE_OK;
+ nwritten = hdslen;
+ }
+ else {
+ *err = CURLE_AGAIN;
+ nwritten = -1;
+ goto out;
+ }
}
else if(should_close_session(ctx)) {
/* nghttp2 thinks this session is done. If the stream has not been
@@ -2340,7 +2294,7 @@ static void cf_h2_adjust_pollset(struct Curl_cfilter *cf,
sock = Curl_conn_cf_get_socket(cf, data);
Curl_pollset_check(data, ps, sock, &want_recv, &want_send);
if(want_recv || want_send) {
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
struct cf_call_data save;
bool c_exhaust, s_exhaust;
@@ -2387,7 +2341,7 @@ static CURLcode cf_h2_connect(struct Curl_cfilter *cf,
goto out;
}
- result = h2_progress_ingress(cf, data);
+ result = h2_progress_ingress(cf, data, H2_CHUNK_SIZE);
if(result)
goto out;
@@ -2441,7 +2395,7 @@ static CURLcode http2_data_pause(struct Curl_cfilter *cf,
{
#ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
DEBUGASSERT(data);
if(ctx && ctx->h2 && stream) {
@@ -2510,10 +2464,10 @@ static CURLcode cf_h2_cntrl(struct Curl_cfilter *cf,
result = http2_data_done_send(cf, data);
break;
case CF_CTRL_DATA_DETACH:
- http2_data_done(cf, data, TRUE);
+ http2_data_done(cf, data);
break;
case CF_CTRL_DATA_DONE:
- http2_data_done(cf, data, arg1 != 0);
+ http2_data_done(cf, data);
break;
default:
break;
@@ -2526,11 +2480,10 @@ static bool cf_h2_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data)
{
struct cf_h2_ctx *ctx = cf->ctx;
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
if(ctx && (!Curl_bufq_is_empty(&ctx->inbufq)
- || (stream && !Curl_bufq_is_empty(&stream->sendbuf))
- || (stream && !Curl_bufq_is_empty(&stream->recvbuf))))
+ || (stream && !Curl_bufq_is_empty(&stream->sendbuf))))
return TRUE;
return cf->next? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
}
@@ -2615,7 +2568,8 @@ struct Curl_cftype Curl_cft_nghttp2 = {
static CURLcode http2_cfilter_add(struct Curl_cfilter **pcf,
struct Curl_easy *data,
struct connectdata *conn,
- int sockindex)
+ int sockindex,
+ bool via_h1_upgrade)
{
struct Curl_cfilter *cf = NULL;
struct cf_h2_ctx *ctx;
@@ -2630,8 +2584,9 @@ static CURLcode http2_cfilter_add(struct Curl_cfilter **pcf,
if(result)
goto out;
+ ctx = NULL;
Curl_conn_cf_add(data, conn, sockindex, cf);
- result = CURLE_OK;
+ result = cf_h2_ctx_init(cf, data, via_h1_upgrade);
out:
if(result)
@@ -2641,7 +2596,8 @@ out:
}
static CURLcode http2_cfilter_insert_after(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ bool via_h1_upgrade)
{
struct Curl_cfilter *cf_h2 = NULL;
struct cf_h2_ctx *ctx;
@@ -2656,8 +2612,9 @@ static CURLcode http2_cfilter_insert_after(struct Curl_cfilter *cf,
if(result)
goto out;
+ ctx = NULL;
Curl_conn_cf_insert_after(cf, cf_h2);
- result = CURLE_OK;
+ result = cf_h2_ctx_init(cf_h2, data, via_h1_upgrade);
out:
if(result)
@@ -2714,11 +2671,7 @@ CURLcode Curl_http2_switch(struct Curl_easy *data,
DEBUGASSERT(!Curl_conn_is_http2(data, conn, sockindex));
DEBUGF(infof(data, "switching to HTTP/2"));
- result = http2_cfilter_add(&cf, data, conn, sockindex);
- if(result)
- return result;
-
- result = cf_h2_ctx_init(cf, data, FALSE);
+ result = http2_cfilter_add(&cf, data, conn, sockindex, FALSE);
if(result)
return result;
@@ -2741,15 +2694,11 @@ CURLcode Curl_http2_switch_at(struct Curl_cfilter *cf, struct Curl_easy *data)
DEBUGASSERT(!Curl_cf_is_http2(cf, data));
- result = http2_cfilter_insert_after(cf, data);
+ result = http2_cfilter_insert_after(cf, data, FALSE);
if(result)
return result;
cf_h2 = cf->next;
- result = cf_h2_ctx_init(cf_h2, data, FALSE);
- if(result)
- return result;
-
cf->conn->httpversion = 20; /* we know we're on HTTP/2 now */
cf->conn->bits.multiplex = TRUE; /* at least potentially multiplexed */
cf->conn->bundle->multiuse = BUNDLE_MULTIPLEX;
@@ -2774,17 +2723,13 @@ CURLcode Curl_http2_upgrade(struct Curl_easy *data,
DEBUGF(infof(data, "upgrading to HTTP/2"));
DEBUGASSERT(data->req.upgr101 == UPGR101_RECEIVED);
- result = http2_cfilter_add(&cf, data, conn, sockindex);
+ result = http2_cfilter_add(&cf, data, conn, sockindex, TRUE);
if(result)
return result;
DEBUGASSERT(cf->cft == &Curl_cft_nghttp2);
ctx = cf->ctx;
- result = cf_h2_ctx_init(cf, data, TRUE);
- if(result)
- return result;
-
if(nread > 0) {
/* Remaining data from the protocol switch reply is already using
* the switched protocol, ie. HTTP/2. We add that to the network
@@ -2823,7 +2768,7 @@ CURLcode Curl_http2_upgrade(struct Curl_easy *data,
CURLE_HTTP2_STREAM error! */
bool Curl_h2_http_1_1_error(struct Curl_easy *data)
{
- struct stream_ctx *stream = H2_STREAM_CTX(data);
+ struct h2_stream_ctx *stream = H2_STREAM_CTX(data);
return (stream && stream->error == NGHTTP2_HTTP_1_1_REQUIRED);
}
diff --git a/Utilities/cmcurl/lib/http_chunks.c b/Utilities/cmcurl/lib/http_chunks.c
index 039c179..ac9d724 100644
--- a/Utilities/cmcurl/lib/http_chunks.c
+++ b/Utilities/cmcurl/lib/http_chunks.c
@@ -27,10 +27,12 @@
#ifndef CURL_DISABLE_HTTP
#include "urldata.h" /* it includes http_chunks.h */
+#include "curl_printf.h"
#include "sendf.h" /* for the client write stuff */
#include "dynbuf.h"
#include "content_encoding.h"
#include "http.h"
+#include "multiif.h"
#include "strtoofft.h"
#include "warnless.h"
@@ -152,9 +154,9 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
ch->hexbuffer[ch->hexindex++] = *buf;
buf++;
blen--;
+ (*pconsumed)++;
}
else {
- char *endptr;
if(0 == ch->hexindex) {
/* This is illegal data, we received junk where we expected
a hexadecimal digit. */
@@ -166,7 +168,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
/* blen and buf are unmodified */
ch->hexbuffer[ch->hexindex] = 0;
- if(curlx_strtoofft(ch->hexbuffer, &endptr, 16, &ch->datasize)) {
+ if(curlx_strtoofft(ch->hexbuffer, NULL, 16, &ch->datasize)) {
failf(data, "chunk hex-length not valid: '%s'", ch->hexbuffer);
ch->state = CHUNK_FAILED;
ch->last_code = CHUNKE_ILLEGAL_HEX;
@@ -189,6 +191,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_DATA:
@@ -236,6 +239,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
}
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_TRAILER:
@@ -293,6 +297,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
}
buf++;
blen--;
+ (*pconsumed)++;
break;
case CHUNK_TRAILER_CR:
@@ -300,6 +305,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
ch->state = CHUNK_TRAILER_POSTCR;
buf++;
blen--;
+ (*pconsumed)++;
}
else {
ch->state = CHUNK_FAILED;
@@ -320,6 +326,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
/* skip if CR */
buf++;
blen--;
+ (*pconsumed)++;
}
/* now wait for the final LF */
ch->state = CHUNK_STOP;
@@ -328,6 +335,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
case CHUNK_STOP:
if(*buf == 0x0a) {
blen--;
+ (*pconsumed)++;
/* Record the length of any data left in the end of the buffer
even if there's no more chunks to read */
ch->datasize = blen;
@@ -386,7 +394,7 @@ struct chunked_writer {
static CURLcode cw_chunked_init(struct Curl_easy *data,
struct Curl_cwriter *writer)
{
- struct chunked_writer *ctx = (struct chunked_writer *)writer;
+ struct chunked_writer *ctx = writer->ctx;
data->req.chunk = TRUE; /* chunks coming our way. */
Curl_httpchunk_init(data, &ctx->ch, FALSE);
@@ -396,7 +404,7 @@ static CURLcode cw_chunked_init(struct Curl_easy *data,
static void cw_chunked_close(struct Curl_easy *data,
struct Curl_cwriter *writer)
{
- struct chunked_writer *ctx = (struct chunked_writer *)writer;
+ struct chunked_writer *ctx = writer->ctx;
Curl_httpchunk_free(data, &ctx->ch);
}
@@ -404,7 +412,7 @@ static CURLcode cw_chunked_write(struct Curl_easy *data,
struct Curl_cwriter *writer, int type,
const char *buf, size_t blen)
{
- struct chunked_writer *ctx = (struct chunked_writer *)writer;
+ struct chunked_writer *ctx = writer->ctx;
CURLcode result;
size_t consumed;
@@ -452,4 +460,207 @@ const struct Curl_cwtype Curl_httpchunk_unencoder = {
sizeof(struct chunked_writer)
};
+/* max length of a HTTP chunk that we want to generate */
+#define CURL_CHUNKED_MINLEN (1024)
+#define CURL_CHUNKED_MAXLEN (64 * 1024)
+
+struct chunked_reader {
+ struct Curl_creader super;
+ struct bufq chunkbuf;
+ BIT(read_eos); /* we read an EOS from the next reader */
+ BIT(eos); /* we have returned an EOS */
+};
+
+static CURLcode cr_chunked_init(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct chunked_reader *ctx = reader->ctx;
+ (void)data;
+ Curl_bufq_init2(&ctx->chunkbuf, CURL_CHUNKED_MAXLEN, 2, BUFQ_OPT_SOFT_LIMIT);
+ return CURLE_OK;
+}
+
+static void cr_chunked_close(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct chunked_reader *ctx = reader->ctx;
+ (void)data;
+ Curl_bufq_free(&ctx->chunkbuf);
+}
+
+static CURLcode add_last_chunk(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct chunked_reader *ctx = reader->ctx;
+ struct curl_slist *trailers = NULL, *tr;
+ CURLcode result;
+ size_t n;
+ int rc;
+
+ if(!data->set.trailer_callback) {
+ return Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("0\r\n\r\n"), &n);
+ }
+
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("0\r\n"), &n);
+ if(result)
+ goto out;
+
+ Curl_set_in_callback(data, true);
+ rc = data->set.trailer_callback(&trailers, data->set.trailer_data);
+ Curl_set_in_callback(data, false);
+
+ if(rc != CURL_TRAILERFUNC_OK) {
+ failf(data, "operation aborted by trailing headers callback");
+ result = CURLE_ABORTED_BY_CALLBACK;
+ goto out;
+ }
+
+ for(tr = trailers; tr; tr = tr->next) {
+ /* only add correctly formatted trailers */
+ char *ptr = strchr(tr->data, ':');
+ if(!ptr || *(ptr + 1) != ' ') {
+ infof(data, "Malformatted trailing header, skipping trailer");
+ continue;
+ }
+
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, tr->data,
+ strlen(tr->data), &n);
+ if(!result)
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("\r\n"), &n);
+ if(result)
+ goto out;
+ }
+
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, STRCONST("\r\n"), &n);
+
+out:
+ curl_slist_free_all(trailers);
+ return result;
+}
+
+static CURLcode add_chunk(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen)
+{
+ struct chunked_reader *ctx = reader->ctx;
+ CURLcode result;
+ char tmp[CURL_CHUNKED_MINLEN];
+ size_t nread;
+ bool eos;
+
+ DEBUGASSERT(!ctx->read_eos);
+ blen = CURLMIN(blen, CURL_CHUNKED_MAXLEN); /* respect our buffer pref */
+ if(blen < sizeof(tmp)) {
+ /* small read, make a chunk of decent size */
+ buf = tmp;
+ blen = sizeof(tmp);
+ }
+ else {
+ /* larger read, make a chunk that will fit when read back */
+ blen -= (8 + 2 + 2); /* deduct max overhead, 8 hex + 2*crlf */
+ }
+
+ result = Curl_creader_read(data, reader->next, buf, blen, &nread, &eos);
+ if(result)
+ return result;
+ if(eos)
+ ctx->read_eos = TRUE;
+
+ if(nread) {
+ /* actually got bytes, wrap them into the chunkbuf */
+ char hd[11] = "";
+ int hdlen;
+ size_t n;
+
+ hdlen = msnprintf(hd, sizeof(hd), "%zx\r\n", nread);
+ if(hdlen <= 0)
+ return CURLE_READ_ERROR;
+ /* On a soft-limited bufq, we do not need to check that all was written */
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, hd, hdlen, &n);
+ if(!result)
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, buf, nread, &n);
+ if(!result)
+ result = Curl_bufq_cwrite(&ctx->chunkbuf, "\r\n", 2, &n);
+ if(result)
+ return result;
+ }
+
+ if(ctx->read_eos)
+ return add_last_chunk(data, reader);
+ return CURLE_OK;
+}
+
+static CURLcode cr_chunked_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct chunked_reader *ctx = reader->ctx;
+ CURLcode result = CURLE_READ_ERROR;
+
+ *pnread = 0;
+ *peos = ctx->eos;
+
+ if(!ctx->eos) {
+ if(!ctx->read_eos && Curl_bufq_is_empty(&ctx->chunkbuf)) {
+ /* Still getting data form the next reader, buffer is empty */
+ result = add_chunk(data, reader, buf, blen);
+ if(result)
+ return result;
+ }
+
+ if(!Curl_bufq_is_empty(&ctx->chunkbuf)) {
+ result = Curl_bufq_cread(&ctx->chunkbuf, buf, blen, pnread);
+ if(!result && ctx->read_eos && Curl_bufq_is_empty(&ctx->chunkbuf)) {
+ /* no more data, read all, done. */
+ ctx->eos = TRUE;
+ *peos = TRUE;
+ }
+ return result;
+ }
+ }
+ /* We may get here, because we are done or because callbacks paused */
+ DEBUGASSERT(ctx->eos || !ctx->read_eos);
+ return CURLE_OK;
+}
+
+static curl_off_t cr_chunked_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ /* this reader changes length depending on input */
+ (void)data;
+ (void)reader;
+ return -1;
+}
+
+/* HTTP chunked Transfer-Encoding encoder */
+const struct Curl_crtype Curl_httpchunk_encoder = {
+ "chunked",
+ cr_chunked_init,
+ cr_chunked_read,
+ cr_chunked_close,
+ Curl_creader_def_needs_rewind,
+ cr_chunked_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct chunked_reader)
+};
+
+CURLcode Curl_httpchunk_add_reader(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result;
+
+ result = Curl_creader_create(&reader, data, &Curl_httpchunk_encoder,
+ CURL_CR_TRANSFER_ENCODE);
+ if(!result)
+ result = Curl_creader_add(data, reader);
+
+ if(result && reader)
+ Curl_creader_free(data, reader);
+ return result;
+}
+
#endif /* CURL_DISABLE_HTTP */
diff --git a/Utilities/cmcurl/lib/http_chunks.h b/Utilities/cmcurl/lib/http_chunks.h
index 07f2984..d3ecc36 100644
--- a/Utilities/cmcurl/lib/http_chunks.h
+++ b/Utilities/cmcurl/lib/http_chunks.h
@@ -133,6 +133,13 @@ bool Curl_httpchunk_is_done(struct Curl_easy *data, struct Curl_chunker *ch);
extern const struct Curl_cwtype Curl_httpchunk_unencoder;
+extern const struct Curl_crtype Curl_httpchunk_encoder;
+
+/**
+ * Add a transfer-encoding "chunked" reader to the transfers reader stack
+ */
+CURLcode Curl_httpchunk_add_reader(struct Curl_easy *data);
+
#endif /* !CURL_DISABLE_HTTP */
#endif /* HEADER_CURL_HTTP_CHUNKS_H */
diff --git a/Utilities/cmcurl/lib/imap.c b/Utilities/cmcurl/lib/imap.c
index f9211d9..0e013e7 100644
--- a/Utilities/cmcurl/lib/imap.c
+++ b/Utilities/cmcurl/lib/imap.c
@@ -770,6 +770,7 @@ static CURLcode imap_perform_append(struct Curl_easy *data)
return CURLE_URL_MALFORMAT;
}
+#ifndef CURL_DISABLE_MIME
/* Prepare the mime data if some. */
if(data->set.mimepost.kind != MIMEKIND_NONE) {
/* Use the whole structure as data. */
@@ -785,18 +786,18 @@ static CURLcode imap_perform_append(struct Curl_easy *data)
result = Curl_mime_add_header(&data->set.mimepost.curlheaders,
"Mime-Version: 1.0");
- /* Make sure we will read the entire mime structure. */
if(!result)
- result = Curl_mime_rewind(&data->set.mimepost);
-
+ result = Curl_creader_set_mime(data, &data->set.mimepost);
+ if(result)
+ return result;
+ data->state.infilesize = Curl_creader_client_length(data);
+ }
+ else
+#endif
+ {
+ result = Curl_creader_set_fread(data, data->state.infilesize);
if(result)
return result;
-
- data->state.infilesize = Curl_mime_size(&data->set.mimepost);
-
- /* Read from mime structure. */
- data->state.fread_func = (curl_read_callback) Curl_mime_read;
- data->state.in = (void *) &data->set.mimepost;
}
/* Check we know the size of the upload */
@@ -1211,14 +1212,14 @@ static CURLcode imap_state_fetch_resp(struct Curl_easy *data,
if(data->req.bytecount == size)
/* The entire data is already transferred! */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
else {
/* IMAP download */
data->req.maxdownload = size;
/* force a recv/send check of this connection, as the data might've been
read off the socket already */
data->state.select_bits = CURL_CSELECT_IN;
- Curl_setup_transfer(data, FIRSTSOCKET, size, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, size, FALSE, -1);
}
}
else {
@@ -1266,7 +1267,7 @@ static CURLcode imap_state_append_resp(struct Curl_easy *data, int imapcode,
Curl_pgrsSetUploadSize(data, data->state.infilesize);
/* IMAP upload */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
/* End of DO phase */
imap_state(data, IMAP_STOP);
@@ -1297,7 +1298,6 @@ static CURLcode imap_statemachine(struct Curl_easy *data,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
int imapcode;
struct imap_conn *imapc = &conn->proto.imapc;
struct pingpong *pp = &imapc->pp;
@@ -1314,7 +1314,7 @@ static CURLcode imap_statemachine(struct Curl_easy *data,
do {
/* Read the response from the server */
- result = Curl_pp_readresp(data, sock, pp, &imapcode, &nread);
+ result = Curl_pp_readresp(data, FIRSTSOCKET, pp, &imapcode, &nread);
if(result)
return result;
@@ -1513,10 +1513,10 @@ static CURLcode imap_done(struct Curl_easy *data, CURLcode status,
}
else if(!data->set.connect_only && !imap->custom &&
(imap->uid || imap->mindex || data->state.upload ||
- data->set.mimepost.kind != MIMEKIND_NONE)) {
+ IS_MIME_POST(data))) {
/* Handle responses after FETCH or APPEND transfer has finished */
- if(!data->state.upload && data->set.mimepost.kind == MIMEKIND_NONE)
+ if(!data->state.upload && !IS_MIME_POST(data))
imap_state(data, IMAP_FETCH_FINAL);
else {
/* End the APPEND command first by sending an empty line */
@@ -1582,7 +1582,7 @@ static CURLcode imap_perform(struct Curl_easy *data, bool *connected,
selected = TRUE;
/* Start the first command in the DO phase */
- if(data->state.upload || data->set.mimepost.kind != MIMEKIND_NONE)
+ if(data->state.upload || IS_MIME_POST(data))
/* APPEND can be executed directly */
result = imap_perform_append(data);
else if(imap->custom && (selected || !imap->mailbox))
@@ -1692,7 +1692,7 @@ static CURLcode imap_dophase_done(struct Curl_easy *data, bool connected)
if(imap->transfer != PPTRANSFER_BODY)
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
return CURLE_OK;
}
diff --git a/Utilities/cmcurl/lib/krb5.c b/Utilities/cmcurl/lib/krb5.c
index 4db19fb..309e12a 100644
--- a/Utilities/cmcurl/lib/krb5.c
+++ b/Utilities/cmcurl/lib/krb5.c
@@ -52,6 +52,7 @@
#include "ftp.h"
#include "curl_gssapi.h"
#include "sendf.h"
+#include "transfer.h"
#include "curl_krb5.h"
#include "warnless.h"
#include "strcase.h"
@@ -65,7 +66,7 @@
static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn,
const char *cmd)
{
- ssize_t bytes_written;
+ size_t bytes_written;
#define SBUF_SIZE 1024
char s[SBUF_SIZE];
size_t write_len;
@@ -90,8 +91,7 @@ static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn,
#ifdef HAVE_GSSAPI
conn->data_prot = PROT_CMD;
#endif
- result = Curl_nwrite(data, FIRSTSOCKET, sptr, write_len,
- &bytes_written);
+ result = Curl_xfer_send(data, sptr, write_len, &bytes_written);
#ifdef HAVE_GSSAPI
DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
conn->data_prot = data_sec;
@@ -100,9 +100,9 @@ static CURLcode ftpsend(struct Curl_easy *data, struct connectdata *conn,
if(result)
break;
- Curl_debug(data, CURLINFO_HEADER_OUT, sptr, (size_t)bytes_written);
+ Curl_debug(data, CURLINFO_HEADER_OUT, sptr, bytes_written);
- if(bytes_written != (ssize_t)write_len) {
+ if(bytes_written != write_len) {
write_len -= bytes_written;
sptr += bytes_written;
}
@@ -470,7 +470,7 @@ socket_read(struct Curl_easy *data, int sockindex, void *to, size_t len)
ssize_t nread = 0;
while(len > 0) {
- nread = Curl_conn_recv(data, sockindex, to_p, len, &result);
+ result = Curl_conn_recv(data, sockindex, to_p, len, &nread);
if(nread > 0) {
len -= nread;
to_p += nread;
@@ -494,11 +494,11 @@ socket_write(struct Curl_easy *data, int sockindex, const void *to,
{
const char *to_p = to;
CURLcode result;
- ssize_t written;
+ size_t written;
while(len > 0) {
- written = Curl_conn_send(data, sockindex, to_p, len, &result);
- if(written > 0) {
+ result = Curl_conn_send(data, sockindex, to_p, len, &written);
+ if(!result && written > 0) {
len -= written;
to_p += written;
}
@@ -567,8 +567,11 @@ static ssize_t sec_recv(struct Curl_easy *data, int sockindex,
*err = CURLE_OK;
/* Handle clear text response. */
- if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR)
- return Curl_conn_recv(data, sockindex, buffer, len, err);
+ if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR) {
+ ssize_t nread;
+ *err = Curl_conn_recv(data, sockindex, buffer, len, &nread);
+ return nread;
+ }
if(conn->in_buffer.eof_flag) {
conn->in_buffer.eof_flag = 0;
diff --git a/Utilities/cmcurl/lib/ldap.c b/Utilities/cmcurl/lib/ldap.c
index 4c04647..394fd32 100644
--- a/Utilities/cmcurl/lib/ldap.c
+++ b/Utilities/cmcurl/lib/ldap.c
@@ -371,7 +371,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
#ifdef HAVE_LDAP_SSL
#ifdef USE_WIN32_LDAP
/* Win32 LDAP SDK doesn't support insecure mode without CA! */
- server = ldap_sslinit(host, conn->port, 1);
+ server = ldap_sslinit(host, conn->primary.remote_port, 1);
ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);
#else
int ldap_option;
@@ -417,10 +417,10 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
result = CURLE_SSL_CERTPROBLEM;
goto quit;
}
- server = ldapssl_init(host, conn->port, 1);
+ server = ldapssl_init(host, conn->primary.remote_port, 1);
if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%u",
- conn->host.dispname, conn->port);
+ conn->host.dispname, conn->primary.remote_port);
result = CURLE_COULDNT_CONNECT;
goto quit;
}
@@ -458,10 +458,10 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
result = CURLE_SSL_CERTPROBLEM;
goto quit;
}
- server = ldap_init(host, conn->port);
+ server = ldap_init(host, conn->primary.remote_port);
if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%u",
- conn->host.dispname, conn->port);
+ conn->host.dispname, conn->primary.remote_port);
result = CURLE_COULDNT_CONNECT;
goto quit;
}
@@ -499,10 +499,10 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
goto quit;
}
else {
- server = ldap_init(host, conn->port);
+ server = ldap_init(host, conn->primary.remote_port);
if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%u",
- conn->host.dispname, conn->port);
+ conn->host.dispname, conn->primary.remote_port);
result = CURLE_COULDNT_CONNECT;
goto quit;
}
@@ -749,7 +749,7 @@ quit:
FREE_ON_WINLDAP(host);
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
connclose(conn, "LDAP connection always disable reuse");
return result;
diff --git a/Utilities/cmcurl/lib/md4.c b/Utilities/cmcurl/lib/md4.c
index 067c211..58dd116 100644
--- a/Utilities/cmcurl/lib/md4.c
+++ b/Utilities/cmcurl/lib/md4.c
@@ -28,6 +28,7 @@
#include <string.h>
+#include "strdup.h"
#include "curl_md4.h"
#include "warnless.h"
diff --git a/Utilities/cmcurl/lib/mime.c b/Utilities/cmcurl/lib/mime.c
index d712331..5bc6d38 100644
--- a/Utilities/cmcurl/lib/mime.c
+++ b/Utilities/cmcurl/lib/mime.c
@@ -74,6 +74,7 @@ static curl_off_t encoder_base64_size(curl_mimepart *part);
static size_t encoder_qp_read(char *buffer, size_t size, bool ateof,
curl_mimepart *part);
static curl_off_t encoder_qp_size(curl_mimepart *part);
+static curl_off_t mime_size(curl_mimepart *part);
static const struct mime_encoder encoders[] = {
{"binary", encoder_nop_read, encoder_nop_size},
@@ -1602,7 +1603,7 @@ size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, void *instream)
}
/* Rewind mime stream. */
-CURLcode Curl_mime_rewind(curl_mimepart *part)
+static CURLcode mime_rewind(curl_mimepart *part)
{
return mime_part_rewind(part) == CURL_SEEKFUNC_OK?
CURLE_OK: CURLE_SEND_FAIL_REWIND;
@@ -1634,7 +1635,7 @@ static curl_off_t multipart_size(curl_mime *mime)
size = boundarysize; /* Final boundary - CRLF after headers. */
for(part = mime->firstpart; part; part = part->nextpart) {
- curl_off_t sz = Curl_mime_size(part);
+ curl_off_t sz = mime_size(part);
if(sz < 0)
size = sz;
@@ -1647,7 +1648,7 @@ static curl_off_t multipart_size(curl_mime *mime)
}
/* Get/compute mime size. */
-curl_off_t Curl_mime_size(curl_mimepart *part)
+static curl_off_t mime_size(curl_mimepart *part)
{
curl_off_t size;
@@ -1896,7 +1897,7 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data,
}
/* Recursively reset paused status in the given part. */
-void Curl_mime_unpause(curl_mimepart *part)
+static void mime_unpause(curl_mimepart *part)
{
if(part) {
if(part->lastreadstatus == CURL_READFUNC_PAUSE)
@@ -1908,12 +1909,228 @@ void Curl_mime_unpause(curl_mimepart *part)
curl_mimepart *subpart;
for(subpart = mime->firstpart; subpart; subpart = subpart->nextpart)
- Curl_mime_unpause(subpart);
+ mime_unpause(subpart);
}
}
}
}
+struct cr_mime_ctx {
+ struct Curl_creader super;
+ curl_mimepart *part;
+ curl_off_t total_len;
+ curl_off_t read_len;
+ CURLcode error_result;
+ BIT(seen_eos);
+ BIT(errored);
+};
+
+static CURLcode cr_mime_init(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ (void)data;
+ ctx->total_len = -1;
+ ctx->read_len = 0;
+ return CURLE_OK;
+}
+
+/* Real client reader to installed client callbacks. */
+static CURLcode cr_mime_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ size_t nread;
+
+ /* Once we have errored, we will return the same error forever */
+ if(ctx->errored) {
+ *pnread = 0;
+ *peos = FALSE;
+ return ctx->error_result;
+ }
+ if(ctx->seen_eos) {
+ *pnread = 0;
+ *peos = TRUE;
+ return CURLE_OK;
+ }
+ /* respect length limitations */
+ if(ctx->total_len >= 0) {
+ curl_off_t remain = ctx->total_len - ctx->read_len;
+ if(remain <= 0)
+ blen = 0;
+ else if(remain < (curl_off_t)blen)
+ blen = (size_t)remain;
+ }
+ nread = 0;
+ if(blen) {
+ nread = Curl_mime_read(buf, 1, blen, ctx->part);
+ }
+
+ switch(nread) {
+ case 0:
+ if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
+ failf(data, "client mime read EOF fail, only "
+ "only %"CURL_FORMAT_CURL_OFF_T"/%"CURL_FORMAT_CURL_OFF_T
+ " of needed bytes read", ctx->read_len, ctx->total_len);
+ return CURLE_READ_ERROR;
+ }
+ *pnread = 0;
+ *peos = TRUE;
+ ctx->seen_eos = TRUE;
+ break;
+
+ case CURL_READFUNC_ABORT:
+ failf(data, "operation aborted by callback");
+ *pnread = 0;
+ *peos = FALSE;
+ ctx->errored = TRUE;
+ ctx->error_result = CURLE_ABORTED_BY_CALLBACK;
+ return CURLE_ABORTED_BY_CALLBACK;
+
+ case CURL_READFUNC_PAUSE:
+ /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
+ data->req.keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
+ *pnread = 0;
+ *peos = FALSE;
+ break; /* nothing was read */
+
+ default:
+ if(nread > blen) {
+ /* the read function returned a too large value */
+ failf(data, "read function returned funny value");
+ *pnread = 0;
+ *peos = FALSE;
+ ctx->errored = TRUE;
+ ctx->error_result = CURLE_READ_ERROR;
+ return CURLE_READ_ERROR;
+ }
+ ctx->read_len += nread;
+ if(ctx->total_len >= 0)
+ ctx->seen_eos = (ctx->read_len >= ctx->total_len);
+ *pnread = nread;
+ *peos = ctx->seen_eos;
+ break;
+ }
+ DEBUGF(infof(data, "cr_mime_read(len=%zu, total=%"CURL_FORMAT_CURL_OFF_T
+ ", read=%"CURL_FORMAT_CURL_OFF_T") -> %d, %zu, %d",
+ blen, ctx->total_len, ctx->read_len, CURLE_OK, *pnread, *peos));
+ return CURLE_OK;
+}
+
+static bool cr_mime_needs_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ (void)data;
+ return ctx->read_len > 0;
+}
+
+static curl_off_t cr_mime_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ (void)data;
+ return ctx->total_len;
+}
+
+static CURLcode cr_mime_resume_from(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ curl_off_t offset)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+
+ if(offset > 0) {
+ curl_off_t passed = 0;
+
+ do {
+ char scratch[4*1024];
+ size_t readthisamountnow =
+ (offset - passed > (curl_off_t)sizeof(scratch)) ?
+ sizeof(scratch) :
+ curlx_sotouz(offset - passed);
+ size_t nread;
+
+ nread = Curl_mime_read(scratch, 1, readthisamountnow, ctx->part);
+ passed += (curl_off_t)nread;
+ if((nread == 0) || (nread > readthisamountnow)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T
+ " bytes from the mime post", passed);
+ return CURLE_READ_ERROR;
+ }
+ } while(passed < offset);
+
+ /* now, decrease the size of the read */
+ if(ctx->total_len > 0) {
+ ctx->total_len -= offset;
+
+ if(ctx->total_len <= 0) {
+ failf(data, "Mime post already completely uploaded");
+ return CURLE_PARTIAL_FILE;
+ }
+ }
+ /* we've passed, proceed as normal */
+ }
+ return CURLE_OK;
+}
+
+static CURLcode cr_mime_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ CURLcode result = mime_rewind(ctx->part);
+ if(result)
+ failf(data, "Cannot rewind mime/post data");
+ return result;
+}
+
+static CURLcode cr_mime_unpause(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_mime_ctx *ctx = reader->ctx;
+ (void)data;
+ mime_unpause(ctx->part);
+ return CURLE_OK;
+}
+
+static const struct Curl_crtype cr_mime = {
+ "cr-mime",
+ cr_mime_init,
+ cr_mime_read,
+ Curl_creader_def_close,
+ cr_mime_needs_rewind,
+ cr_mime_total_length,
+ cr_mime_resume_from,
+ cr_mime_rewind,
+ cr_mime_unpause,
+ Curl_creader_def_done,
+ sizeof(struct cr_mime_ctx)
+};
+
+CURLcode Curl_creader_set_mime(struct Curl_easy *data, curl_mimepart *part)
+{
+ struct Curl_creader *r;
+ struct cr_mime_ctx *ctx;
+ CURLcode result;
+
+ result = Curl_creader_create(&r, data, &cr_mime, CURL_CR_CLIENT);
+ if(result)
+ return result;
+ ctx = r->ctx;
+ ctx->part = part;
+ /* Make sure we will read the entire mime structure. */
+ result = mime_rewind(ctx->part);
+ if(result) {
+ Curl_creader_free(data, r);
+ return result;
+ }
+ ctx->total_len = mime_size(ctx->part);
+
+ return Curl_creader_set(data, r);
+}
#else /* !CURL_DISABLE_MIME && (!CURL_DISABLE_HTTP ||
!CURL_DISABLE_SMTP || !CURL_DISABLE_IMAP) */
diff --git a/Utilities/cmcurl/lib/mime.h b/Utilities/cmcurl/lib/mime.h
index a64f41d..954b3cc 100644
--- a/Utilities/cmcurl/lib/mime.h
+++ b/Utilities/cmcurl/lib/mime.h
@@ -151,12 +151,15 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data,
const char *contenttype,
const char *disposition,
enum mimestrategy strategy);
-curl_off_t Curl_mime_size(struct curl_mimepart *part);
size_t Curl_mime_read(char *buffer, size_t size, size_t nitems,
void *instream);
-CURLcode Curl_mime_rewind(struct curl_mimepart *part);
const char *Curl_mime_contenttype(const char *filename);
-void Curl_mime_unpause(struct curl_mimepart *part);
+
+/**
+ * Install a client reader as upload source that reads the given
+ * mime part.
+ */
+CURLcode Curl_creader_set_mime(struct Curl_easy *data, curl_mimepart *part);
#else
/* if disabled */
@@ -165,10 +168,8 @@ void Curl_mime_unpause(struct curl_mimepart *part);
#define Curl_mime_duppart(x,y,z) CURLE_OK /* Nothing to duplicate. Succeed */
#define Curl_mime_set_subparts(a,b,c) CURLE_NOT_BUILT_IN
#define Curl_mime_prepare_headers(a,b,c,d,e) CURLE_NOT_BUILT_IN
-#define Curl_mime_size(x) (curl_off_t) -1
#define Curl_mime_read NULL
-#define Curl_mime_rewind(x) ((void)x, CURLE_NOT_BUILT_IN)
-#define Curl_mime_unpause(x)
+#define Curl_creader_set_mime(x,y) ((void)x, CURLE_NOT_BUILT_IN)
#endif
diff --git a/Utilities/cmcurl/lib/mprintf.c b/Utilities/cmcurl/lib/mprintf.c
index 63f7f24..4c60d13 100644
--- a/Utilities/cmcurl/lib/mprintf.c
+++ b/Utilities/cmcurl/lib/mprintf.c
@@ -49,16 +49,6 @@
#endif
/*
- * Non-ANSI integer extensions
- */
-
-#if (defined(_WIN32_WCE)) || \
- (defined(__MINGW32__)) || \
- (defined(_MSC_VER) && (_MSC_VER >= 900) && (_INTEGRAL_MAX_BITS >= 64))
-# define MP_HAVE_INT_EXTENSIONS
-#endif
-
-/*
* Max integer data types that mprintf.c is capable
*/
@@ -349,8 +339,9 @@ static int parsefmt(const char *format,
case 'h':
flags |= FLAGS_SHORT;
break;
-#if defined(MP_HAVE_INT_EXTENSIONS)
+#if defined(_WIN32) || defined(_WIN32_WCE)
case 'I':
+ /* Non-ANSI integer extensions I32 I64 */
if((fmt[0] == '3') && (fmt[1] == '2')) {
flags |= FLAGS_LONG;
fmt += 2;
@@ -367,7 +358,7 @@ static int parsefmt(const char *format,
#endif
}
break;
-#endif
+#endif /* _WIN32 || _WIN32_WCE */
case 'l':
if(flags & FLAGS_LONG)
flags |= FLAGS_LONGLONG;
@@ -651,7 +642,7 @@ static int parsefmt(const char *format,
* On success, the input array describes the type of all arguments and their
* values.
*
- * The function then iterates over the output sengments and outputs them one
+ * The function then iterates over the output segments and outputs them one
* by one until done. Using the appropriate input arguments (if any).
*
* All output is sent to the 'stream()' callback, one byte at a time.
diff --git a/Utilities/cmcurl/lib/mqtt.c b/Utilities/cmcurl/lib/mqtt.c
index 5a9d6d0..9290da0 100644
--- a/Utilities/cmcurl/lib/mqtt.c
+++ b/Utilities/cmcurl/lib/mqtt.c
@@ -119,12 +119,12 @@ static CURLcode mqtt_send(struct Curl_easy *data,
{
CURLcode result = CURLE_OK;
struct MQTT *mq = data->req.p.mqtt;
- ssize_t n;
- result = Curl_nwrite(data, FIRSTSOCKET, buf, len, &n);
+ size_t n;
+ result = Curl_xfer_send(data, buf, len, &n);
if(result)
return result;
Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
- if(len != (size_t)n) {
+ if(len != n) {
size_t nsend = len - n;
char *sendleftovers = Curl_memdup(&buf[n], nsend);
if(!sendleftovers)
@@ -366,8 +366,7 @@ static CURLcode mqtt_recv_atleast(struct Curl_easy *data, size_t nbytes)
ssize_t nread;
DEBUGASSERT(nbytes - rlen < sizeof(readbuf));
- result = Curl_read(data, data->conn->sock[FIRSTSOCKET],
- (char *)readbuf, nbytes - rlen, &nread);
+ result = Curl_xfer_recv(data, (char *)readbuf, nbytes - rlen, &nread);
if(result)
return result;
DEBUGASSERT(nread >= 0);
@@ -622,7 +621,6 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
{
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
ssize_t nread;
size_t remlen;
struct mqtt_conn *mqtt = &conn->proto.mqtt;
@@ -679,7 +677,7 @@ MQTT_SUBACK_COMING:
size_t rest = mq->npacket;
if(rest > sizeof(buffer))
rest = sizeof(buffer);
- result = Curl_read(data, sockfd, buffer, rest, &nread);
+ result = Curl_xfer_recv(data, buffer, rest, &nread);
if(result) {
if(CURLE_AGAIN == result) {
infof(data, "EEEE AAAAGAIN");
@@ -744,7 +742,6 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
struct mqtt_conn *mqtt = &conn->proto.mqtt;
struct MQTT *mq = data->req.p.mqtt;
ssize_t nread;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
unsigned char byte;
*done = FALSE;
@@ -762,7 +759,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
switch(mqtt->state) {
case MQTT_FIRST:
/* Read the initial byte only */
- result = Curl_read(data, sockfd, (char *)&mq->firstbyte, 1, &nread);
+ result = Curl_xfer_recv(data, (char *)&mq->firstbyte, 1, &nread);
if(result)
break;
else if(!nread) {
@@ -778,7 +775,7 @@ static CURLcode mqtt_doing(struct Curl_easy *data, bool *done)
FALLTHROUGH();
case MQTT_REMAINING_LENGTH:
do {
- result = Curl_read(data, sockfd, (char *)&byte, 1, &nread);
+ result = Curl_xfer_recv(data, (char *)&byte, 1, &nread);
if(!nread)
break;
Curl_debug(data, CURLINFO_HEADER_IN, (char *)&byte, 1);
diff --git a/Utilities/cmcurl/lib/multi.c b/Utilities/cmcurl/lib/multi.c
index 0926b0d..ed9cac7 100644
--- a/Utilities/cmcurl/lib/multi.c
+++ b/Utilities/cmcurl/lib/multi.c
@@ -94,6 +94,7 @@ static CURLMcode add_next_timeout(struct curltime now,
static CURLMcode multi_timeout(struct Curl_multi *multi,
long *timeout_ms);
static void process_pending_handles(struct Curl_multi *multi);
+static void multi_xfer_bufs_free(struct Curl_multi *multi);
#ifdef DEBUGBUILD
static const char * const multi_statename[]={
@@ -189,6 +190,10 @@ static void mstate(struct Curl_easy *data, CURLMstate state
/* changing to COMPLETED means there's one less easy handle 'alive' */
DEBUGASSERT(data->multi->num_alive > 0);
data->multi->num_alive--;
+ if(!data->multi->num_alive) {
+ /* free the transfer buffer when we have no more active transfers */
+ multi_xfer_bufs_free(data->multi);
+ }
}
/* if this state has an init-function, run it */
@@ -525,6 +530,13 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
multi->dead = FALSE;
}
+ if(data->multi_easy) {
+ /* if this easy handle was previously used for curl_easy_perform(), there
+ is a private multi handle here that we can kill */
+ curl_multi_cleanup(data->multi_easy);
+ data->multi_easy = NULL;
+ }
+
/* Initialize timeout list for this handle */
Curl_llist_init(&data->state.timeoutlist, NULL);
@@ -640,7 +652,7 @@ static CURLcode multi_done(struct Curl_easy *data,
after an error was detected */
bool premature)
{
- CURLcode result;
+ CURLcode result, r2;
struct connectdata *conn = data->conn;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
@@ -691,14 +703,18 @@ static CURLcode multi_done(struct Curl_easy *data,
result = CURLE_ABORTED_BY_CALLBACK;
}
+ /* Make sure that transfer client writes are really done now. */
+ r2 = Curl_xfer_write_done(data, premature);
+ if(r2 && !result)
+ result = r2;
+
/* Inform connection filters that this transfer is done */
Curl_conn_ev_data_done(data, premature);
process_pending_handles(data->multi); /* connection / multiplex */
- Curl_safefree(data->state.ulbuf);
-
- Curl_client_cleanup(data);
+ if(!result)
+ result = Curl_req_done(&data->req, data, premature);
CONNCACHE_LOCK(data);
Curl_detach_connection(data);
@@ -784,7 +800,6 @@ static CURLcode multi_done(struct Curl_easy *data,
data->state.lastconnect_id = -1;
}
- Curl_safefree(data->state.buffer);
return result;
}
@@ -998,7 +1013,7 @@ static int connecting_getsock(struct Curl_easy *data, curl_socket_t *socks)
{
struct connectdata *conn = data->conn;
(void)socks;
- /* Not using `conn->sockfd` as `Curl_setup_transfer()` initializes
+ /* Not using `conn->sockfd` as `Curl_xfer_setup()` initializes
* that *after* the connect. */
if(conn && conn->sock[FIRSTSOCKET] != CURL_SOCKET_BAD) {
/* Default is to wait to something from the server */
@@ -1802,101 +1817,15 @@ static CURLcode protocol_connect(struct Curl_easy *data,
}
/*
- * readrewind() rewinds the read stream. This is typically used for HTTP
- * POST/PUT with multi-pass authentication when a sending was denied and a
- * resend is necessary.
- */
-static CURLcode readrewind(struct Curl_easy *data)
-{
- curl_mimepart *mimepart = &data->set.mimepost;
- DEBUGASSERT(data->conn);
-
- data->state.rewindbeforesend = FALSE; /* we rewind now */
-
- /* explicitly switch off sending data on this connection now since we are
- about to restart a new transfer and thus we want to avoid inadvertently
- sending more data on the existing connection until the next transfer
- starts */
- data->req.keepon &= ~KEEP_SEND;
-
- /* We have sent away data. If not using CURLOPT_POSTFIELDS or
- CURLOPT_HTTPPOST, call app to rewind
- */
-#ifndef CURL_DISABLE_HTTP
- if(data->conn->handler->protocol & PROTO_FAMILY_HTTP) {
- if(data->state.mimepost)
- mimepart = data->state.mimepost;
- }
-#endif
- if(data->set.postfields ||
- (data->state.httpreq == HTTPREQ_GET) ||
- (data->state.httpreq == HTTPREQ_HEAD))
- ; /* no need to rewind */
- else if(data->state.httpreq == HTTPREQ_POST_MIME ||
- data->state.httpreq == HTTPREQ_POST_FORM) {
- CURLcode result = Curl_mime_rewind(mimepart);
- if(result) {
- failf(data, "Cannot rewind mime/post data");
- return result;
- }
- }
- else {
- if(data->set.seek_func) {
- int err;
-
- Curl_set_in_callback(data, true);
- err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET);
- Curl_set_in_callback(data, false);
- if(err) {
- failf(data, "seek callback returned error %d", (int)err);
- return CURLE_SEND_FAIL_REWIND;
- }
- }
- else if(data->set.ioctl_func) {
- curlioerr err;
-
- Curl_set_in_callback(data, true);
- err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD,
- data->set.ioctl_client);
- Curl_set_in_callback(data, false);
- infof(data, "the ioctl callback returned %d", (int)err);
-
- if(err) {
- failf(data, "ioctl callback returned error %d", (int)err);
- return CURLE_SEND_FAIL_REWIND;
- }
- }
- else {
- /* If no CURLOPT_READFUNCTION is used, we know that we operate on a
- given FILE * stream and we can actually attempt to rewind that
- ourselves with fseek() */
- if(data->state.fread_func == (curl_read_callback)fread) {
- if(-1 != fseek(data->state.in, 0, SEEK_SET))
- /* successful rewind */
- return CURLE_OK;
- }
-
- /* no callback set or failure above, makes us fail at once */
- failf(data, "necessary data rewind wasn't possible");
- return CURLE_SEND_FAIL_REWIND;
- }
- }
- return CURLE_OK;
-}
-
-/*
* Curl_preconnect() is called immediately before a connect starts. When a
* redirect is followed, this is then called multiple times during a single
* transfer.
*/
CURLcode Curl_preconnect(struct Curl_easy *data)
{
- if(!data->state.buffer) {
- data->state.buffer = malloc(data->set.buffer_size + 1);
- if(!data->state.buffer)
- return CURLE_OUT_OF_MEMORY;
- }
-
+ /* this used to do data->state.buffer allocation,
+ maybe remove completely now? */
+ (void)data;
return CURLE_OK;
}
@@ -1914,7 +1843,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
bool async;
bool protocol_connected = FALSE;
bool dophase_done = FALSE;
- bool done = FALSE;
CURLMcode rc;
CURLcode result = CURLE_OK;
timediff_t recv_timeout_ms;
@@ -2058,7 +1986,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
hostname = conn->host.name;
/* check if we have the name resolved by now */
- dns = Curl_fetch_addr(data, hostname, (int)conn->port);
+ dns = Curl_fetch_addr(data, hostname, conn->primary.remote_port);
if(dns) {
#ifdef CURLRES_ASYNCH
@@ -2153,9 +2081,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
break;
case MSTATE_PROTOCONNECT:
- if(data->state.rewindbeforesend)
- result = readrewind(data);
-
if(!result && data->conn->bits.reuse) {
/* ftp seems to hang when protoconnect on reused connection
* since we handle PROTOCONNECT in general inside the filers, it
@@ -2207,10 +2132,10 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* call the prerequest callback function */
Curl_set_in_callback(data, true);
prereq_rc = data->set.fprereq(data->set.prereq_userp,
- data->info.conn_primary_ip,
- data->info.conn_local_ip,
- data->info.conn_primary_port,
- data->info.conn_local_port);
+ data->info.primary.remote_ip,
+ data->info.primary.local_ip,
+ data->info.primary.remote_port,
+ data->info.primary.local_port);
Curl_set_in_callback(data, false);
if(prereq_rc != CURL_PREREQFUNC_OK) {
failf(data, "operation aborted by pre-request callback");
@@ -2450,7 +2375,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
{
char *newurl = NULL;
bool retry = FALSE;
- DEBUGASSERT(data->state.buffer);
/* check if over send speed */
send_timeout_ms = 0;
if(data->set.max_send_speed)
@@ -2480,9 +2404,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
}
/* read/write data if it is ready to do so */
- result = Curl_readwrite(data, &done);
+ result = Curl_readwrite(data);
- if(done || (result == CURLE_RECV_ERROR)) {
+ if(data->req.done || (result == CURLE_RECV_ERROR)) {
/* If CURLE_RECV_ERROR happens early enough, we assume it was a race
* condition and the server closed the reused connection exactly when
* we wanted to use it, so figure out if that is indeed the case.
@@ -2497,7 +2421,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* if we are to retry, set the result to OK and consider the
request as done */
result = CURLE_OK;
- done = TRUE;
+ data->req.done = TRUE;
}
}
else if((CURLE_HTTP2_STREAM == result) &&
@@ -2517,7 +2441,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
as done */
retry = TRUE;
result = CURLE_OK;
- done = TRUE;
+ data->req.done = TRUE;
}
else
result = ret;
@@ -2539,7 +2463,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
Curl_posttransfer(data);
multi_done(data, result, TRUE);
}
- else if(done) {
+ else if(data->req.done) {
/* call this even if the readwrite function returned error */
Curl_posttransfer(data);
@@ -2883,6 +2807,7 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi)
Curl_free_multi_ssl_backend_data(multi->ssl_backend_data);
#endif
+ multi_xfer_bufs_free(multi);
free(multi);
return CURLM_OK;
@@ -3242,7 +3167,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
if(data->conn && !(data->conn->handler->flags & PROTOPT_DIRLOCK))
/* set socket event bitmask if they're not locked */
- data->state.select_bits = (unsigned char)ev_bitmask;
+ data->state.select_bits |= (unsigned char)ev_bitmask;
Curl_expire(data, 0, EXPIRE_RUN_NOW);
}
@@ -3819,3 +3744,120 @@ struct Curl_easy **curl_multi_get_handles(struct Curl_multi *multi)
}
return a;
}
+
+CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
+ char **pbuf, size_t *pbuflen)
+{
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->multi);
+ *pbuf = NULL;
+ *pbuflen = 0;
+ if(!data->multi) {
+ failf(data, "transfer has no multi handle");
+ return CURLE_FAILED_INIT;
+ }
+ if(!data->set.buffer_size) {
+ failf(data, "transfer buffer size is 0");
+ return CURLE_FAILED_INIT;
+ }
+ if(data->multi->xfer_buf_borrowed) {
+ failf(data, "attempt to borrow xfer_buf when already borrowed");
+ return CURLE_AGAIN;
+ }
+
+ if(data->multi->xfer_buf &&
+ data->set.buffer_size > data->multi->xfer_buf_len) {
+ /* not large enough, get a new one */
+ free(data->multi->xfer_buf);
+ data->multi->xfer_buf = NULL;
+ data->multi->xfer_buf_len = 0;
+ }
+
+ if(!data->multi->xfer_buf) {
+ data->multi->xfer_buf = malloc((size_t)data->set.buffer_size);
+ if(!data->multi->xfer_buf) {
+ failf(data, "could not allocate xfer_buf of %zu bytes",
+ (size_t)data->set.buffer_size);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ data->multi->xfer_buf_len = data->set.buffer_size;
+ }
+
+ data->multi->xfer_buf_borrowed = TRUE;
+ *pbuf = data->multi->xfer_buf;
+ *pbuflen = data->multi->xfer_buf_len;
+ return CURLE_OK;
+}
+
+void Curl_multi_xfer_buf_release(struct Curl_easy *data, char *buf)
+{
+ (void)buf;
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->multi);
+ DEBUGASSERT(!buf || data->multi->xfer_buf == buf);
+ data->multi->xfer_buf_borrowed = FALSE;
+}
+
+CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
+ char **pbuf, size_t *pbuflen)
+{
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->multi);
+ *pbuf = NULL;
+ *pbuflen = 0;
+ if(!data->multi) {
+ failf(data, "transfer has no multi handle");
+ return CURLE_FAILED_INIT;
+ }
+ if(!data->set.upload_buffer_size) {
+ failf(data, "transfer upload buffer size is 0");
+ return CURLE_FAILED_INIT;
+ }
+ if(data->multi->xfer_ulbuf_borrowed) {
+ failf(data, "attempt to borrow xfer_ulbuf when already borrowed");
+ return CURLE_AGAIN;
+ }
+
+ if(data->multi->xfer_ulbuf &&
+ data->set.upload_buffer_size > data->multi->xfer_ulbuf_len) {
+ /* not large enough, get a new one */
+ free(data->multi->xfer_ulbuf);
+ data->multi->xfer_ulbuf = NULL;
+ data->multi->xfer_ulbuf_len = 0;
+ }
+
+ if(!data->multi->xfer_ulbuf) {
+ data->multi->xfer_ulbuf = malloc((size_t)data->set.upload_buffer_size);
+ if(!data->multi->xfer_ulbuf) {
+ failf(data, "could not allocate xfer_ulbuf of %zu bytes",
+ (size_t)data->set.upload_buffer_size);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ data->multi->xfer_ulbuf_len = data->set.upload_buffer_size;
+ }
+
+ data->multi->xfer_ulbuf_borrowed = TRUE;
+ *pbuf = data->multi->xfer_ulbuf;
+ *pbuflen = data->multi->xfer_ulbuf_len;
+ return CURLE_OK;
+}
+
+void Curl_multi_xfer_ulbuf_release(struct Curl_easy *data, char *buf)
+{
+ (void)buf;
+ DEBUGASSERT(data);
+ DEBUGASSERT(data->multi);
+ DEBUGASSERT(!buf || data->multi->xfer_ulbuf == buf);
+ data->multi->xfer_ulbuf_borrowed = FALSE;
+}
+
+static void multi_xfer_bufs_free(struct Curl_multi *multi)
+{
+ DEBUGASSERT(multi);
+ Curl_safefree(multi->xfer_buf);
+ multi->xfer_buf_len = 0;
+ multi->xfer_buf_borrowed = FALSE;
+ Curl_safefree(multi->xfer_ulbuf);
+ multi->xfer_ulbuf_len = 0;
+ multi->xfer_ulbuf_borrowed = FALSE;
+}
diff --git a/Utilities/cmcurl/lib/multihandle.h b/Utilities/cmcurl/lib/multihandle.h
index e03e382..3156c83 100644
--- a/Utilities/cmcurl/lib/multihandle.h
+++ b/Utilities/cmcurl/lib/multihandle.h
@@ -124,6 +124,13 @@ struct Curl_multi {
times of all currently set timers */
struct Curl_tree *timetree;
+ /* buffer used for transfer data, lazy initialized */
+ char *xfer_buf; /* the actual buffer */
+ size_t xfer_buf_len; /* the allocated length */
+ /* buffer used for upload data, lazy initialized */
+ char *xfer_ulbuf; /* the actual buffer */
+ size_t xfer_ulbuf_len; /* the allocated length */
+
#if defined(USE_SSL)
struct multi_ssl_backend_data *ssl_backend_data;
#endif
@@ -171,6 +178,8 @@ struct Curl_multi {
#endif
BIT(dead); /* a callback returned error, everything needs to crash and
burn */
+ BIT(xfer_buf_borrowed); /* xfer_buf is currently being borrowed */
+ BIT(xfer_ulbuf_borrowed); /* xfer_buf is currently being borrowed */
#ifdef DEBUGBUILD
BIT(warned); /* true after user warned of DEBUGBUILD */
#endif
diff --git a/Utilities/cmcurl/lib/multiif.h b/Utilities/cmcurl/lib/multiif.h
index 7a344fa..37f7a44 100644
--- a/Utilities/cmcurl/lib/multiif.h
+++ b/Utilities/cmcurl/lib/multiif.h
@@ -94,4 +94,53 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi,
/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option */
unsigned int Curl_multi_max_concurrent_streams(struct Curl_multi *multi);
+/**
+ * Borrow the transfer buffer from the multi, suitable
+ * for the given transfer `data`. The buffer may only be used in one
+ * multi processing of the easy handle. It MUST be returned to the
+ * multi before it can be borrowed again.
+ * Pointers into the buffer remain only valid as long as it is borrowed.
+ *
+ * @param data the easy handle
+ * @param pbuf on return, the buffer to use or NULL on error
+ * @param pbuflen on return, the size of *pbuf or 0 on error
+ * @return CURLE_OK when buffer is available and is returned.
+ * CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
+ * CURLE_FAILED_INIT if the easy handle is without multi.
+ * CURLE_AGAIN if the buffer is borrowed already.
+ */
+CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
+ char **pbuf, size_t *pbuflen);
+/**
+ * Release the borrowed buffer. All references into the buffer become
+ * invalid after this.
+ * @param buf the buffer pointer borrowed for coding error checks.
+ */
+void Curl_multi_xfer_buf_release(struct Curl_easy *data, char *buf);
+
+/**
+ * Borrow the upload buffer from the multi, suitable
+ * for the given transfer `data`. The buffer may only be used in one
+ * multi processing of the easy handle. It MUST be returned to the
+ * multi before it can be borrowed again.
+ * Pointers into the buffer remain only valid as long as it is borrowed.
+ *
+ * @param data the easy handle
+ * @param pbuf on return, the buffer to use or NULL on error
+ * @param pbuflen on return, the size of *pbuf or 0 on error
+ * @return CURLE_OK when buffer is available and is returned.
+ * CURLE_OUT_OF_MEMORy on failure to allocate the buffer,
+ * CURLE_FAILED_INIT if the easy handle is without multi.
+ * CURLE_AGAIN if the buffer is borrowed already.
+ */
+CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
+ char **pbuf, size_t *pbuflen);
+
+/**
+ * Release the borrowed upload buffer. All references into the buffer become
+ * invalid after this.
+ * @param buf the upload buffer pointer borrowed for coding error checks.
+ */
+void Curl_multi_xfer_ulbuf_release(struct Curl_easy *data, char *buf);
+
#endif /* HEADER_CURL_MULTIIF_H */
diff --git a/Utilities/cmcurl/lib/netrc.c b/Utilities/cmcurl/lib/netrc.c
index 038c6dc..cd2a284 100644
--- a/Utilities/cmcurl/lib/netrc.c
+++ b/Utilities/cmcurl/lib/netrc.c
@@ -53,6 +53,8 @@ enum host_lookup_state {
#define NETRC_FAILED -1
#define NETRC_SUCCESS 0
+#define MAX_NETRC_LINE 4096
+
/*
* Returns zero on success.
*/
@@ -80,13 +82,14 @@ static int parsenetrc(const char *host,
file = fopen(netrcfile, FOPEN_READTEXT);
if(file) {
bool done = FALSE;
- char netrcbuffer[4096];
- int netrcbuffsize = (int)sizeof(netrcbuffer);
+ struct dynbuf buf;
+ Curl_dyn_init(&buf, MAX_NETRC_LINE);
- while(!done && Curl_get_line(netrcbuffer, netrcbuffsize, file)) {
+ while(!done && Curl_get_line(&buf, file)) {
char *tok;
char *tok_end;
bool quoted;
+ char *netrcbuffer = Curl_dyn_ptr(&buf);
if(state == MACDEF) {
if((netrcbuffer[0] == '\n') || (netrcbuffer[0] == '\r'))
state = NOTHING;
@@ -245,6 +248,7 @@ static int parsenetrc(const char *host,
} /* while Curl_get_line() */
out:
+ Curl_dyn_free(&buf);
if(!retcode) {
/* success */
if(login_alloc) {
diff --git a/Utilities/cmcurl/lib/openldap.c b/Utilities/cmcurl/lib/openldap.c
index 1e60ff7..47266f6 100644
--- a/Utilities/cmcurl/lib/openldap.c
+++ b/Utilities/cmcurl/lib/openldap.c
@@ -916,7 +916,7 @@ static CURLcode oldap_do(struct Curl_easy *data, bool *done)
else {
lr->msgid = msgid;
data->req.p.ldap = lr;
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
*done = TRUE;
}
}
diff --git a/Utilities/cmcurl/lib/pingpong.c b/Utilities/cmcurl/lib/pingpong.c
index b976ffb..81576c0 100644
--- a/Utilities/cmcurl/lib/pingpong.c
+++ b/Utilities/cmcurl/lib/pingpong.c
@@ -164,7 +164,7 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
const char *fmt,
va_list args)
{
- ssize_t bytes_written = 0;
+ size_t bytes_written = 0;
size_t write_len;
char *s;
CURLcode result;
@@ -199,8 +199,11 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
#ifdef HAVE_GSSAPI
conn->data_prot = PROT_CMD;
#endif
- result = Curl_nwrite(data, FIRSTSOCKET, s, write_len, &bytes_written);
- if(result)
+ result = Curl_conn_send(data, FIRSTSOCKET, s, write_len, &bytes_written);
+ if(result == CURLE_AGAIN) {
+ bytes_written = 0;
+ }
+ else if(result)
return result;
#ifdef HAVE_GSSAPI
data_sec = conn->data_prot;
@@ -208,9 +211,9 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
conn->data_prot = (unsigned char)data_sec;
#endif
- Curl_debug(data, CURLINFO_HEADER_OUT, s, (size_t)bytes_written);
+ Curl_debug(data, CURLINFO_HEADER_OUT, s, bytes_written);
- if(bytes_written != (ssize_t)write_len) {
+ if(bytes_written != write_len) {
/* the whole chunk was not sent, keep it around and adjust sizes */
pp->sendthis = s;
pp->sendsize = write_len;
@@ -251,7 +254,7 @@ CURLcode Curl_pp_sendf(struct Curl_easy *data, struct pingpong *pp,
}
static CURLcode pingpong_read(struct Curl_easy *data,
- curl_socket_t sockfd,
+ int sockindex,
char *buffer,
size_t buflen,
ssize_t *nread)
@@ -261,7 +264,7 @@ static CURLcode pingpong_read(struct Curl_easy *data,
enum protection_level prot = data->conn->data_prot;
data->conn->data_prot = PROT_CLEAR;
#endif
- result = Curl_read(data, sockfd, buffer, buflen, nread);
+ result = Curl_conn_recv(data, sockindex, buffer, buflen, nread);
#ifdef HAVE_GSSAPI
DEBUGASSERT(prot > PROT_NONE && prot < PROT_LAST);
data->conn->data_prot = (unsigned char)prot;
@@ -275,7 +278,7 @@ static CURLcode pingpong_read(struct Curl_easy *data,
* Reads a piece of a server response.
*/
CURLcode Curl_pp_readresp(struct Curl_easy *data,
- curl_socket_t sockfd,
+ int sockindex,
struct pingpong *pp,
int *code, /* return the server code if done */
size_t *size) /* size of the response */
@@ -300,7 +303,7 @@ CURLcode Curl_pp_readresp(struct Curl_easy *data,
ssize_t gotbytes = 0;
char buffer[900];
- result = pingpong_read(data, sockfd, buffer, sizeof(buffer), &gotbytes);
+ result = pingpong_read(data, sockindex, buffer, sizeof(buffer), &gotbytes);
if(result == CURLE_AGAIN)
return CURLE_OK;
@@ -395,14 +398,20 @@ CURLcode Curl_pp_flushsend(struct Curl_easy *data,
struct pingpong *pp)
{
/* we have a piece of a command still left to send */
- ssize_t written;
- CURLcode result = Curl_nwrite(data, FIRSTSOCKET,
- pp->sendthis + pp->sendsize - pp->sendleft,
- pp->sendleft, &written);
+ size_t written;
+ CURLcode result;
+
+ result = Curl_conn_send(data, FIRSTSOCKET,
+ pp->sendthis + pp->sendsize - pp->sendleft,
+ pp->sendleft, &written);
+ if(result == CURLE_AGAIN) {
+ result = CURLE_OK;
+ written = 0;
+ }
if(result)
return result;
- if(written != (ssize_t)pp->sendleft) {
+ if(written != pp->sendleft) {
/* only a fraction was sent */
pp->sendleft -= written;
}
@@ -423,7 +432,7 @@ CURLcode Curl_pp_disconnect(struct pingpong *pp)
bool Curl_pp_moredata(struct pingpong *pp)
{
- return (!pp->sendleft && Curl_dyn_len(&pp->recvbuf));
+ return (!pp->sendleft && Curl_dyn_len(&pp->recvbuf) > pp->nfinal);
}
#endif
diff --git a/Utilities/cmcurl/lib/pingpong.h b/Utilities/cmcurl/lib/pingpong.h
index 006b9c5..28172c7 100644
--- a/Utilities/cmcurl/lib/pingpong.h
+++ b/Utilities/cmcurl/lib/pingpong.h
@@ -132,7 +132,7 @@ CURLcode Curl_pp_vsendf(struct Curl_easy *data,
* Reads a piece of a server response.
*/
CURLcode Curl_pp_readresp(struct Curl_easy *data,
- curl_socket_t sockfd,
+ int sockindex,
struct pingpong *pp,
int *code, /* return the server code if done */
size_t *size); /* size of the response */
diff --git a/Utilities/cmcurl/lib/pop3.c b/Utilities/cmcurl/lib/pop3.c
index cf25192..993b2e1 100644
--- a/Utilities/cmcurl/lib/pop3.c
+++ b/Utilities/cmcurl/lib/pop3.c
@@ -934,7 +934,7 @@ static CURLcode pop3_state_command_resp(struct Curl_easy *data,
if(pop3->transfer == PPTRANSFER_BODY) {
/* POP3 download */
- Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
if(pp->overflow) {
/* The recv buffer contains data that is actually body content so send
@@ -970,7 +970,6 @@ static CURLcode pop3_statemachine(struct Curl_easy *data,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
int pop3code;
struct pop3_conn *pop3c = &conn->proto.pop3c;
struct pingpong *pp = &pop3c->pp;
@@ -987,7 +986,7 @@ static CURLcode pop3_statemachine(struct Curl_easy *data,
do {
/* Read the response from the server */
- result = Curl_pp_readresp(data, sock, pp, &pop3code, &nread);
+ result = Curl_pp_readresp(data, FIRSTSOCKET, pp, &pop3code, &nread);
if(result)
return result;
diff --git a/Utilities/cmcurl/lib/request.c b/Utilities/cmcurl/lib/request.c
new file mode 100644
index 0000000..b3b0582
--- /dev/null
+++ b/Utilities/cmcurl/lib/request.c
@@ -0,0 +1,409 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+#include "curl_setup.h"
+
+#include "urldata.h"
+#include "cfilters.h"
+#include "dynbuf.h"
+#include "doh.h"
+#include "multiif.h"
+#include "progress.h"
+#include "request.h"
+#include "sendf.h"
+#include "transfer.h"
+#include "url.h"
+
+/* The last 3 #include files should be in this order */
+#include "curl_printf.h"
+#include "curl_memory.h"
+#include "memdebug.h"
+
+CURLcode Curl_req_init(struct SingleRequest *req)
+{
+ memset(req, 0, sizeof(*req));
+ return CURLE_OK;
+}
+
+CURLcode Curl_req_soft_reset(struct SingleRequest *req,
+ struct Curl_easy *data)
+{
+ CURLcode result;
+
+ req->done = FALSE;
+ req->upload_done = FALSE;
+ req->download_done = FALSE;
+ req->ignorebody = FALSE;
+ req->bytecount = 0;
+ req->writebytecount = 0;
+ req->header = TRUE; /* assume header */
+ req->headerline = 0;
+ req->headerbytecount = 0;
+ req->allheadercount = 0;
+ req->deductheadercount = 0;
+
+ result = Curl_client_start(data);
+ if(result)
+ return result;
+
+ if(!req->sendbuf_init) {
+ Curl_bufq_init2(&req->sendbuf, data->set.upload_buffer_size, 1,
+ BUFQ_OPT_SOFT_LIMIT);
+ req->sendbuf_init = TRUE;
+ }
+ else {
+ Curl_bufq_reset(&req->sendbuf);
+ if(data->set.upload_buffer_size != req->sendbuf.chunk_size) {
+ Curl_bufq_free(&req->sendbuf);
+ Curl_bufq_init2(&req->sendbuf, data->set.upload_buffer_size, 1,
+ BUFQ_OPT_SOFT_LIMIT);
+ }
+ }
+
+ return CURLE_OK;
+}
+
+CURLcode Curl_req_start(struct SingleRequest *req,
+ struct Curl_easy *data)
+{
+ req->start = Curl_now();
+ return Curl_req_soft_reset(req, data);
+}
+
+static CURLcode req_flush(struct Curl_easy *data);
+
+CURLcode Curl_req_done(struct SingleRequest *req,
+ struct Curl_easy *data, bool aborted)
+{
+ (void)req;
+ if(!aborted)
+ (void)req_flush(data);
+ Curl_client_reset(data);
+ return CURLE_OK;
+}
+
+void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data)
+{
+ struct curltime t0 = {0, 0};
+
+ /* This is a bit ugly. `req->p` is a union and we assume we can
+ * free this safely without leaks. */
+ Curl_safefree(req->p.http);
+ Curl_safefree(req->newurl);
+ Curl_client_reset(data);
+ if(req->sendbuf_init)
+ Curl_bufq_reset(&req->sendbuf);
+
+#ifndef CURL_DISABLE_DOH
+ if(req->doh) {
+ Curl_close(&req->doh->probe[0].easy);
+ Curl_close(&req->doh->probe[1].easy);
+ }
+#endif
+ /* Can no longer memset() this struct as we need to keep some state */
+ req->size = -1;
+ req->maxdownload = -1;
+ req->bytecount = 0;
+ req->writebytecount = 0;
+ req->start = t0;
+ req->headerbytecount = 0;
+ req->allheadercount = 0;
+ req->deductheadercount = 0;
+ req->headerline = 0;
+ req->offset = 0;
+ req->httpcode = 0;
+ req->keepon = 0;
+ req->upgr101 = UPGR101_INIT;
+ req->timeofdoc = 0;
+ req->bodywrites = 0;
+ req->location = NULL;
+ req->newurl = NULL;
+#ifndef CURL_DISABLE_COOKIES
+ req->setcookies = 0;
+#endif
+ req->header = FALSE;
+ req->content_range = FALSE;
+ req->download_done = FALSE;
+ req->eos_written = FALSE;
+ req->eos_read = FALSE;
+ req->upload_done = FALSE;
+ req->upload_aborted = FALSE;
+ req->ignorebody = FALSE;
+ req->http_bodyless = FALSE;
+ req->chunk = FALSE;
+ req->ignore_cl = FALSE;
+ req->upload_chunky = FALSE;
+ req->getheader = FALSE;
+ req->no_body = data->set.opt_no_body;
+ req->authneg = FALSE;
+}
+
+void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data)
+{
+ /* This is a bit ugly. `req->p` is a union and we assume we can
+ * free this safely without leaks. */
+ Curl_safefree(req->p.http);
+ Curl_safefree(req->newurl);
+ if(req->sendbuf_init)
+ Curl_bufq_free(&req->sendbuf);
+ Curl_client_cleanup(data);
+
+#ifndef CURL_DISABLE_DOH
+ if(req->doh) {
+ Curl_close(&req->doh->probe[0].easy);
+ Curl_close(&req->doh->probe[1].easy);
+ Curl_dyn_free(&req->doh->probe[0].serverdoh);
+ Curl_dyn_free(&req->doh->probe[1].serverdoh);
+ curl_slist_free_all(req->doh->headers);
+ Curl_safefree(req->doh);
+ }
+#endif
+}
+
+static CURLcode xfer_send(struct Curl_easy *data,
+ const char *buf, size_t blen,
+ size_t hds_len, size_t *pnwritten)
+{
+ CURLcode result = CURLE_OK;
+
+ *pnwritten = 0;
+#ifdef CURLDEBUG
+ {
+ /* Allow debug builds to override this logic to force short initial
+ sends
+ */
+ char *p = getenv("CURL_SMALLREQSEND");
+ if(p) {
+ size_t altsize = (size_t)strtoul(p, NULL, 10);
+ if(altsize && altsize < blen)
+ blen = altsize;
+ }
+ }
+#endif
+ /* Make sure this doesn't send more body bytes than what the max send
+ speed says. The headers do not count to the max speed. */
+ if(data->set.max_send_speed) {
+ size_t body_bytes = blen - hds_len;
+ if((curl_off_t)body_bytes > data->set.max_send_speed)
+ blen = hds_len + (size_t)data->set.max_send_speed;
+ }
+
+ result = Curl_xfer_send(data, buf, blen, pnwritten);
+ if(!result && *pnwritten) {
+ if(hds_len)
+ Curl_debug(data, CURLINFO_HEADER_OUT, (char *)buf,
+ CURLMIN(hds_len, *pnwritten));
+ if(*pnwritten > hds_len) {
+ size_t body_len = *pnwritten - hds_len;
+ Curl_debug(data, CURLINFO_DATA_OUT, (char *)buf + hds_len, body_len);
+ data->req.writebytecount += body_len;
+ Curl_pgrsSetUploadCounter(data, data->req.writebytecount);
+ }
+ }
+ return result;
+}
+
+static CURLcode req_send_buffer_flush(struct Curl_easy *data)
+{
+ CURLcode result = CURLE_OK;
+ const unsigned char *buf;
+ size_t blen;
+
+ while(Curl_bufq_peek(&data->req.sendbuf, &buf, &blen)) {
+ size_t nwritten, hds_len = CURLMIN(data->req.sendbuf_hds_len, blen);
+ result = xfer_send(data, (const char *)buf, blen, hds_len, &nwritten);
+ if(result)
+ break;
+
+ Curl_bufq_skip(&data->req.sendbuf, nwritten);
+ if(hds_len) {
+ data->req.sendbuf_hds_len -= CURLMIN(hds_len, nwritten);
+ }
+ /* leave if we could not send all. Maybe network blocking or
+ * speed limits on transfer */
+ if(nwritten < blen)
+ break;
+ }
+ return result;
+}
+
+static CURLcode req_set_upload_done(struct Curl_easy *data)
+{
+ DEBUGASSERT(!data->req.upload_done);
+ data->req.upload_done = TRUE;
+ data->req.keepon &= ~(KEEP_SEND|KEEP_SEND_TIMED); /* we're done sending */
+
+ Curl_creader_done(data, data->req.upload_aborted);
+
+ if(data->req.upload_aborted) {
+ if(data->req.writebytecount)
+ infof(data, "abort upload after having sent %" CURL_FORMAT_CURL_OFF_T
+ " bytes", data->req.writebytecount);
+ else
+ infof(data, "abort upload");
+ }
+ else if(data->req.writebytecount)
+ infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T
+ " bytes", data->req.writebytecount);
+ else
+ infof(data, Curl_creader_total_length(data)?
+ "We are completely uploaded and fine" :
+ "Request completely sent off");
+
+ return Curl_xfer_send_close(data);
+}
+
+static CURLcode req_flush(struct Curl_easy *data)
+{
+ CURLcode result;
+
+ if(!data || !data->conn)
+ return CURLE_FAILED_INIT;
+
+ if(!Curl_bufq_is_empty(&data->req.sendbuf)) {
+ result = req_send_buffer_flush(data);
+ if(result)
+ return result;
+ if(!Curl_bufq_is_empty(&data->req.sendbuf)) {
+ return CURLE_AGAIN;
+ }
+ }
+
+ if(!data->req.upload_done && data->req.eos_read &&
+ Curl_bufq_is_empty(&data->req.sendbuf)) {
+ return req_set_upload_done(data);
+ }
+ return CURLE_OK;
+}
+
+static ssize_t add_from_client(void *reader_ctx,
+ unsigned char *buf, size_t buflen,
+ CURLcode *err)
+{
+ struct Curl_easy *data = reader_ctx;
+ size_t nread;
+ bool eos;
+
+ *err = Curl_client_read(data, (char *)buf, buflen, &nread, &eos);
+ if(*err)
+ return -1;
+ if(eos)
+ data->req.eos_read = TRUE;
+ return (ssize_t)nread;
+}
+
+#ifndef USE_HYPER
+
+static CURLcode req_send_buffer_add(struct Curl_easy *data,
+ const char *buf, size_t blen,
+ size_t hds_len)
+{
+ CURLcode result = CURLE_OK;
+ ssize_t n;
+ n = Curl_bufq_write(&data->req.sendbuf,
+ (const unsigned char *)buf, blen, &result);
+ if(n < 0)
+ return result;
+ /* We rely on a SOFTLIMIT on sendbuf, so it can take all data in */
+ DEBUGASSERT((size_t)n == blen);
+ data->req.sendbuf_hds_len += hds_len;
+ return CURLE_OK;
+}
+
+CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *req)
+{
+ CURLcode result;
+ const char *buf;
+ size_t blen, nwritten;
+
+ if(!data || !data->conn)
+ return CURLE_FAILED_INIT;
+
+ buf = Curl_dyn_ptr(req);
+ blen = Curl_dyn_len(req);
+ if(!Curl_creader_total_length(data)) {
+ /* Request without body. Try to send directly from the buf given. */
+ data->req.eos_read = TRUE;
+ result = xfer_send(data, buf, blen, blen, &nwritten);
+ if(result)
+ return result;
+ buf += nwritten;
+ blen -= nwritten;
+ }
+
+ if(blen) {
+ /* Either we have a request body, or we could not send the complete
+ * request in one go. Buffer the remainder and try to add as much
+ * body bytes as room is left in the buffer. Then flush. */
+ result = req_send_buffer_add(data, buf, blen, blen);
+ if(result)
+ return result;
+
+ return Curl_req_send_more(data);
+ }
+ return CURLE_OK;
+}
+#endif /* !USE_HYPER */
+
+bool Curl_req_want_send(struct Curl_easy *data)
+{
+ return data->req.sendbuf_init && !Curl_bufq_is_empty(&data->req.sendbuf);
+}
+
+bool Curl_req_done_sending(struct Curl_easy *data)
+{
+ if(data->req.upload_done) {
+ DEBUGASSERT(Curl_bufq_is_empty(&data->req.sendbuf));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+CURLcode Curl_req_send_more(struct Curl_easy *data)
+{
+ CURLcode result;
+
+ /* Fill our send buffer if more from client can be read. */
+ if(!data->req.eos_read && !Curl_bufq_is_full(&data->req.sendbuf)) {
+ ssize_t nread = Curl_bufq_sipn(&data->req.sendbuf, 0,
+ add_from_client, data, &result);
+ if(nread < 0 && result != CURLE_AGAIN)
+ return result;
+ }
+
+ result = req_flush(data);
+ if(result == CURLE_AGAIN)
+ result = CURLE_OK;
+ return result;
+}
+
+CURLcode Curl_req_abort_sending(struct Curl_easy *data)
+{
+ if(!data->req.upload_done) {
+ Curl_bufq_reset(&data->req.sendbuf);
+ data->req.upload_aborted = TRUE;
+ return req_set_upload_done(data);
+ }
+ return CURLE_OK;
+}
diff --git a/Utilities/cmcurl/lib/request.h b/Utilities/cmcurl/lib/request.h
new file mode 100644
index 0000000..488fbdd
--- /dev/null
+++ b/Utilities/cmcurl/lib/request.h
@@ -0,0 +1,227 @@
+#ifndef HEADER_CURL_REQUEST_H
+#define HEADER_CURL_REQUEST_H
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ * SPDX-License-Identifier: curl
+ *
+ ***************************************************************************/
+
+/* This file is for lib internal stuff */
+
+#include "curl_setup.h"
+
+#include "bufq.h"
+
+/* forward declarations */
+struct UserDefined;
+
+enum expect100 {
+ EXP100_SEND_DATA, /* enough waiting, just send the body now */
+ EXP100_AWAITING_CONTINUE, /* waiting for the 100 Continue header */
+ EXP100_SENDING_REQUEST, /* still sending the request but will wait for
+ the 100 header once done with the request */
+ EXP100_FAILED /* used on 417 Expectation Failed */
+};
+
+enum upgrade101 {
+ UPGR101_INIT, /* default state */
+ UPGR101_WS, /* upgrade to WebSockets requested */
+ UPGR101_H2, /* upgrade to HTTP/2 requested */
+ UPGR101_RECEIVED, /* 101 response received */
+ UPGR101_WORKING /* talking upgraded protocol */
+};
+
+
+/*
+ * Request specific data in the easy handle (Curl_easy). Previously,
+ * these members were on the connectdata struct but since a conn struct may
+ * now be shared between different Curl_easys, we store connection-specific
+ * data here. This struct only keeps stuff that's interesting for *this*
+ * request, as it will be cleared between multiple ones
+ */
+struct SingleRequest {
+ curl_off_t size; /* -1 if unknown at this point */
+ curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch,
+ -1 means unlimited */
+ curl_off_t bytecount; /* total number of bytes read */
+ curl_off_t writebytecount; /* number of bytes written */
+
+ struct curltime start; /* transfer started at this time */
+ unsigned int headerbytecount; /* received server headers (not CONNECT
+ headers) */
+ unsigned int allheadercount; /* all received headers (server + CONNECT) */
+ unsigned int deductheadercount; /* this amount of bytes doesn't count when
+ we check if anything has been transferred
+ at the end of a connection. We use this
+ counter to make only a 100 reply (without
+ a following second response code) result
+ in a CURLE_GOT_NOTHING error code */
+ int headerline; /* counts header lines to better track the
+ first one */
+ curl_off_t offset; /* possible resume offset read from the
+ Content-Range: header */
+ int httpversion; /* Version in response (09, 10, 11, etc.) */
+ int httpcode; /* error code from the 'HTTP/1.? XXX' or
+ 'RTSP/1.? XXX' line */
+ int keepon;
+ enum upgrade101 upgr101; /* 101 upgrade state */
+
+ /* Client Writer stack, handles transfer- and content-encodings, protocol
+ * checks, pausing by client callbacks. */
+ struct Curl_cwriter *writer_stack;
+ /* Client Reader stack, handles transfer- and content-encodings, protocol
+ * checks, pausing by client callbacks. */
+ struct Curl_creader *reader_stack;
+ struct bufq sendbuf; /* data which needs to be send to the server */
+ size_t sendbuf_hds_len; /* amount of header bytes in sendbuf */
+ time_t timeofdoc;
+ long bodywrites;
+ char *location; /* This points to an allocated version of the Location:
+ header data */
+ char *newurl; /* Set to the new URL to use when a redirect or a retry is
+ wanted */
+
+ /* Allocated protocol-specific data. Each protocol handler makes sure this
+ points to data it needs. */
+ union {
+ struct FILEPROTO *file;
+ struct FTP *ftp;
+ struct HTTP *http;
+ struct IMAP *imap;
+ struct ldapreqinfo *ldap;
+ struct MQTT *mqtt;
+ struct POP3 *pop3;
+ struct RTSP *rtsp;
+ struct smb_request *smb;
+ struct SMTP *smtp;
+ struct SSHPROTO *ssh;
+ struct TELNET *telnet;
+ } p;
+#ifndef CURL_DISABLE_DOH
+ struct dohdata *doh; /* DoH specific data for this request */
+#endif
+#ifndef CURL_DISABLE_COOKIES
+ unsigned char setcookies;
+#endif
+ BIT(header); /* incoming data has HTTP header */
+ BIT(done); /* request is done, e.g. no more send/recv should
+ * happen. This can be TRUE before `upload_done` or
+ * `download_done` is TRUE. */
+ BIT(content_range); /* set TRUE if Content-Range: was found */
+ BIT(download_done); /* set to TRUE when download is complete */
+ BIT(eos_written); /* iff EOS has been written to client */
+ BIT(eos_read); /* iff EOS has been read from the client */
+ BIT(rewind_read); /* iff reader needs rewind at next start */
+ BIT(upload_done); /* set to TRUE when all request data has been sent */
+ BIT(upload_aborted); /* set to TRUE when upload was aborted. Will also
+ * show `upload_done` as TRUE. */
+ BIT(ignorebody); /* we read a response-body but we ignore it! */
+ BIT(http_bodyless); /* HTTP response status code is between 100 and 199,
+ 204 or 304 */
+ BIT(chunk); /* if set, this is a chunked transfer-encoding */
+ BIT(ignore_cl); /* ignore content-length */
+ BIT(upload_chunky); /* set TRUE if we are doing chunked transfer-encoding
+ on upload */
+ BIT(getheader); /* TRUE if header parsing is wanted */
+ BIT(no_body); /* the response has no body */
+ BIT(authneg); /* TRUE when the auth phase has started, which means
+ that we are creating a request with an auth header,
+ but it is not the final request in the auth
+ negotiation. */
+ BIT(sendbuf_init); /* sendbuf is initialized */
+};
+
+/**
+ * Initialize the state of the request for first use.
+ */
+CURLcode Curl_req_init(struct SingleRequest *req);
+
+/**
+ * The request is about to start. Record time and do a soft reset.
+ */
+CURLcode Curl_req_start(struct SingleRequest *req,
+ struct Curl_easy *data);
+
+/**
+ * The request may continue with a follow up. Reset
+ * members, but keep start time for overall duration calc.
+ */
+CURLcode Curl_req_soft_reset(struct SingleRequest *req,
+ struct Curl_easy *data);
+
+/**
+ * The request is done. If not aborted, make sure that buffers are
+ * flushed to the client.
+ * @param req the request
+ * @param data the transfer
+ * @param aborted TRUE iff the request was aborted/errored
+ */
+CURLcode Curl_req_done(struct SingleRequest *req,
+ struct Curl_easy *data, bool aborted);
+
+/**
+ * Free the state of the request, not usable afterwards.
+ */
+void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data);
+
+/**
+ * Hard reset the state of the request to virgin state base on
+ * transfer settings.
+ */
+void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data);
+
+#ifndef USE_HYPER
+/**
+ * Send request headers. If not all could be sent
+ * they will be buffered. Use `Curl_req_flush()` to make sure
+ * bytes are really send.
+ * @param data the transfer making the request
+ * @param buf the complete header bytes, no body
+ * @return CURLE_OK (on blocking with *pnwritten == 0) or error.
+ */
+CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *buf);
+
+#endif /* !USE_HYPER */
+
+/**
+ * TRUE iff the request has sent all request headers and data.
+ */
+bool Curl_req_done_sending(struct Curl_easy *data);
+
+/*
+ * Read more from client and flush all buffered request bytes.
+ * @return CURLE_OK on success or the error on the sending.
+ * Never returns CURLE_AGAIN.
+ */
+CURLcode Curl_req_send_more(struct Curl_easy *data);
+
+/**
+ * TRUE iff the request wants to send, e.g. has buffered bytes.
+ */
+bool Curl_req_want_send(struct Curl_easy *data);
+
+/**
+ * Stop sending any more request data to the server.
+ * Will clear the send buffer and mark request sending as done.
+ */
+CURLcode Curl_req_abort_sending(struct Curl_easy *data);
+
+#endif /* HEADER_CURL_REQUEST_H */
diff --git a/Utilities/cmcurl/lib/rtsp.c b/Utilities/cmcurl/lib/rtsp.c
index 26f4735..9846851 100644
--- a/Utilities/cmcurl/lib/rtsp.c
+++ b/Utilities/cmcurl/lib/rtsp.c
@@ -70,8 +70,7 @@ static int rtsp_getsock_do(struct Curl_easy *data,
static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
const char *buf,
size_t blen,
- bool is_eos,
- bool *done);
+ bool is_eos);
static CURLcode rtsp_setup_connection(struct Curl_easy *data,
struct connectdata *conn);
@@ -225,8 +224,6 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
Curl_RtspReq rtspreq = data->set.rtspreq;
struct RTSP *rtsp = data->req.p.rtsp;
struct dynbuf req_buffer;
- curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */
- curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */
const char *p_request = NULL;
const char *p_session_id = NULL;
@@ -241,6 +238,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
const char *p_userpwd = NULL;
*done = TRUE;
+ /* Initialize a dynamic send buffer */
+ Curl_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
rtsp->CSeq_sent = data->state.rtsp_next_client_CSeq;
rtsp->CSeq_recv = 0;
@@ -310,9 +309,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
}
if(rtspreq == RTSPREQ_RECEIVE) {
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1);
-
- return result;
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, TRUE, -1);
+ goto out;
}
p_session_id = data->set.str[STRING_RTSP_SESSION_ID];
@@ -320,7 +318,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
(rtspreq & ~(RTSPREQ_OPTIONS | RTSPREQ_DESCRIBE | RTSPREQ_SETUP))) {
failf(data, "Refusing to issue an RTSP request [%s] without a session ID.",
p_request);
- return CURLE_BAD_FUNCTION_ARGUMENT;
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
+ goto out;
}
/* Stream URI. Default to server '*' if not specified */
@@ -347,7 +346,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
else {
failf(data,
"Refusing to issue an RTSP SETUP without a Transport: header.");
- return CURLE_BAD_FUNCTION_ARGUMENT;
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
+ goto out;
}
p_transport = data->state.aptr.rtsp_transport;
@@ -366,9 +366,10 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
data->state.aptr.accept_encoding =
aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]);
- if(!data->state.aptr.accept_encoding)
- return CURLE_OUT_OF_MEMORY;
-
+ if(!data->state.aptr.accept_encoding) {
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
+ }
p_accept_encoding = data->state.aptr.accept_encoding;
}
}
@@ -390,7 +391,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
result = Curl_http_output_auth(data, conn, p_request, HTTPREQ_GET,
p_stream_uri, FALSE);
if(result)
- return result;
+ goto out;
p_proxyuserpwd = data->state.aptr.proxyuserpwd;
p_userpwd = data->state.aptr.userpwd;
@@ -424,23 +425,22 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
*/
if(Curl_checkheaders(data, STRCONST("CSeq"))) {
failf(data, "CSeq cannot be set as a custom header.");
- return CURLE_RTSP_CSEQ_ERROR;
+ result = CURLE_RTSP_CSEQ_ERROR;
+ goto out;
}
if(Curl_checkheaders(data, STRCONST("Session"))) {
failf(data, "Session ID cannot be set as a custom header.");
- return CURLE_BAD_FUNCTION_ARGUMENT;
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
+ goto out;
}
- /* Initialize a dynamic send buffer */
- Curl_dyn_init(&req_buffer, DYN_RTSP_REQ_HEADER);
-
result =
Curl_dyn_addf(&req_buffer,
"%s %s RTSP/1.0\r\n" /* Request Stream-URI RTSP/1.0 */
"CSeq: %ld\r\n", /* CSeq */
p_request, p_stream_uri, rtsp->CSeq_sent);
if(result)
- return result;
+ goto out;
/*
* Rather than do a normal alloc line, keep the session_id unformatted
@@ -449,7 +449,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
if(p_session_id) {
result = Curl_dyn_addf(&req_buffer, "Session: %s\r\n", p_session_id);
if(result)
- return result;
+ goto out;
}
/*
@@ -481,44 +481,58 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
Curl_safefree(data->state.aptr.userpwd);
if(result)
- return result;
+ goto out;
if((rtspreq == RTSPREQ_SETUP) || (rtspreq == RTSPREQ_DESCRIBE)) {
result = Curl_add_timecondition(data, &req_buffer);
if(result)
- return result;
+ goto out;
}
result = Curl_add_custom_headers(data, FALSE, &req_buffer);
if(result)
- return result;
+ goto out;
if(rtspreq == RTSPREQ_ANNOUNCE ||
rtspreq == RTSPREQ_SET_PARAMETER ||
rtspreq == RTSPREQ_GET_PARAMETER) {
+ curl_off_t req_clen; /* request content length */
if(data->state.upload) {
- putsize = data->state.infilesize;
+ req_clen = data->state.infilesize;
data->state.httpreq = HTTPREQ_PUT;
-
+ result = Curl_creader_set_fread(data, req_clen);
+ if(result)
+ goto out;
}
else {
- postsize = (data->state.infilesize != -1)?
- data->state.infilesize:
- (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
- data->state.httpreq = HTTPREQ_POST;
+ if(data->set.postfields) {
+ size_t plen = strlen(data->set.postfields);
+ req_clen = (curl_off_t)plen;
+ result = Curl_creader_set_buf(data, data->set.postfields, plen);
+ }
+ else if(data->state.infilesize >= 0) {
+ req_clen = data->state.infilesize;
+ result = Curl_creader_set_fread(data, req_clen);
+ }
+ else {
+ req_clen = 0;
+ result = Curl_creader_set_null(data);
+ }
+ if(result)
+ goto out;
}
- if(putsize > 0 || postsize > 0) {
+ if(req_clen > 0) {
/* As stated in the http comments, it is probably not wise to
* actually set a custom Content-Length in the headers */
if(!Curl_checkheaders(data, STRCONST("Content-Length"))) {
result =
Curl_dyn_addf(&req_buffer,
"Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
- (data->state.upload ? putsize : postsize));
+ req_clen);
if(result)
- return result;
+ goto out;
}
if(rtspreq == RTSPREQ_SET_PARAMETER ||
@@ -528,7 +542,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
STRCONST("Content-Type: "
"text/parameters\r\n"));
if(result)
- return result;
+ goto out;
}
}
@@ -538,11 +552,9 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
STRCONST("Content-Type: "
"application/sdp\r\n"));
if(result)
- return result;
+ goto out;
}
}
-
- data->state.expect100header = FALSE; /* RTSP posts are simple/small */
}
else if(rtspreq == RTSPREQ_GET_PARAMETER) {
/* Check for an empty GET_PARAMETER (heartbeat) request */
@@ -550,31 +562,26 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
data->req.no_body = TRUE;
}
}
+ else {
+ result = Curl_creader_set_null(data);
+ if(result)
+ goto out;
+ }
- /* RTSP never allows chunked transfer */
- data->req.forbidchunk = TRUE;
/* Finish the request buffer */
result = Curl_dyn_addn(&req_buffer, STRCONST("\r\n"));
if(result)
- return result;
+ goto out;
- if(postsize > 0) {
- result = Curl_dyn_addn(&req_buffer, data->set.postfields,
- (size_t)postsize);
- if(result)
- return result;
- }
+ Curl_xfer_setup(data, FIRSTSOCKET, -1, TRUE, FIRSTSOCKET);
/* issue the request */
- result = Curl_buffer_send(&req_buffer, data, data->req.p.http,
- &data->info.request_size, 0, FIRSTSOCKET);
+ result = Curl_req_send(data, &req_buffer);
if(result) {
failf(data, "Failed sending RTSP request");
- return result;
+ goto out;
}
- Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, putsize?FIRSTSOCKET:-1);
-
/* Increment the CSeq on success */
data->state.rtsp_next_client_CSeq++;
@@ -585,7 +592,8 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
if(Curl_pgrsUpdate(data))
result = CURLE_ABORTED_BY_CALLBACK;
}
-
+out:
+ Curl_dyn_free(&req_buffer);
return result;
}
@@ -779,8 +787,7 @@ out:
static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
const char *buf,
size_t blen,
- bool is_eos,
- bool *done)
+ bool is_eos)
{
struct rtsp_conn *rtspc = &(data->conn->proto.rtspc);
CURLcode result = CURLE_OK;
@@ -788,7 +795,6 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
if(!data->req.header)
rtspc->in_header = FALSE;
- *done = FALSE;
if(!blen) {
goto out;
}
@@ -812,7 +818,7 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
/* we want to parse headers, do so */
if(data->req.header && blen) {
rtspc->in_header = TRUE;
- result = Curl_http_write_resp_hds(data, buf, blen, &consumed, done);
+ result = Curl_http_write_resp_hds(data, buf, blen, &consumed);
if(result)
goto out;
@@ -838,13 +844,14 @@ static CURLcode rtsp_rtp_write_resp(struct Curl_easy *data,
}
if(rtspc->state != RTP_PARSE_SKIP)
- *done = FALSE;
+ data->req.done = FALSE;
/* we SHOULD have consumed all bytes, unless the response is borked.
* In which case we write out the left over bytes, letting the client
* writer deal with it (it will report EXCESS and fail the transfer). */
DEBUGF(infof(data, "rtsp_rtp_write_resp(len=%zu, in_header=%d, done=%d "
" rtspc->state=%d, req.size=%" CURL_FORMAT_CURL_OFF_T ")",
- blen, rtspc->in_header, *done, rtspc->state, data->req.size));
+ blen, rtspc->in_header, data->req.done, rtspc->state,
+ data->req.size));
if(!result && (is_eos || blen)) {
result = Curl_client_write(data, CLIENTWRITE_BODY|
(is_eos? CLIENTWRITE_EOS:0),
diff --git a/Utilities/cmcurl/lib/sendf.c b/Utilities/cmcurl/lib/sendf.c
index db3189a..7901957 100644
--- a/Utilities/cmcurl/lib/sendf.c
+++ b/Utilities/cmcurl/lib/sendf.c
@@ -41,6 +41,7 @@
#include "cfilters.h"
#include "connect.h"
#include "content_encoding.h"
+#include "cw-out.h"
#include "vtls/vtls.h"
#include "vssh/ssh.h"
#include "easyif.h"
@@ -49,8 +50,8 @@
#include "select.h"
#include "strdup.h"
#include "http2.h"
-#include "headers.h"
#include "progress.h"
+#include "warnless.h"
#include "ws.h"
/* The last 3 #include files should be in this order */
@@ -59,342 +60,18 @@
#include "memdebug.h"
-static CURLcode do_init_stack(struct Curl_easy *data);
-
-#if defined(CURL_DO_LINEEND_CONV) && !defined(CURL_DISABLE_FTP)
-/*
- * convert_lineends() changes CRLF (\r\n) end-of-line markers to a single LF
- * (\n), with special processing for CRLF sequences that are split between two
- * blocks of data. Remaining, bare CRs are changed to LFs. The possibly new
- * size of the data is returned.
- */
-static size_t convert_lineends(struct Curl_easy *data,
- char *startPtr, size_t size)
-{
- char *inPtr, *outPtr;
-
- /* sanity check */
- if(!startPtr || (size < 1)) {
- return size;
- }
-
- if(data->state.prev_block_had_trailing_cr) {
- /* The previous block of incoming data
- had a trailing CR, which was turned into a LF. */
- if(*startPtr == '\n') {
- /* This block of incoming data starts with the
- previous block's LF so get rid of it */
- memmove(startPtr, startPtr + 1, size-1);
- size--;
- /* and it wasn't a bare CR but a CRLF conversion instead */
- data->state.crlf_conversions++;
- }
- data->state.prev_block_had_trailing_cr = FALSE; /* reset the flag */
- }
-
- /* find 1st CR, if any */
- inPtr = outPtr = memchr(startPtr, '\r', size);
- if(inPtr) {
- /* at least one CR, now look for CRLF */
- while(inPtr < (startPtr + size-1)) {
- /* note that it's size-1, so we'll never look past the last byte */
- if(memcmp(inPtr, "\r\n", 2) == 0) {
- /* CRLF found, bump past the CR and copy the NL */
- inPtr++;
- *outPtr = *inPtr;
- /* keep track of how many CRLFs we converted */
- data->state.crlf_conversions++;
- }
- else {
- if(*inPtr == '\r') {
- /* lone CR, move LF instead */
- *outPtr = '\n';
- }
- else {
- /* not a CRLF nor a CR, just copy whatever it is */
- *outPtr = *inPtr;
- }
- }
- outPtr++;
- inPtr++;
- } /* end of while loop */
-
- if(inPtr < startPtr + size) {
- /* handle last byte */
- if(*inPtr == '\r') {
- /* deal with a CR at the end of the buffer */
- *outPtr = '\n'; /* copy a NL instead */
- /* note that a CRLF might be split across two blocks */
- data->state.prev_block_had_trailing_cr = TRUE;
- }
- else {
- /* copy last byte */
- *outPtr = *inPtr;
- }
- outPtr++;
- }
- if(outPtr < startPtr + size)
- /* tidy up by null terminating the now shorter data */
- *outPtr = '\0';
-
- return (outPtr - startPtr);
- }
- return size;
-}
-#endif /* CURL_DO_LINEEND_CONV && !CURL_DISABLE_FTP */
-
-/*
- * Curl_nwrite() is an internal write function that sends data to the
- * server. Works with a socket index for the connection.
- *
- * If the write would block (CURLE_AGAIN), it returns CURLE_OK and
- * (*nwritten == 0). Otherwise we return regular CURLcode value.
- */
-CURLcode Curl_nwrite(struct Curl_easy *data,
- int sockindex,
- const void *buf,
- size_t blen,
- ssize_t *pnwritten)
-{
- ssize_t nwritten;
- CURLcode result = CURLE_OK;
- struct connectdata *conn;
-
- DEBUGASSERT(sockindex >= 0 && sockindex < 2);
- DEBUGASSERT(pnwritten);
- DEBUGASSERT(data);
- DEBUGASSERT(data->conn);
- conn = data->conn;
-#ifdef CURLDEBUG
- {
- /* Allow debug builds to override this logic to force short sends
- */
- char *p = getenv("CURL_SMALLSENDS");
- if(p) {
- size_t altsize = (size_t)strtoul(p, NULL, 10);
- if(altsize)
- blen = CURLMIN(blen, altsize);
- }
- }
-#endif
- nwritten = conn->send[sockindex](data, sockindex, buf, blen, &result);
- if(result == CURLE_AGAIN) {
- nwritten = 0;
- result = CURLE_OK;
- }
- else if(result) {
- nwritten = -1; /* make sure */
- }
- else {
- DEBUGASSERT(nwritten >= 0);
- }
-
- *pnwritten = nwritten;
- return result;
-}
-
-/*
- * Curl_write() is an internal write function that sends data to the
- * server. Works with plain sockets, SCP, SSL or kerberos.
- *
- * If the write would block (CURLE_AGAIN), we return CURLE_OK and
- * (*written == 0). Otherwise we return regular CURLcode value.
- */
-CURLcode Curl_write(struct Curl_easy *data,
- curl_socket_t sockfd,
- const void *mem,
- size_t len,
- ssize_t *written)
-{
- struct connectdata *conn;
- int num;
-
- DEBUGASSERT(data);
- DEBUGASSERT(data->conn);
- conn = data->conn;
- num = (sockfd != CURL_SOCKET_BAD && sockfd == conn->sock[SECONDARYSOCKET]);
- return Curl_nwrite(data, num, mem, len, written);
-}
-
-static CURLcode pausewrite(struct Curl_easy *data,
- int type, /* what type of data */
- bool paused_body,
- const char *ptr,
- size_t len)
-{
- /* signalled to pause sending on this connection, but since we have data
- we want to send we need to dup it to save a copy for when the sending
- is again enabled */
- struct SingleRequest *k = &data->req;
- struct UrlState *s = &data->state;
- unsigned int i;
- bool newtype = TRUE;
-
- Curl_conn_ev_data_pause(data, TRUE);
-
- if(s->tempcount) {
- for(i = 0; i< s->tempcount; i++) {
- if(s->tempwrite[i].type == type &&
- !!s->tempwrite[i].paused_body == !!paused_body) {
- /* data for this type exists */
- newtype = FALSE;
- break;
- }
- }
- DEBUGASSERT(i < 3);
- if(i >= 3)
- /* There are more types to store than what fits: very bad */
- return CURLE_OUT_OF_MEMORY;
- }
- else
- i = 0;
-
- if(newtype) {
- /* store this information in the state struct for later use */
- Curl_dyn_init(&s->tempwrite[i].b, DYN_PAUSE_BUFFER);
- s->tempwrite[i].type = type;
- s->tempwrite[i].paused_body = paused_body;
- s->tempcount++;
- }
-
- if(Curl_dyn_addn(&s->tempwrite[i].b, (unsigned char *)ptr, len))
- return CURLE_OUT_OF_MEMORY;
-
- /* mark the connection as RECV paused */
- k->keepon |= KEEP_RECV_PAUSE;
-
- return CURLE_OK;
-}
-
-
-/* chop_write() writes chunks of data not larger than CURL_MAX_WRITE_SIZE via
- * client write callback(s) and takes care of pause requests from the
- * callbacks.
- */
-static CURLcode chop_write(struct Curl_easy *data,
- int type,
- bool skip_body_write,
- char *optr,
- size_t olen)
-{
- struct connectdata *conn = data->conn;
- curl_write_callback writeheader = NULL;
- curl_write_callback writebody = NULL;
- char *ptr = optr;
- size_t len = olen;
- void *writebody_ptr = data->set.out;
-
- if(!len)
- return CURLE_OK;
-
- /* If reading is paused, append this data to the already held data for this
- type. */
- if(data->req.keepon & KEEP_RECV_PAUSE)
- return pausewrite(data, type, !skip_body_write, ptr, len);
-
- /* Determine the callback(s) to use. */
- if(!skip_body_write &&
- ((type & CLIENTWRITE_BODY) ||
- ((type & CLIENTWRITE_HEADER) && data->set.include_header))) {
- writebody = data->set.fwrite_func;
- }
- if((type & (CLIENTWRITE_HEADER|CLIENTWRITE_INFO)) &&
- (data->set.fwrite_header || data->set.writeheader)) {
- /*
- * Write headers to the same callback or to the especially setup
- * header callback function (added after version 7.7.1).
- */
- writeheader =
- data->set.fwrite_header? data->set.fwrite_header: data->set.fwrite_func;
- }
-
- /* Chop data, write chunks. */
- while(len) {
- size_t chunklen = len <= CURL_MAX_WRITE_SIZE? len: CURL_MAX_WRITE_SIZE;
-
- if(writebody) {
- size_t wrote;
- Curl_set_in_callback(data, true);
- wrote = writebody(ptr, 1, chunklen, writebody_ptr);
- Curl_set_in_callback(data, false);
-
- if(CURL_WRITEFUNC_PAUSE == wrote) {
- if(conn->handler->flags & PROTOPT_NONETWORK) {
- /* Protocols that work without network cannot be paused. This is
- actually only FILE:// just now, and it can't pause since the
- transfer isn't done using the "normal" procedure. */
- failf(data, "Write callback asked for PAUSE when not supported");
- return CURLE_WRITE_ERROR;
- }
- return pausewrite(data, type, TRUE, ptr, len);
- }
- if(wrote != chunklen) {
- failf(data, "Failure writing output to destination");
- return CURLE_WRITE_ERROR;
- }
- }
-
- ptr += chunklen;
- len -= chunklen;
- }
-
-#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_HEADERS_API)
- /* HTTP header, but not status-line */
- if((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
- (type & CLIENTWRITE_HEADER) && !(type & CLIENTWRITE_STATUS) ) {
- unsigned char htype = (unsigned char)
- (type & CLIENTWRITE_CONNECT ? CURLH_CONNECT :
- (type & CLIENTWRITE_1XX ? CURLH_1XX :
- (type & CLIENTWRITE_TRAILER ? CURLH_TRAILER :
- CURLH_HEADER)));
- CURLcode result = Curl_headers_push(data, optr, htype);
- if(result)
- return result;
- }
-#endif
-
- if(writeheader) {
- size_t wrote;
-
- Curl_set_in_callback(data, true);
- wrote = writeheader(optr, 1, olen, data->set.writeheader);
- Curl_set_in_callback(data, false);
-
- if(CURL_WRITEFUNC_PAUSE == wrote)
- return pausewrite(data, type, FALSE, optr, olen);
- if(wrote != olen) {
- failf(data, "Failed writing header");
- return CURLE_WRITE_ERROR;
- }
- }
-
- return CURLE_OK;
-}
-
+static CURLcode do_init_writer_stack(struct Curl_easy *data);
/* Curl_client_write() sends data to the write callback(s)
The bit pattern defines to what "streams" to write to. Body and/or header.
The defines are in sendf.h of course.
-
- If CURL_DO_LINEEND_CONV is enabled, data is converted IN PLACE to the
- local character encoding. This is a problem and should be changed in
- the future to leave the original data alone.
*/
CURLcode Curl_client_write(struct Curl_easy *data,
- int type, char *buf, size_t blen)
+ int type, const char *buf, size_t blen)
{
CURLcode result;
-#if !defined(CURL_DISABLE_FTP) && defined(CURL_DO_LINEEND_CONV)
- /* FTP data may need conversion. */
- if((type & CLIENTWRITE_BODY) &&
- (data->conn->handler->protocol & PROTO_FAMILY_FTP) &&
- data->conn->proto.ftpc.transfertype == 'A') {
- /* convert end-of-line markers */
- blen = convert_lineends(data, buf, blen);
- }
-#endif
/* it is one of those, at least */
DEBUGASSERT(type & (CLIENTWRITE_BODY|CLIENTWRITE_HEADER|CLIENTWRITE_INFO));
/* BODY is only BODY (with optional EOS) */
@@ -405,7 +82,7 @@ CURLcode Curl_client_write(struct Curl_easy *data,
((type & ~(CLIENTWRITE_INFO|CLIENTWRITE_EOS)) == 0));
if(!data->req.writer_stack) {
- result = do_init_stack(data);
+ result = do_init_writer_stack(data);
if(result)
return result;
DEBUGASSERT(data->req.writer_stack);
@@ -414,58 +91,86 @@ CURLcode Curl_client_write(struct Curl_easy *data,
return Curl_cwriter_write(data, data->req.writer_stack, type, buf, blen);
}
-CURLcode Curl_client_unpause(struct Curl_easy *data)
-{
- CURLcode result = CURLE_OK;
-
- if(data->state.tempcount) {
- /* there are buffers for sending that can be delivered as the receive
- pausing is lifted! */
- unsigned int i;
- unsigned int count = data->state.tempcount;
- struct tempbuf writebuf[3]; /* there can only be three */
-
- /* copy the structs to allow for immediate re-pausing */
- for(i = 0; i < data->state.tempcount; i++) {
- writebuf[i] = data->state.tempwrite[i];
- Curl_dyn_init(&data->state.tempwrite[i].b, DYN_PAUSE_BUFFER);
- }
- data->state.tempcount = 0;
-
- for(i = 0; i < count; i++) {
- /* even if one function returns error, this loops through and frees
- all buffers */
- if(!result)
- result = chop_write(data, writebuf[i].type,
- !writebuf[i].paused_body,
- Curl_dyn_ptr(&writebuf[i].b),
- Curl_dyn_len(&writebuf[i].b));
- Curl_dyn_free(&writebuf[i].b);
- }
- }
- return result;
-}
-
-void Curl_client_cleanup(struct Curl_easy *data)
+static void cl_reset_writer(struct Curl_easy *data)
{
struct Curl_cwriter *writer = data->req.writer_stack;
- size_t i;
-
while(writer) {
data->req.writer_stack = writer->next;
writer->cwt->do_close(data, writer);
free(writer);
writer = data->req.writer_stack;
}
+}
- for(i = 0; i < data->state.tempcount; i++) {
- Curl_dyn_free(&data->state.tempwrite[i].b);
+static void cl_reset_reader(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = data->req.reader_stack;
+ while(reader) {
+ data->req.reader_stack = reader->next;
+ reader->crt->do_close(data, reader);
+ free(reader);
+ reader = data->req.reader_stack;
}
- data->state.tempcount = 0;
+}
+
+void Curl_client_cleanup(struct Curl_easy *data)
+{
+ DEBUGF(infof(data, "Curl_client_cleanup()"));
+ cl_reset_reader(data);
+ cl_reset_writer(data);
+
data->req.bytecount = 0;
data->req.headerline = 0;
}
+void Curl_client_reset(struct Curl_easy *data)
+{
+ if(data->req.rewind_read) {
+ /* already requested */
+ DEBUGF(infof(data, "Curl_client_reset(), will rewind_read"));
+ }
+ else {
+ DEBUGF(infof(data, "Curl_client_reset(), clear readers"));
+ cl_reset_reader(data);
+ }
+ cl_reset_writer(data);
+
+ data->req.bytecount = 0;
+ data->req.headerline = 0;
+}
+
+CURLcode Curl_client_start(struct Curl_easy *data)
+{
+ if(data->req.rewind_read) {
+ struct Curl_creader *r = data->req.reader_stack;
+ CURLcode result = CURLE_OK;
+
+ DEBUGF(infof(data, "client start, rewind readers"));
+ while(r) {
+ result = r->crt->rewind(data, r);
+ if(result) {
+ failf(data, "rewind of client reader '%s' failed: %d",
+ r->crt->name, result);
+ return result;
+ }
+ r = r->next;
+ }
+ data->req.rewind_read = FALSE;
+ cl_reset_reader(data);
+ }
+ return CURLE_OK;
+}
+
+bool Curl_creader_will_rewind(struct Curl_easy *data)
+{
+ return data->req.rewind_read;
+}
+
+void Curl_creader_set_rewind(struct Curl_easy *data, bool enable)
+{
+ data->req.rewind_read = !!enable;
+}
+
/* Write data using an unencoding writer stack. "nbytes" is not
allowed to be 0. */
CURLcode Curl_cwriter_write(struct Curl_easy *data,
@@ -499,26 +204,6 @@ void Curl_cwriter_def_close(struct Curl_easy *data,
(void) writer;
}
-/* Real client writer to installed callbacks. */
-static CURLcode cw_client_write(struct Curl_easy *data,
- struct Curl_cwriter *writer, int type,
- const char *buf, size_t nbytes)
-{
- (void)writer;
- if(!nbytes)
- return CURLE_OK;
- return chop_write(data, type, FALSE, (char *)buf, nbytes);
-}
-
-static const struct Curl_cwtype cw_client = {
- "client",
- NULL,
- Curl_cwriter_def_init,
- cw_client_write,
- Curl_cwriter_def_close,
- sizeof(struct Curl_cwriter)
-};
-
static size_t get_max_body_write_len(struct Curl_easy *data, curl_off_t limit)
{
if(limit != -1) {
@@ -541,28 +226,32 @@ static size_t get_max_body_write_len(struct Curl_easy *data, curl_off_t limit)
return SIZE_T_MAX;
}
+struct cw_download_ctx {
+ struct Curl_cwriter super;
+ BIT(started_response);
+};
/* Download client writer in phase CURL_CW_PROTOCOL that
* sees the "real" download body data. */
static CURLcode cw_download_write(struct Curl_easy *data,
struct Curl_cwriter *writer, int type,
const char *buf, size_t nbytes)
{
+ struct cw_download_ctx *ctx = writer->ctx;
CURLcode result;
size_t nwrite, excess_len = 0;
+ bool is_connect = !!(type & CLIENTWRITE_CONNECT);
+
+ if(!is_connect && !ctx->started_response) {
+ Curl_pgrsTime(data, TIMER_STARTTRANSFER);
+ ctx->started_response = TRUE;
+ }
if(!(type & CLIENTWRITE_BODY)) {
- if((type & CLIENTWRITE_CONNECT) && data->set.suppress_connect_headers)
+ if(is_connect && data->set.suppress_connect_headers)
return CURLE_OK;
return Curl_cwriter_write(data, writer->next, type, buf, nbytes);
}
- if(!data->req.bytecount) {
- Curl_pgrsTime(data, TIMER_STARTTRANSFER);
- if(data->req.exp100 > EXP100_SEND_DATA)
- /* set time stamp to compare with when waiting for the 100 */
- data->req.start100 = Curl_now();
- }
-
/* Here, we deal with REAL BODY bytes. All filtering and transfer
* encodings have been applied and only the true content, e.g. BODY,
* bytes are passed here.
@@ -575,6 +264,9 @@ static CURLcode cw_download_write(struct Curl_easy *data,
DEBUGF(infof(data, "did not want a BODY, but seeing %zu bytes",
nbytes));
data->req.download_done = TRUE;
+ if(data->info.header_size)
+ /* if headers have been received, this is fine */
+ return CURLE_OK;
return CURLE_WEIRD_SERVER_REPLY;
}
@@ -604,14 +296,14 @@ static CURLcode cw_download_write(struct Curl_easy *data,
}
}
- /* Update stats, write and report progress */
- data->req.bytecount += nwrite;
- ++data->req.bodywrites;
- if(!data->req.ignorebody && nwrite) {
+ if(!data->req.ignorebody && (nwrite || (type & CLIENTWRITE_EOS))) {
result = Curl_cwriter_write(data, writer->next, type, buf, nwrite);
if(result)
return result;
}
+ /* Update stats, write and report progress */
+ data->req.bytecount += nwrite;
+ ++data->req.bodywrites;
result = Curl_pgrsSetDownloadCounter(data, data->req.bytecount);
if(result)
return result;
@@ -646,7 +338,7 @@ static const struct Curl_cwtype cw_download = {
Curl_cwriter_def_init,
cw_download_write,
Curl_cwriter_def_close,
- sizeof(struct Curl_cwriter)
+ sizeof(struct cw_download_ctx)
};
/* RAW client writer in phase CURL_CW_RAW that
@@ -676,15 +368,18 @@ CURLcode Curl_cwriter_create(struct Curl_cwriter **pwriter,
const struct Curl_cwtype *cwt,
Curl_cwriter_phase phase)
{
- struct Curl_cwriter *writer;
+ struct Curl_cwriter *writer = NULL;
CURLcode result = CURLE_OUT_OF_MEMORY;
+ void *p;
DEBUGASSERT(cwt->cwriter_size >= sizeof(struct Curl_cwriter));
- writer = (struct Curl_cwriter *) calloc(1, cwt->cwriter_size);
- if(!writer)
+ p = calloc(1, cwt->cwriter_size);
+ if(!p)
goto out;
+ writer = (struct Curl_cwriter *)p;
writer->cwt = cwt;
+ writer->ctx = p;
writer->phase = phase;
result = cwt->do_init(data, writer);
@@ -716,14 +411,14 @@ size_t Curl_cwriter_count(struct Curl_easy *data, Curl_cwriter_phase phase)
return n;
}
-static CURLcode do_init_stack(struct Curl_easy *data)
+static CURLcode do_init_writer_stack(struct Curl_easy *data)
{
struct Curl_cwriter *writer;
CURLcode result;
DEBUGASSERT(!data->req.writer_stack);
result = Curl_cwriter_create(&data->req.writer_stack,
- data, &cw_client, CURL_CW_CLIENT);
+ data, &Curl_cwt_out, CURL_CW_CLIENT);
if(result)
return result;
@@ -752,7 +447,7 @@ CURLcode Curl_cwriter_add(struct Curl_easy *data,
struct Curl_cwriter **anchor = &data->req.writer_stack;
if(!*anchor) {
- result = do_init_stack(data);
+ result = do_init_writer_stack(data);
if(result)
return result;
}
@@ -766,6 +461,28 @@ CURLcode Curl_cwriter_add(struct Curl_easy *data,
return CURLE_OK;
}
+struct Curl_cwriter *Curl_cwriter_get_by_name(struct Curl_easy *data,
+ const char *name)
+{
+ struct Curl_cwriter *writer;
+ for(writer = data->req.writer_stack; writer; writer = writer->next) {
+ if(!strcmp(name, writer->cwt->name))
+ return writer;
+ }
+ return NULL;
+}
+
+struct Curl_cwriter *Curl_cwriter_get_by_type(struct Curl_easy *data,
+ const struct Curl_cwtype *cwt)
+{
+ struct Curl_cwriter *writer;
+ for(writer = data->req.writer_stack; writer; writer = writer->next) {
+ if(writer->cwt == cwt)
+ return writer;
+ }
+ return NULL;
+}
+
void Curl_cwriter_remove_by_name(struct Curl_easy *data,
const char *name)
{
@@ -782,40 +499,844 @@ void Curl_cwriter_remove_by_name(struct Curl_easy *data,
}
}
-/*
- * Internal read-from-socket function. This is meant to deal with plain
- * sockets, SSL sockets and kerberos sockets.
- *
- * Returns a regular CURLcode value.
- */
-CURLcode Curl_read(struct Curl_easy *data, /* transfer */
- curl_socket_t sockfd, /* read from this socket */
- char *buf, /* store read data here */
- size_t sizerequested, /* max amount to read */
- ssize_t *n) /* amount bytes read */
-{
- CURLcode result = CURLE_RECV_ERROR;
- ssize_t nread = 0;
- size_t bytesfromsocket = 0;
- char *buffertofill = NULL;
- struct connectdata *conn = data->conn;
-
- /* Set 'num' to 0 or 1, depending on which socket that has been sent here.
- If it is the second socket, we set num to 1. Otherwise to 0. This lets
- us use the correct ssl handle. */
- int num = (sockfd == conn->sock[SECONDARYSOCKET]);
-
- *n = 0; /* reset amount to zero */
-
- bytesfromsocket = CURLMIN(sizerequested, (size_t)data->set.buffer_size);
- buffertofill = buf;
-
- nread = conn->recv[num](data, num, buffertofill, bytesfromsocket, &result);
- if(nread < 0)
+CURLcode Curl_creader_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen, size_t *nread, bool *eos)
+{
+ if(!reader)
+ return CURLE_READ_ERROR;
+ return reader->crt->do_read(data, reader, buf, blen, nread, eos);
+}
+
+CURLcode Curl_creader_def_init(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)data;
+ (void)reader;
+ return CURLE_OK;
+}
+
+void Curl_creader_def_close(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)data;
+ (void)reader;
+}
+
+CURLcode Curl_creader_def_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *nread, bool *eos)
+{
+ if(reader->next)
+ return reader->next->crt->do_read(data, reader->next, buf, blen,
+ nread, eos);
+ else {
+ *nread = 0;
+ *eos = FALSE;
+ return CURLE_READ_ERROR;
+ }
+}
+
+bool Curl_creader_def_needs_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)data;
+ (void)reader;
+ return FALSE;
+}
+
+curl_off_t Curl_creader_def_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ return reader->next?
+ reader->next->crt->total_length(data, reader->next) : -1;
+}
+
+CURLcode Curl_creader_def_resume_from(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ curl_off_t offset)
+{
+ (void)data;
+ (void)reader;
+ (void)offset;
+ return CURLE_READ_ERROR;
+}
+
+CURLcode Curl_creader_def_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)data;
+ (void)reader;
+ return CURLE_OK;
+}
+
+CURLcode Curl_creader_def_unpause(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ (void)data;
+ (void)reader;
+ return CURLE_OK;
+}
+
+void Curl_creader_def_done(struct Curl_easy *data,
+ struct Curl_creader *reader, int premature)
+{
+ (void)data;
+ (void)reader;
+ (void)premature;
+}
+
+struct cr_in_ctx {
+ struct Curl_creader super;
+ curl_read_callback read_cb;
+ void *cb_user_data;
+ curl_off_t total_len;
+ curl_off_t read_len;
+ CURLcode error_result;
+ BIT(seen_eos);
+ BIT(errored);
+ BIT(has_used_cb);
+};
+
+static CURLcode cr_in_init(struct Curl_easy *data, struct Curl_creader *reader)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+ (void)data;
+ ctx->read_cb = data->state.fread_func;
+ ctx->cb_user_data = data->state.in;
+ ctx->total_len = -1;
+ ctx->read_len = 0;
+ return CURLE_OK;
+}
+
+/* Real client reader to installed client callbacks. */
+static CURLcode cr_in_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+ size_t nread;
+
+ /* Once we have errored, we will return the same error forever */
+ if(ctx->errored) {
+ *pnread = 0;
+ *peos = FALSE;
+ return ctx->error_result;
+ }
+ if(ctx->seen_eos) {
+ *pnread = 0;
+ *peos = TRUE;
+ return CURLE_OK;
+ }
+ /* respect length limitations */
+ if(ctx->total_len >= 0) {
+ curl_off_t remain = ctx->total_len - ctx->read_len;
+ if(remain <= 0)
+ blen = 0;
+ else if(remain < (curl_off_t)blen)
+ blen = (size_t)remain;
+ }
+ nread = 0;
+ if(ctx->read_cb && blen) {
+ Curl_set_in_callback(data, true);
+ nread = ctx->read_cb(buf, 1, blen, ctx->cb_user_data);
+ Curl_set_in_callback(data, false);
+ ctx->has_used_cb = TRUE;
+ }
+
+ switch(nread) {
+ case 0:
+ if((ctx->total_len >= 0) && (ctx->read_len < ctx->total_len)) {
+ failf(data, "client read function EOF fail, only "
+ "only %"CURL_FORMAT_CURL_OFF_T"/%"CURL_FORMAT_CURL_OFF_T
+ " of needed bytes read", ctx->read_len, ctx->total_len);
+ return CURLE_READ_ERROR;
+ }
+ *pnread = 0;
+ *peos = TRUE;
+ ctx->seen_eos = TRUE;
+ break;
+
+ case CURL_READFUNC_ABORT:
+ failf(data, "operation aborted by callback");
+ *pnread = 0;
+ *peos = FALSE;
+ ctx->errored = TRUE;
+ ctx->error_result = CURLE_ABORTED_BY_CALLBACK;
+ return CURLE_ABORTED_BY_CALLBACK;
+
+ case CURL_READFUNC_PAUSE:
+ if(data->conn->handler->flags & PROTOPT_NONETWORK) {
+ /* protocols that work without network cannot be paused. This is
+ actually only FILE:// just now, and it can't pause since the transfer
+ isn't done using the "normal" procedure. */
+ failf(data, "Read callback asked for PAUSE when not supported");
+ return CURLE_READ_ERROR;
+ }
+ /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
+ data->req.keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
+ *pnread = 0;
+ *peos = FALSE;
+ break; /* nothing was read */
+
+ default:
+ if(nread > blen) {
+ /* the read function returned a too large value */
+ failf(data, "read function returned funny value");
+ *pnread = 0;
+ *peos = FALSE;
+ ctx->errored = TRUE;
+ ctx->error_result = CURLE_READ_ERROR;
+ return CURLE_READ_ERROR;
+ }
+ ctx->read_len += nread;
+ if(ctx->total_len >= 0)
+ ctx->seen_eos = (ctx->read_len >= ctx->total_len);
+ *pnread = nread;
+ *peos = ctx->seen_eos;
+ break;
+ }
+ DEBUGF(infof(data, "cr_in_read(len=%zu, total=%"CURL_FORMAT_CURL_OFF_T
+ ", read=%"CURL_FORMAT_CURL_OFF_T") -> %d, %zu, %d",
+ blen, ctx->total_len, ctx->read_len, CURLE_OK, *pnread, *peos));
+ return CURLE_OK;
+}
+
+static bool cr_in_needs_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+ (void)data;
+ return ctx->has_used_cb;
+}
+
+static curl_off_t cr_in_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+ (void)data;
+ return ctx->total_len;
+}
+
+static CURLcode cr_in_resume_from(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ curl_off_t offset)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+ int seekerr = CURL_SEEKFUNC_CANTSEEK;
+
+ DEBUGASSERT(data->conn);
+ /* already started reading? */
+ if(ctx->read_len)
+ return CURLE_READ_ERROR;
+
+ if(data->set.seek_func) {
+ Curl_set_in_callback(data, true);
+ seekerr = data->set.seek_func(data->set.seek_client, offset, SEEK_SET);
+ Curl_set_in_callback(data, false);
+ }
+
+ if(seekerr != CURL_SEEKFUNC_OK) {
+ curl_off_t passed = 0;
+
+ if(seekerr != CURL_SEEKFUNC_CANTSEEK) {
+ failf(data, "Could not seek stream");
+ return CURLE_READ_ERROR;
+ }
+ /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
+ do {
+ char scratch[4*1024];
+ size_t readthisamountnow =
+ (offset - passed > (curl_off_t)sizeof(scratch)) ?
+ sizeof(scratch) :
+ curlx_sotouz(offset - passed);
+ size_t actuallyread;
+
+ Curl_set_in_callback(data, true);
+ actuallyread = ctx->read_cb(scratch, 1, readthisamountnow,
+ ctx->cb_user_data);
+ Curl_set_in_callback(data, false);
+
+ passed += actuallyread;
+ if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
+ /* this checks for greater-than only to make sure that the
+ CURL_READFUNC_ABORT return code still aborts */
+ failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T
+ " bytes from the input", passed);
+ return CURLE_READ_ERROR;
+ }
+ } while(passed < offset);
+ }
+
+ /* now, decrease the size of the read */
+ if(ctx->total_len > 0) {
+ ctx->total_len -= offset;
+
+ if(ctx->total_len <= 0) {
+ failf(data, "File already completely uploaded");
+ return CURLE_PARTIAL_FILE;
+ }
+ }
+ /* we've passed, proceed as normal */
+ return CURLE_OK;
+}
+
+static CURLcode cr_in_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_in_ctx *ctx = reader->ctx;
+
+ /* If we never invoked the callback, there is noting to rewind */
+ if(!ctx->has_used_cb)
+ return CURLE_OK;
+
+ if(data->set.seek_func) {
+ int err;
+
+ Curl_set_in_callback(data, true);
+ err = (data->set.seek_func)(data->set.seek_client, 0, SEEK_SET);
+ Curl_set_in_callback(data, false);
+ DEBUGF(infof(data, "cr_in, rewind via set.seek_func -> %d", err));
+ if(err) {
+ failf(data, "seek callback returned error %d", (int)err);
+ return CURLE_SEND_FAIL_REWIND;
+ }
+ }
+ else if(data->set.ioctl_func) {
+ curlioerr err;
+
+ Curl_set_in_callback(data, true);
+ err = (data->set.ioctl_func)(data, CURLIOCMD_RESTARTREAD,
+ data->set.ioctl_client);
+ Curl_set_in_callback(data, false);
+ DEBUGF(infof(data, "cr_in, rewind via set.ioctl_func -> %d", (int)err));
+ if(err) {
+ failf(data, "ioctl callback returned error %d", (int)err);
+ return CURLE_SEND_FAIL_REWIND;
+ }
+ }
+ else {
+ /* If no CURLOPT_READFUNCTION is used, we know that we operate on a
+ given FILE * stream and we can actually attempt to rewind that
+ ourselves with fseek() */
+ if(data->state.fread_func == (curl_read_callback)fread) {
+ int err = fseek(data->state.in, 0, SEEK_SET);
+ DEBUGF(infof(data, "cr_in, rewind via fseek -> %d(%d)",
+ (int)err, (int)errno));
+ if(-1 != err)
+ /* successful rewind */
+ return CURLE_OK;
+ }
+
+ /* no callback set or failure above, makes us fail at once */
+ failf(data, "necessary data rewind wasn't possible");
+ return CURLE_SEND_FAIL_REWIND;
+ }
+ return CURLE_OK;
+}
+
+
+static const struct Curl_crtype cr_in = {
+ "cr-in",
+ cr_in_init,
+ cr_in_read,
+ Curl_creader_def_close,
+ cr_in_needs_rewind,
+ cr_in_total_length,
+ cr_in_resume_from,
+ cr_in_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct cr_in_ctx)
+};
+
+CURLcode Curl_creader_create(struct Curl_creader **preader,
+ struct Curl_easy *data,
+ const struct Curl_crtype *crt,
+ Curl_creader_phase phase)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result = CURLE_OUT_OF_MEMORY;
+ void *p;
+
+ DEBUGASSERT(crt->creader_size >= sizeof(struct Curl_creader));
+ p = calloc(1, crt->creader_size);
+ if(!p)
goto out;
- *n += nread;
- result = CURLE_OK;
+ reader = (struct Curl_creader *)p;
+ reader->crt = crt;
+ reader->ctx = p;
+ reader->phase = phase;
+ result = crt->do_init(data, reader);
+
out:
+ *preader = result? NULL : reader;
+ if(result)
+ free(reader);
+ return result;
+}
+
+void Curl_creader_free(struct Curl_easy *data, struct Curl_creader *reader)
+{
+ if(reader) {
+ reader->crt->do_close(data, reader);
+ free(reader);
+ }
+}
+
+struct cr_lc_ctx {
+ struct Curl_creader super;
+ struct bufq buf;
+ BIT(read_eos); /* we read an EOS from the next reader */
+ BIT(eos); /* we have returned an EOS */
+};
+
+static CURLcode cr_lc_init(struct Curl_easy *data, struct Curl_creader *reader)
+{
+ struct cr_lc_ctx *ctx = reader->ctx;
+ (void)data;
+ Curl_bufq_init2(&ctx->buf, (16 * 1024), 1, BUFQ_OPT_SOFT_LIMIT);
+ return CURLE_OK;
+}
+
+static void cr_lc_close(struct Curl_easy *data, struct Curl_creader *reader)
+{
+ struct cr_lc_ctx *ctx = reader->ctx;
+ (void)data;
+ Curl_bufq_free(&ctx->buf);
+}
+
+/* client reader doing line end conversions. */
+static CURLcode cr_lc_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct cr_lc_ctx *ctx = reader->ctx;
+ CURLcode result;
+ size_t nread, i, start, n;
+ bool eos;
+
+ if(ctx->eos) {
+ *pnread = 0;
+ *peos = TRUE;
+ return CURLE_OK;
+ }
+
+ if(Curl_bufq_is_empty(&ctx->buf)) {
+ if(ctx->read_eos) {
+ ctx->eos = TRUE;
+ *pnread = 0;
+ *peos = TRUE;
+ return CURLE_OK;
+ }
+ /* Still getting data form the next reader, ctx->buf is empty */
+ result = Curl_creader_read(data, reader->next, buf, blen, &nread, &eos);
+ if(result)
+ return result;
+ ctx->read_eos = eos;
+
+ if(!nread || !memchr(buf, '\n', nread)) {
+ /* nothing to convert, return this right away */
+ if(ctx->read_eos)
+ ctx->eos = TRUE;
+ *pnread = nread;
+ *peos = ctx->eos;
+ return CURLE_OK;
+ }
+
+ /* at least one \n needs conversion to '\r\n', place into ctx->buf */
+ for(i = start = 0; i < nread; ++i) {
+ if(buf[i] != '\n')
+ continue;
+ /* on a soft limit bufq, we do not need to check length */
+ result = Curl_bufq_cwrite(&ctx->buf, buf + start, i - start, &n);
+ if(!result)
+ result = Curl_bufq_cwrite(&ctx->buf, STRCONST("\r\n"), &n);
+ if(result)
+ return result;
+ start = i + 1;
+ if(!data->set.crlf && (data->state.infilesize != -1)) {
+ /* we're here only because FTP is in ASCII mode...
+ bump infilesize for the LF we just added */
+ data->state.infilesize++;
+ /* comment: this might work for FTP, but in HTTP we could not change
+ * the content length after having started the request... */
+ }
+ }
+ }
+
+ DEBUGASSERT(!Curl_bufq_is_empty(&ctx->buf));
+ *peos = FALSE;
+ result = Curl_bufq_cread(&ctx->buf, buf, blen, pnread);
+ if(!result && ctx->read_eos && Curl_bufq_is_empty(&ctx->buf)) {
+ /* no more data, read all, done. */
+ ctx->eos = TRUE;
+ *peos = TRUE;
+ }
+ return result;
+}
+
+static curl_off_t cr_lc_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ /* this reader changes length depending on input */
+ (void)data;
+ (void)reader;
+ return -1;
+}
+
+static const struct Curl_crtype cr_lc = {
+ "cr-lineconv",
+ cr_lc_init,
+ cr_lc_read,
+ cr_lc_close,
+ Curl_creader_def_needs_rewind,
+ cr_lc_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct cr_lc_ctx)
+};
+
+static CURLcode cr_lc_add(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result;
+
+ result = Curl_creader_create(&reader, data, &cr_lc,
+ CURL_CR_CONTENT_ENCODE);
+ if(!result)
+ result = Curl_creader_add(data, reader);
+
+ if(result && reader)
+ Curl_creader_free(data, reader);
+ return result;
+}
+
+static CURLcode do_init_reader_stack(struct Curl_easy *data,
+ struct Curl_creader *r)
+{
+ CURLcode result = CURLE_OK;
+ curl_off_t clen;
+
+ DEBUGASSERT(r);
+ DEBUGASSERT(r->crt);
+ DEBUGASSERT(r->phase == CURL_CR_CLIENT);
+ DEBUGASSERT(!data->req.reader_stack);
+
+ data->req.reader_stack = r;
+ clen = r->crt->total_length(data, r);
+ /* if we do not have 0 length init, and crlf conversion is wanted,
+ * add the reader for it */
+ if(clen && (data->set.crlf
+#ifdef CURL_DO_LINEEND_CONV
+ || data->state.prefer_ascii
+#endif
+ )) {
+ result = cr_lc_add(data);
+ if(result)
+ return result;
+ }
+
+ return result;
+}
+
+CURLcode Curl_creader_set_fread(struct Curl_easy *data, curl_off_t len)
+{
+ CURLcode result;
+ struct Curl_creader *r;
+ struct cr_in_ctx *ctx;
+
+ result = Curl_creader_create(&r, data, &cr_in, CURL_CR_CLIENT);
+ if(result)
+ return result;
+ ctx = r->ctx;
+ ctx->total_len = len;
+
+ cl_reset_reader(data);
+ return do_init_reader_stack(data, r);
+}
+
+CURLcode Curl_creader_add(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ CURLcode result;
+ struct Curl_creader **anchor = &data->req.reader_stack;
+
+ if(!*anchor) {
+ result = Curl_creader_set_fread(data, data->state.infilesize);
+ if(result)
+ return result;
+ }
+
+ /* Insert the writer as first in its phase.
+ * Skip existing readers of lower phases. */
+ while(*anchor && (*anchor)->phase < reader->phase)
+ anchor = &((*anchor)->next);
+ reader->next = *anchor;
+ *anchor = reader;
+ return CURLE_OK;
+}
+
+CURLcode Curl_creader_set(struct Curl_easy *data, struct Curl_creader *r)
+{
+ CURLcode result;
+
+ DEBUGASSERT(r);
+ DEBUGASSERT(r->crt);
+ DEBUGASSERT(r->phase == CURL_CR_CLIENT);
+
+ cl_reset_reader(data);
+ result = do_init_reader_stack(data, r);
+ if(result)
+ Curl_creader_free(data, r);
+ return result;
+}
+
+CURLcode Curl_client_read(struct Curl_easy *data, char *buf, size_t blen,
+ size_t *nread, bool *eos)
+{
+ CURLcode result;
+
+ DEBUGASSERT(buf);
+ DEBUGASSERT(blen);
+ DEBUGASSERT(nread);
+ DEBUGASSERT(eos);
+
+ if(!data->req.reader_stack) {
+ result = Curl_creader_set_fread(data, data->state.infilesize);
+ if(result)
+ return result;
+ DEBUGASSERT(data->req.reader_stack);
+ }
+
+ result = Curl_creader_read(data, data->req.reader_stack, buf, blen,
+ nread, eos);
+ return result;
+}
+
+bool Curl_creader_needs_rewind(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = data->req.reader_stack;
+ while(reader) {
+ if(reader->crt->needs_rewind(data, reader))
+ return TRUE;
+ reader = reader->next;
+ }
+ return FALSE;
+}
+
+static CURLcode cr_null_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ (void)data;
+ (void)reader;
+ (void)buf;
+ (void)blen;
+ *pnread = 0;
+ *peos = TRUE;
+ return CURLE_OK;
+}
+
+static curl_off_t cr_null_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ /* this reader changes length depending on input */
+ (void)data;
+ (void)reader;
+ return 0;
+}
+
+static const struct Curl_crtype cr_null = {
+ "cr-null",
+ Curl_creader_def_init,
+ cr_null_read,
+ Curl_creader_def_close,
+ Curl_creader_def_needs_rewind,
+ cr_null_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct Curl_creader)
+};
+
+CURLcode Curl_creader_set_null(struct Curl_easy *data)
+{
+ struct Curl_creader *r;
+ CURLcode result;
+
+ result = Curl_creader_create(&r, data, &cr_null, CURL_CR_CLIENT);
+ if(result)
+ return result;
+
+ cl_reset_reader(data);
+ return do_init_reader_stack(data, r);
+}
+
+struct cr_buf_ctx {
+ struct Curl_creader super;
+ const char *buf;
+ size_t blen;
+ size_t index;
+};
+
+static CURLcode cr_buf_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct cr_buf_ctx *ctx = reader->ctx;
+ size_t nread = ctx->blen - ctx->index;
+
+ (void)data;
+ if(!nread || !ctx->buf) {
+ *pnread = 0;
+ *peos = TRUE;
+ }
+ else {
+ if(nread > blen)
+ nread = blen;
+ memcpy(buf, ctx->buf + ctx->index, nread);
+ *pnread = nread;
+ ctx->index += nread;
+ *peos = (ctx->index == ctx->blen);
+ }
+ return CURLE_OK;
+}
+
+static bool cr_buf_needs_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_buf_ctx *ctx = reader->ctx;
+ (void)data;
+ return ctx->index > 0;
+}
+
+static curl_off_t cr_buf_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ struct cr_buf_ctx *ctx = reader->ctx;
+ (void)data;
+ return (curl_off_t)ctx->blen;
+}
+
+static CURLcode cr_buf_resume_from(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ curl_off_t offset)
+{
+ struct cr_buf_ctx *ctx = reader->ctx;
+ size_t boffset;
+
+ (void)data;
+ DEBUGASSERT(data->conn);
+ /* already started reading? */
+ if(ctx->index)
+ return CURLE_READ_ERROR;
+ if(offset <= 0)
+ return CURLE_OK;
+ boffset = (size_t)offset;
+ if(boffset > ctx->blen)
+ return CURLE_READ_ERROR;
+
+ ctx->buf += boffset;
+ ctx->blen -= boffset;
+ return CURLE_OK;
+}
+
+static const struct Curl_crtype cr_buf = {
+ "cr-buf",
+ Curl_creader_def_init,
+ cr_buf_read,
+ Curl_creader_def_close,
+ cr_buf_needs_rewind,
+ cr_buf_total_length,
+ cr_buf_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct cr_buf_ctx)
+};
+
+CURLcode Curl_creader_set_buf(struct Curl_easy *data,
+ const char *buf, size_t blen)
+{
+ CURLcode result;
+ struct Curl_creader *r;
+ struct cr_buf_ctx *ctx;
+
+ result = Curl_creader_create(&r, data, &cr_buf, CURL_CR_CLIENT);
+ if(result)
+ return result;
+ ctx = r->ctx;
+ ctx->buf = buf;
+ ctx->blen = blen;
+ ctx->index = 0;
+
+ cl_reset_reader(data);
+ return do_init_reader_stack(data, r);
+}
+
+curl_off_t Curl_creader_total_length(struct Curl_easy *data)
+{
+ struct Curl_creader *r = data->req.reader_stack;
+ return r? r->crt->total_length(data, r) : -1;
+}
+
+curl_off_t Curl_creader_client_length(struct Curl_easy *data)
+{
+ struct Curl_creader *r = data->req.reader_stack;
+ while(r && r->phase != CURL_CR_CLIENT)
+ r = r->next;
+ return r? r->crt->total_length(data, r) : -1;
+}
+
+CURLcode Curl_creader_resume_from(struct Curl_easy *data, curl_off_t offset)
+{
+ struct Curl_creader *r = data->req.reader_stack;
+ while(r && r->phase != CURL_CR_CLIENT)
+ r = r->next;
+ return r? r->crt->resume_from(data, r, offset) : CURLE_READ_ERROR;
+}
+
+CURLcode Curl_creader_unpause(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = data->req.reader_stack;
+ CURLcode result = CURLE_OK;
+
+ while(reader) {
+ result = reader->crt->unpause(data, reader);
+ if(result)
+ break;
+ reader = reader->next;
+ }
return result;
}
+
+void Curl_creader_done(struct Curl_easy *data, int premature)
+{
+ struct Curl_creader *reader = data->req.reader_stack;
+ while(reader) {
+ reader->crt->done(data, reader, premature);
+ reader = reader->next;
+ }
+}
+
+struct Curl_creader *Curl_creader_get_by_type(struct Curl_easy *data,
+ const struct Curl_crtype *crt)
+{
+ struct Curl_creader *r;
+ for(r = data->req.reader_stack; r; r = r->next) {
+ if(r->crt == crt)
+ return r;
+ }
+ return NULL;
+
+}
diff --git a/Utilities/cmcurl/lib/sendf.h b/Utilities/cmcurl/lib/sendf.h
index 7deae2a..d736ce4 100644
--- a/Utilities/cmcurl/lib/sendf.h
+++ b/Utilities/cmcurl/lib/sendf.h
@@ -55,20 +55,25 @@
* Write `len` bytes at `prt` to the client. `type` indicates what
* kind of data is being written.
*/
-CURLcode Curl_client_write(struct Curl_easy *data, int type, char *ptr,
+CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *ptr,
size_t len) WARN_UNUSED_RESULT;
/**
- * For a paused transfer, there might be buffered data held back.
- * Attempt to flush this data to the client. This *may* trigger
- * another pause of the transfer.
+ * Free all resources related to client writing.
*/
-CURLcode Curl_client_unpause(struct Curl_easy *data);
+void Curl_client_cleanup(struct Curl_easy *data);
/**
- * Free all resources related to client writing.
+ * Reset readers and writer chains, keep rewind information
+ * when necessary.
*/
-void Curl_client_cleanup(struct Curl_easy *data);
+void Curl_client_reset(struct Curl_easy *data);
+
+/**
+ * A new request is starting, perform any ops like rewinding
+ * previous readers when needed.
+ */
+CURLcode Curl_client_start(struct Curl_easy *data);
/**
* Client Writers - a chain passing transfer BODY data to the client.
@@ -112,10 +117,16 @@ struct Curl_cwtype {
size_t cwriter_size; /* sizeof() allocated struct Curl_cwriter */
};
-/* Client writer instance */
+/* Client writer instance, allocated on creation.
+ * `void *ctx` is the pointer from the allocation of
+ * the `struct Curl_cwriter` itself. This is suitable for "downcasting"
+ * by the writers implementation. See https://github.com/curl/curl/pull/13054
+ * for the alignment problems that arise otherwise.
+ */
struct Curl_cwriter {
const struct Curl_cwtype *cwt; /* type implementation */
struct Curl_cwriter *next; /* Downstream writer. */
+ void *ctx; /* allocated instance pointer */
Curl_cwriter_phase phase; /* phase at which it operates */
};
@@ -148,9 +159,19 @@ size_t Curl_cwriter_count(struct Curl_easy *data, Curl_cwriter_phase phase);
CURLcode Curl_cwriter_add(struct Curl_easy *data,
struct Curl_cwriter *writer);
+/**
+ * Look up an installed client writer on `data` by its type.
+ * @return first writer with that type or NULL
+ */
+struct Curl_cwriter *Curl_cwriter_get_by_type(struct Curl_easy *data,
+ const struct Curl_cwtype *cwt);
+
void Curl_cwriter_remove_by_name(struct Curl_easy *data,
const char *name);
+struct Curl_cwriter *Curl_cwriter_get_by_name(struct Curl_easy *data,
+ const char *name);
+
/**
* Convenience method for calling `writer->do_write()` that
* checks for NULL writer.
@@ -172,22 +193,205 @@ void Curl_cwriter_def_close(struct Curl_easy *data,
struct Curl_cwriter *writer);
-/* internal read-function, does plain socket, SSL and krb4 */
-CURLcode Curl_read(struct Curl_easy *data, curl_socket_t sockfd,
- char *buf, size_t buffersize,
- ssize_t *n);
-/* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */
-CURLcode Curl_write(struct Curl_easy *data,
- curl_socket_t sockfd,
- const void *mem, size_t len,
- ssize_t *written);
+/* Client Reader Type, provides the implementation */
+struct Curl_crtype {
+ const char *name; /* writer name. */
+ CURLcode (*do_init)(struct Curl_easy *data, struct Curl_creader *reader);
+ CURLcode (*do_read)(struct Curl_easy *data, struct Curl_creader *reader,
+ char *buf, size_t blen, size_t *nread, bool *eos);
+ void (*do_close)(struct Curl_easy *data, struct Curl_creader *reader);
+ bool (*needs_rewind)(struct Curl_easy *data, struct Curl_creader *reader);
+ curl_off_t (*total_length)(struct Curl_easy *data,
+ struct Curl_creader *reader);
+ CURLcode (*resume_from)(struct Curl_easy *data,
+ struct Curl_creader *reader, curl_off_t offset);
+ CURLcode (*rewind)(struct Curl_easy *data, struct Curl_creader *reader);
+ CURLcode (*unpause)(struct Curl_easy *data, struct Curl_creader *reader);
+ void (*done)(struct Curl_easy *data,
+ struct Curl_creader *reader, int premature);
+ size_t creader_size; /* sizeof() allocated struct Curl_creader */
+};
+
+/* Phase a reader operates at. */
+typedef enum {
+ CURL_CR_NET, /* data send to the network (connection filters) */
+ CURL_CR_TRANSFER_ENCODE, /* add transfer-encodings */
+ CURL_CR_PROTOCOL, /* before transfer, but after content decoding */
+ CURL_CR_CONTENT_ENCODE, /* add content-encodings */
+ CURL_CR_CLIENT /* data read from client */
+} Curl_creader_phase;
+
+/* Client reader instance, allocated on creation.
+ * `void *ctx` is the pointer from the allocation of
+ * the `struct Curl_cwriter` itself. This is suitable for "downcasting"
+ * by the writers implementation. See https://github.com/curl/curl/pull/13054
+ * for the alignment problems that arise otherwise.
+ */
+struct Curl_creader {
+ const struct Curl_crtype *crt; /* type implementation */
+ struct Curl_creader *next; /* Downstream reader. */
+ void *ctx;
+ Curl_creader_phase phase; /* phase at which it operates */
+};
+
+/**
+ * Default implementations for do_init, do_write, do_close that
+ * do nothing and pass the data through.
+ */
+CURLcode Curl_creader_def_init(struct Curl_easy *data,
+ struct Curl_creader *reader);
+void Curl_creader_def_close(struct Curl_easy *data,
+ struct Curl_creader *reader);
+CURLcode Curl_creader_def_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *nread, bool *eos);
+bool Curl_creader_def_needs_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader);
+curl_off_t Curl_creader_def_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader);
+CURLcode Curl_creader_def_resume_from(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ curl_off_t offset);
+CURLcode Curl_creader_def_rewind(struct Curl_easy *data,
+ struct Curl_creader *reader);
+CURLcode Curl_creader_def_unpause(struct Curl_easy *data,
+ struct Curl_creader *reader);
+void Curl_creader_def_done(struct Curl_easy *data,
+ struct Curl_creader *reader, int premature);
+
+/**
+ * Convenience method for calling `reader->do_read()` that
+ * checks for NULL reader.
+ */
+CURLcode Curl_creader_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen, size_t *nread, bool *eos);
+
+/**
+ * Create a new creader instance with given type and phase. Is not
+ * inserted into the writer chain by this call.
+ * Invokes `reader->do_init()`.
+ */
+CURLcode Curl_creader_create(struct Curl_creader **preader,
+ struct Curl_easy *data,
+ const struct Curl_crtype *cr_handler,
+ Curl_creader_phase phase);
+
+/**
+ * Free a creader instance.
+ * Invokes `reader->do_close()`.
+ */
+void Curl_creader_free(struct Curl_easy *data, struct Curl_creader *reader);
+
+/**
+ * Adds a reader to the transfer's reader chain.
+ * The readers `phase` determines where in the chain it is inserted.
+ */
+CURLcode Curl_creader_add(struct Curl_easy *data,
+ struct Curl_creader *reader);
+
+/**
+ * Set the given reader, which needs to be of type CURL_CR_CLIENT,
+ * as the new first reader. Discard any installed readers and init
+ * the reader chain anew.
+ * The function takes ownership of `r`.
+ */
+CURLcode Curl_creader_set(struct Curl_easy *data, struct Curl_creader *r);
+
+/**
+ * Read at most `blen` bytes at `buf` from the client.
+ * @param date the transfer to read client bytes for
+ * @param buf the memory location to read to
+ * @param blen the amount of memory at `buf`
+ * @param nread on return the number of bytes read into `buf`
+ * @param eos TRUE iff bytes are the end of data from client
+ * @return CURLE_OK on successful read (even 0 length) or error
+ */
+CURLcode Curl_client_read(struct Curl_easy *data, char *buf, size_t blen,
+ size_t *nread, bool *eos) WARN_UNUSED_RESULT;
+
+/**
+ * TRUE iff client reader needs rewing before it can be used for
+ * a retry request.
+ */
+bool Curl_creader_needs_rewind(struct Curl_easy *data);
+
+/**
+ * TRUE iff client reader will rewind at next start
+ */
+bool Curl_creader_will_rewind(struct Curl_easy *data);
+
+/**
+ * En-/disable rewind of client reader at next start.
+ */
+void Curl_creader_set_rewind(struct Curl_easy *data, bool enable);
+
+/**
+ * Get the total length of bytes provided by the installed readers.
+ * This is independent of the amount already delivered and is calculated
+ * by all readers in the stack. If a reader like "chunked" or
+ * "crlf conversion" is installed, the returned length will be -1.
+ * @return -1 if length is indeterminate
+ */
+curl_off_t Curl_creader_total_length(struct Curl_easy *data);
+
+/**
+ * Get the total length of bytes provided by the reader at phase
+ * CURL_CR_CLIENT. This may not match the amount of bytes read
+ * for a request, depending if other, encoding readers are also installed.
+ * However it allows for rough estimation of the overall length.
+ * @return -1 if length is indeterminate
+ */
+curl_off_t Curl_creader_client_length(struct Curl_easy *data);
+
+/**
+ * Ask the installed reader at phase CURL_CR_CLIENT to start
+ * reading from the given offset. On success, this will reduce
+ * the `total_length()` by the amount.
+ * @param date the transfer to read client bytes for
+ * param offset the offset where to start reads from, negative
+ * values will be ignored.
+ * @return CURLE_OK if offset could be set
+ * CURLE_READ_ERROR if not supported by reader or seek/read failed
+ * of offset larger then total length
+ * CURLE_PARTIAL_FILE if offset led to 0 total length
+ */
+CURLcode Curl_creader_resume_from(struct Curl_easy *data, curl_off_t offset);
+
+/**
+ * Unpause all installed readers.
+ */
+CURLcode Curl_creader_unpause(struct Curl_easy *data);
+
+/**
+ * Tell all client readers that they are done.
+ */
+void Curl_creader_done(struct Curl_easy *data, int premature);
+
+/**
+ * Look up an installed client reader on `data` by its type.
+ * @return first reader with that type or NULL
+ */
+struct Curl_creader *Curl_creader_get_by_type(struct Curl_easy *data,
+ const struct Curl_crtype *crt);
+
+
+/**
+ * Set the client reader to provide 0 bytes, immediate EOS.
+ */
+CURLcode Curl_creader_set_null(struct Curl_easy *data);
+
+/**
+ * Set the client reader the reads from fread callback.
+ */
+CURLcode Curl_creader_set_fread(struct Curl_easy *data, curl_off_t len);
-/* internal write-function, using sockindex for connection destination */
-CURLcode Curl_nwrite(struct Curl_easy *data,
- int sockindex,
- const void *buf,
- size_t blen,
- ssize_t *pnwritten);
+/**
+ * Set the client reader the reads from the supplied buf (NOT COPIED).
+ */
+CURLcode Curl_creader_set_buf(struct Curl_easy *data,
+ const char *buf, size_t blen);
#endif /* HEADER_CURL_SENDF_H */
diff --git a/Utilities/cmcurl/lib/setopt.c b/Utilities/cmcurl/lib/setopt.c
index a527077..8a5a5d7 100644
--- a/Utilities/cmcurl/lib/setopt.c
+++ b/Utilities/cmcurl/lib/setopt.c
@@ -155,6 +155,12 @@ static CURLcode setstropt_userpwd(char *option, char **userp, char **passwdp)
static CURLcode protocol2num(const char *str, curl_prot_t *val)
{
+ /*
+ * We are asked to cherry-pick protocols, so play it safe and disallow all
+ * protocols to start with, and re-add the wanted ones back in.
+ */
+ *val = 0;
+
if(!str)
return CURLE_BAD_FUNCTION_ARGUMENT;
@@ -163,8 +169,6 @@ static CURLcode protocol2num(const char *str, curl_prot_t *val)
return CURLE_OK;
}
- *val = 0;
-
do {
const char *token = str;
size_t tlen;
@@ -2210,9 +2214,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
* The application kindly asks for a differently sized receive buffer.
* If it seems reasonable, we'll use it.
*/
- if(data->state.buffer)
- return CURLE_BAD_FUNCTION_ARGUMENT;
-
arg = va_arg(param, long);
if(arg > READBUFFER_MAX)
@@ -2238,7 +2239,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
arg = UPLOADBUFFER_MIN;
data->set.upload_buffer_size = (unsigned int)arg;
- Curl_safefree(data->state.ulbuf); /* force a realloc next opportunity */
break;
case CURLOPT_NOSIGNAL:
@@ -2657,22 +2657,18 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
break;
case CURLOPT_PROTOCOLS_STR: {
- curl_prot_t prot;
argptr = va_arg(param, char *);
- result = protocol2num(argptr, &prot);
+ result = protocol2num(argptr, &data->set.allowed_protocols);
if(result)
return result;
- data->set.allowed_protocols = prot;
break;
}
case CURLOPT_REDIR_PROTOCOLS_STR: {
- curl_prot_t prot;
argptr = va_arg(param, char *);
- result = protocol2num(argptr, &prot);
+ result = protocol2num(argptr, &data->set.redir_protocols);
if(result)
return result;
- data->set.redir_protocols = prot;
break;
}
@@ -2867,13 +2863,13 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
#endif
case CURLOPT_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
- if(argptr && !strncasecompare(argptr, "SRP", strlen("SRP")))
+ if(argptr && !strcasecompare(argptr, "SRP"))
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
#ifndef CURL_DISABLE_PROXY
case CURLOPT_PROXY_TLSAUTH_TYPE:
argptr = va_arg(param, char *);
- if(argptr || !strncasecompare(argptr, "SRP", strlen("SRP")))
+ if(argptr && !strcasecompare(argptr, "SRP"))
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
#endif
diff --git a/Utilities/cmcurl/lib/smb.c b/Utilities/cmcurl/lib/smb.c
index 1d1867c..77d34e3 100644
--- a/Utilities/cmcurl/lib/smb.c
+++ b/Utilities/cmcurl/lib/smb.c
@@ -456,6 +456,9 @@ static CURLcode smb_connect(struct Curl_easy *data, bool *done)
smbc->recv_buf = malloc(MAX_MESSAGE_SIZE);
if(!smbc->recv_buf)
return CURLE_OUT_OF_MEMORY;
+ smbc->send_buf = malloc(MAX_MESSAGE_SIZE);
+ if(!smbc->send_buf)
+ return CURLE_OUT_OF_MEMORY;
/* Multiple requests are allowed with this connection */
connkeep(conn, "SMB default");
@@ -485,7 +488,6 @@ static CURLcode smb_connect(struct Curl_easy *data, bool *done)
static CURLcode smb_recv_message(struct Curl_easy *data, void **msg)
{
struct connectdata *conn = data->conn;
- curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
struct smb_conn *smbc = &conn->proto.smbc;
char *buf = smbc->recv_buf;
ssize_t bytes_read;
@@ -494,7 +496,7 @@ static CURLcode smb_recv_message(struct Curl_easy *data, void **msg)
size_t len = MAX_MESSAGE_SIZE - smbc->got;
CURLcode result;
- result = Curl_read(data, sockfd, buf + smbc->got, len, &bytes_read);
+ result = Curl_xfer_recv(data, buf + smbc->got, len, &bytes_read);
if(result)
return result;
@@ -560,16 +562,15 @@ static void smb_format_message(struct Curl_easy *data, struct smb_header *h,
h->pid = smb_swap16((unsigned short) pid);
}
-static CURLcode smb_send(struct Curl_easy *data, ssize_t len,
+static CURLcode smb_send(struct Curl_easy *data, size_t len,
size_t upload_size)
{
struct connectdata *conn = data->conn;
struct smb_conn *smbc = &conn->proto.smbc;
- ssize_t bytes_written;
+ size_t bytes_written;
CURLcode result;
- result = Curl_nwrite(data, FIRSTSOCKET, data->state.ulbuf,
- len, &bytes_written);
+ result = Curl_xfer_send(data, smbc->send_buf, len, &bytes_written);
if(result)
return result;
@@ -587,16 +588,15 @@ static CURLcode smb_flush(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
struct smb_conn *smbc = &conn->proto.smbc;
- ssize_t bytes_written;
- ssize_t len = smbc->send_size - smbc->sent;
+ size_t bytes_written;
+ size_t len = smbc->send_size - smbc->sent;
CURLcode result;
if(!smbc->send_size)
return CURLE_OK;
- result = Curl_nwrite(data, FIRSTSOCKET,
- data->state.ulbuf + smbc->sent,
- len, &bytes_written);
+ result = Curl_xfer_send(data, smbc->send_buf + smbc->sent, len,
+ &bytes_written);
if(result)
return result;
@@ -611,13 +611,13 @@ static CURLcode smb_flush(struct Curl_easy *data)
static CURLcode smb_send_message(struct Curl_easy *data, unsigned char cmd,
const void *msg, size_t msg_len)
{
- CURLcode result = Curl_get_upload_buffer(data);
- if(result)
- return result;
- smb_format_message(data, (struct smb_header *)data->state.ulbuf,
+ struct connectdata *conn = data->conn;
+ struct smb_conn *smbc = &conn->proto.smbc;
+
+ smb_format_message(data, (struct smb_header *)smbc->send_buf,
cmd, msg_len);
- memcpy(data->state.ulbuf + sizeof(struct smb_header),
- msg, msg_len);
+ DEBUGASSERT((sizeof(struct smb_header) + msg_len) <= MAX_MESSAGE_SIZE);
+ memcpy(smbc->send_buf + sizeof(struct smb_header), msg, msg_len);
return smb_send(data, sizeof(struct smb_header) + msg_len, 0);
}
@@ -775,15 +775,14 @@ static CURLcode smb_send_read(struct Curl_easy *data)
static CURLcode smb_send_write(struct Curl_easy *data)
{
+ struct connectdata *conn = data->conn;
+ struct smb_conn *smbc = &conn->proto.smbc;
struct smb_write *msg;
struct smb_request *req = data->req.p.smb;
curl_off_t offset = data->req.offset;
curl_off_t upload_size = data->req.size - data->req.bytecount;
- CURLcode result = Curl_get_upload_buffer(data);
- if(result)
- return result;
- msg = (struct smb_write *)data->state.ulbuf;
+ msg = (struct smb_write *)smbc->send_buf;
if(upload_size >= MAX_PAYLOAD_SIZE - 1) /* There is one byte of padding */
upload_size = MAX_PAYLOAD_SIZE - 1;
@@ -812,10 +811,11 @@ static CURLcode smb_send_and_recv(struct Curl_easy *data, void **msg)
/* Check if there is data in the transfer buffer */
if(!smbc->send_size && smbc->upload_size) {
- size_t nread = smbc->upload_size > (size_t)data->set.upload_buffer_size ?
- (size_t)data->set.upload_buffer_size : smbc->upload_size;
- data->req.upload_fromhere = data->state.ulbuf;
- result = Curl_fillreadbuffer(data, nread, &nread);
+ size_t nread = smbc->upload_size > (size_t)MAX_MESSAGE_SIZE ?
+ (size_t)MAX_MESSAGE_SIZE : smbc->upload_size;
+ bool eos;
+
+ result = Curl_client_read(data, smbc->send_buf, nread, &nread, &eos);
if(result && result != CURLE_AGAIN)
return result;
if(!nread)
@@ -1133,6 +1133,7 @@ static CURLcode smb_disconnect(struct Curl_easy *data,
Curl_safefree(smbc->share);
Curl_safefree(smbc->domain);
Curl_safefree(smbc->recv_buf);
+ Curl_safefree(smbc->send_buf);
return CURLE_OK;
}
diff --git a/Utilities/cmcurl/lib/smb.h b/Utilities/cmcurl/lib/smb.h
index 437f4a5..9ea2a8c 100644
--- a/Utilities/cmcurl/lib/smb.h
+++ b/Utilities/cmcurl/lib/smb.h
@@ -42,6 +42,7 @@ struct smb_conn {
unsigned int session_key;
unsigned short uid;
char *recv_buf;
+ char *send_buf;
size_t upload_size;
size_t send_size;
size_t sent;
diff --git a/Utilities/cmcurl/lib/smtp.c b/Utilities/cmcurl/lib/smtp.c
index bfe7b8f..20763c0 100644
--- a/Utilities/cmcurl/lib/smtp.c
+++ b/Utilities/cmcurl/lib/smtp.c
@@ -111,6 +111,7 @@ static CURLcode smtp_continue_auth(struct Curl_easy *data, const char *mech,
const struct bufref *resp);
static CURLcode smtp_cancel_auth(struct Curl_easy *data, const char *mech);
static CURLcode smtp_get_message(struct Curl_easy *data, struct bufref *out);
+static CURLcode cr_eob_add(struct Curl_easy *data);
/*
* SMTP protocol handler.
@@ -618,7 +619,7 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
result = smtp_parse_address(data->set.str[STRING_MAIL_FROM],
&address, &host);
if(result)
- return result;
+ goto out;
/* Establish whether we should report SMTPUTF8 to the server for this
mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
@@ -642,8 +643,10 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
/* Null reverse-path, RFC-5321, sect. 3.6.3 */
from = strdup("<>");
- if(!from)
- return CURLE_OUT_OF_MEMORY;
+ if(!from) {
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
+ }
/* Calculate the optional AUTH parameter */
if(data->set.str[STRING_MAIL_AUTH] && conn->proto.smtpc.sasl.authused) {
@@ -655,10 +658,8 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
converting the host name to an IDN A-label if necessary */
result = smtp_parse_address(data->set.str[STRING_MAIL_AUTH],
&address, &host);
- if(result) {
- free(from);
- return result;
- }
+ if(result)
+ goto out;
/* Establish whether we should report SMTPUTF8 to the server for this
mailbox as per RFC-6531 sect. 3.1 point 4 and sect. 3.4 */
@@ -676,7 +677,6 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
/* An invalid mailbox was provided but we'll simply let the server
worry about it */
auth = aprintf("<%s>", address);
-
free(address);
}
else
@@ -684,12 +684,12 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
auth = strdup("<>");
if(!auth) {
- free(from);
-
- return CURLE_OUT_OF_MEMORY;
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
}
}
+#ifndef CURL_DISABLE_MIME
/* Prepare the mime data if some. */
if(data->set.mimepost.kind != MIMEKIND_NONE) {
/* Use the whole structure as data. */
@@ -705,22 +705,18 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
result = Curl_mime_add_header(&data->set.mimepost.curlheaders,
"Mime-Version: 1.0");
- /* Make sure we will read the entire mime structure. */
if(!result)
- result = Curl_mime_rewind(&data->set.mimepost);
-
- if(result) {
- free(from);
- free(auth);
-
- return result;
- }
-
- data->state.infilesize = Curl_mime_size(&data->set.mimepost);
-
- /* Read from mime structure. */
- data->state.fread_func = (curl_read_callback) Curl_mime_read;
- data->state.in = (void *) &data->set.mimepost;
+ result = Curl_creader_set_mime(data, &data->set.mimepost);
+ if(result)
+ goto out;
+ data->state.infilesize = Curl_creader_total_length(data);
+ }
+ else
+#endif
+ {
+ result = Curl_creader_set_fread(data, data->state.infilesize);
+ if(result)
+ goto out;
}
/* Calculate the optional SIZE parameter */
@@ -728,10 +724,8 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
size = aprintf("%" CURL_FORMAT_CURL_OFF_T, data->state.infilesize);
if(!size) {
- free(from);
- free(auth);
-
- return CURLE_OUT_OF_MEMORY;
+ result = CURLE_OUT_OF_MEMORY;
+ goto out;
}
}
@@ -752,6 +746,11 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
}
}
+ /* Add the client reader doing STMP EOB escaping */
+ result = cr_eob_add(data);
+ if(result)
+ goto out;
+
/* Send the MAIL command */
result = Curl_pp_sendf(data, &conn->proto.smtpc.pp,
"MAIL FROM:%s%s%s%s%s%s",
@@ -763,6 +762,7 @@ static CURLcode smtp_perform_mail(struct Curl_easy *data)
utf8 ? " SMTPUTF8" /* Internationalised mailbox */
: ""); /* included in our envelope */
+out:
free(from);
free(auth);
free(size);
@@ -1162,7 +1162,7 @@ static CURLcode smtp_state_data_resp(struct Curl_easy *data, int smtpcode,
Curl_pgrsSetUploadSize(data, data->state.infilesize);
/* SMTP upload */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
/* End of DO phase */
smtp_state(data, SMTP_STOP);
@@ -1194,7 +1194,6 @@ static CURLcode smtp_statemachine(struct Curl_easy *data,
struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- curl_socket_t sock = conn->sock[FIRSTSOCKET];
int smtpcode;
struct smtp_conn *smtpc = &conn->proto.smtpc;
struct pingpong *pp = &smtpc->pp;
@@ -1210,7 +1209,7 @@ static CURLcode smtp_statemachine(struct Curl_easy *data,
do {
/* Read the response from the server */
- result = Curl_pp_readresp(data, sock, pp, &smtpcode, &nread);
+ result = Curl_pp_readresp(data, FIRSTSOCKET, pp, &smtpcode, &nread);
if(result)
return result;
@@ -1392,10 +1391,6 @@ static CURLcode smtp_done(struct Curl_easy *data, CURLcode status,
CURLcode result = CURLE_OK;
struct connectdata *conn = data->conn;
struct SMTP *smtp = data->req.p.smtp;
- struct pingpong *pp = &conn->proto.smtpc.pp;
- char *eob;
- ssize_t len;
- ssize_t bytes_written;
(void)premature;
@@ -1410,47 +1405,7 @@ static CURLcode smtp_done(struct Curl_easy *data, CURLcode status,
result = status; /* use the already set error code */
}
else if(!data->set.connect_only && data->set.mail_rcpt &&
- (data->state.upload || data->set.mimepost.kind)) {
- /* Calculate the EOB taking into account any terminating CRLF from the
- previous line of the email or the CRLF of the DATA command when there
- is "no mail data". RFC-5321, sect. 4.1.1.4.
-
- Note: As some SSL backends, such as OpenSSL, will cause Curl_write() to
- fail when using a different pointer following a previous write, that
- returned CURLE_AGAIN, we duplicate the EOB now rather than when the
- bytes written doesn't equal len. */
- if(smtp->trailing_crlf || !data->state.infilesize) {
- eob = strdup(&SMTP_EOB[2]);
- len = SMTP_EOB_LEN - 2;
- }
- else {
- eob = strdup(SMTP_EOB);
- len = SMTP_EOB_LEN;
- }
-
- if(!eob)
- return CURLE_OUT_OF_MEMORY;
-
- /* Send the end of block data */
- result = Curl_write(data, conn->writesockfd, eob, len, &bytes_written);
- if(result) {
- free(eob);
- return result;
- }
-
- if(bytes_written != len) {
- /* The whole chunk was not sent so keep it around and adjust the
- pingpong structure accordingly */
- pp->sendthis = eob;
- pp->sendsize = len;
- pp->sendleft = len - bytes_written;
- }
- else {
- /* Successfully sent so adjust the response timeout relative to now */
- pp->response = Curl_now();
-
- free(eob);
- }
+ (data->state.upload || IS_MIME_POST(data))) {
smtp_state(data, SMTP_POSTDATA);
@@ -1502,7 +1457,7 @@ static CURLcode smtp_perform(struct Curl_easy *data, bool *connected,
smtp->eob = 2;
/* Start the first command in the DO phase */
- if((data->state.upload || data->set.mimepost.kind) && data->set.mail_rcpt)
+ if((data->state.upload || IS_MIME_POST(data)) && data->set.mail_rcpt)
/* MAIL transfer */
result = smtp_perform_mail(data);
else
@@ -1593,7 +1548,7 @@ static CURLcode smtp_dophase_done(struct Curl_easy *data, bool connected)
if(smtp->transfer != PPTRANSFER_BODY)
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
return CURLE_OK;
}
@@ -1818,108 +1773,173 @@ static CURLcode smtp_parse_address(const char *fqma, char **address,
return result;
}
-CURLcode Curl_smtp_escape_eob(struct Curl_easy *data,
- const ssize_t nread,
- const ssize_t offset)
+struct cr_eob_ctx {
+ struct Curl_creader super;
+ struct bufq buf;
+ size_t n_eob; /* how many EOB bytes we matched so far */
+ size_t eob; /* Number of bytes of the EOB (End Of Body) that
+ have been received so far */
+ BIT(read_eos); /* we read an EOS from the next reader */
+ BIT(eos); /* we have returned an EOS */
+};
+
+static CURLcode cr_eob_init(struct Curl_easy *data,
+ struct Curl_creader *reader)
{
- /* When sending a SMTP payload we must detect CRLF. sequences making sure
- they are sent as CRLF.. instead, as a . on the beginning of a line will
- be deleted by the server when not part of an EOB terminator and a
- genuine CRLF.CRLF which isn't escaped will wrongly be detected as end of
- data by the server
- */
- ssize_t i;
- ssize_t si;
- struct SMTP *smtp = data->req.p.smtp;
- char *scratch = data->state.scratch;
- char *newscratch = NULL;
- char *oldscratch = NULL;
- size_t eob_sent;
+ struct cr_eob_ctx *ctx = reader->ctx;
+ (void)data;
+ /* The first char we read is the first on a line, as if we had
+ * read CRLF just before */
+ ctx->n_eob = 2;
+ Curl_bufq_init2(&ctx->buf, (16 * 1024), 1, BUFQ_OPT_SOFT_LIMIT);
+ return CURLE_OK;
+}
- /* Do we need to allocate a scratch buffer? */
- if(!scratch || data->set.crlf) {
- oldscratch = scratch;
+static void cr_eob_close(struct Curl_easy *data, struct Curl_creader *reader)
+{
+ struct cr_eob_ctx *ctx = reader->ctx;
+ (void)data;
+ Curl_bufq_free(&ctx->buf);
+}
- scratch = newscratch = malloc(2 * data->set.upload_buffer_size);
- if(!newscratch) {
- failf(data, "Failed to alloc scratch buffer");
+/* this is the 5-bytes End-Of-Body marker for SMTP */
+#define SMTP_EOB "\r\n.\r\n"
+#define SMTP_EOB_FIND_LEN 3
- return CURLE_OUT_OF_MEMORY;
- }
- }
- DEBUGASSERT((size_t)data->set.upload_buffer_size >= (size_t)nread);
-
- /* Have we already sent part of the EOB? */
- eob_sent = smtp->eob;
-
- /* This loop can be improved by some kind of Boyer-Moore style of
- approach but that is saved for later... */
- if(offset)
- memcpy(scratch, data->req.upload_fromhere, offset);
- for(i = offset, si = offset; i < nread; i++) {
- if(SMTP_EOB[smtp->eob] == data->req.upload_fromhere[i]) {
- smtp->eob++;
-
- /* Is the EOB potentially the terminating CRLF? */
- if(2 == smtp->eob || SMTP_EOB_LEN == smtp->eob)
- smtp->trailing_crlf = TRUE;
- else
- smtp->trailing_crlf = FALSE;
- }
- else if(smtp->eob) {
- /* A previous substring matched so output that first */
- memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);
- si += smtp->eob - eob_sent;
-
- /* Then compare the first byte */
- if(SMTP_EOB[0] == data->req.upload_fromhere[i])
- smtp->eob = 1;
- else
- smtp->eob = 0;
+/* client reader doing SMTP End-Of-Body escaping. */
+static CURLcode cr_eob_read(struct Curl_easy *data,
+ struct Curl_creader *reader,
+ char *buf, size_t blen,
+ size_t *pnread, bool *peos)
+{
+ struct cr_eob_ctx *ctx = reader->ctx;
+ CURLcode result = CURLE_OK;
+ size_t nread, i, start, n;
+ bool eos;
+
+ if(!ctx->read_eos && Curl_bufq_is_empty(&ctx->buf)) {
+ /* Get more and convert it when needed */
+ result = Curl_creader_read(data, reader->next, buf, blen, &nread, &eos);
+ if(result)
+ return result;
- eob_sent = 0;
+ ctx->read_eos = eos;
+ if(nread) {
+ if(!ctx->n_eob && !memchr(buf, SMTP_EOB[0], nread)) {
+ /* not in the middle of a match, no EOB start found, just pass */
+ *pnread = nread;
+ *peos = FALSE;
+ return CURLE_OK;
+ }
+ /* scan for EOB (continuation) and convert */
+ for(i = start = 0; i < nread; ++i) {
+ if(ctx->n_eob >= SMTP_EOB_FIND_LEN) {
+ /* matched the EOB prefix and seeing additional char, add '.' */
+ result = Curl_bufq_cwrite(&ctx->buf, buf + start, i - start, &n);
+ if(result)
+ return result;
+ result = Curl_bufq_cwrite(&ctx->buf, ".", 1, &n);
+ if(result)
+ return result;
+ ctx->n_eob = 0;
+ start = i;
+ if(data->state.infilesize > 0)
+ data->state.infilesize++;
+ }
- /* Reset the trailing CRLF flag as there was more data */
- smtp->trailing_crlf = FALSE;
+ if(buf[i] != SMTP_EOB[ctx->n_eob])
+ ctx->n_eob = 0;
+
+ if(buf[i] == SMTP_EOB[ctx->n_eob]) {
+ /* matching another char of the EOB */
+ ++ctx->n_eob;
+ }
+ }
+
+ /* add any remainder to buf */
+ if(start < nread) {
+ result = Curl_bufq_cwrite(&ctx->buf, buf + start, nread - start, &n);
+ if(result)
+ return result;
+ }
}
- /* Do we have a match for CRLF. as per RFC-5321, sect. 4.5.2 */
- if(SMTP_EOB_FIND_LEN == smtp->eob) {
- /* Copy the replacement data to the target buffer */
- memcpy(&scratch[si], &SMTP_EOB_REPL[eob_sent],
- SMTP_EOB_REPL_LEN - eob_sent);
- si += SMTP_EOB_REPL_LEN - eob_sent;
- smtp->eob = 0;
- eob_sent = 0;
+ if(ctx->read_eos) {
+ /* if we last matched a CRLF or if the data was empty, add ".\r\n"
+ * to end the body. If we sent something and it did not end with "\r\n",
+ * add "\r\n.\r\n" to end the body */
+ const char *eob = SMTP_EOB;
+ switch(ctx->n_eob) {
+ case 2:
+ /* seen a CRLF at the end, just add the remainder */
+ eob = &SMTP_EOB[2];
+ break;
+ case 3:
+ /* ended with '\r\n.', we should escpe the last '.' */
+ eob = "." SMTP_EOB;
+ break;
+ default:
+ break;
+ }
+ result = Curl_bufq_cwrite(&ctx->buf, eob, strlen(eob), &n);
+ if(result)
+ return result;
}
- else if(!smtp->eob)
- scratch[si++] = data->req.upload_fromhere[i];
}
- if(smtp->eob - eob_sent) {
- /* A substring matched before processing ended so output that now */
- memcpy(&scratch[si], &SMTP_EOB[eob_sent], smtp->eob - eob_sent);
- si += smtp->eob - eob_sent;
+ *peos = FALSE;
+ if(!Curl_bufq_is_empty(&ctx->buf)) {
+ result = Curl_bufq_cread(&ctx->buf, buf, blen, pnread);
}
+ else
+ *pnread = 0;
+
+ if(ctx->read_eos && Curl_bufq_is_empty(&ctx->buf)) {
+ /* no more data, read all, done. */
+ ctx->eos = TRUE;
+ }
+ *peos = ctx->eos;
+ DEBUGF(infof(data, "cr_eob_read(%zu) -> %d, %zd, %d",
+ blen, result, *pnread, *peos));
+ return CURLE_OK;
+}
- /* Only use the new buffer if we replaced something */
- if(si != nread) {
- /* Upload from the new (replaced) buffer instead */
- data->req.upload_fromhere = scratch;
+static curl_off_t cr_eob_total_length(struct Curl_easy *data,
+ struct Curl_creader *reader)
+{
+ /* this reader changes length depending on input */
+ (void)data;
+ (void)reader;
+ return -1;
+}
- /* Save the buffer so it can be freed later */
- data->state.scratch = scratch;
+static const struct Curl_crtype cr_eob = {
+ "cr-smtp-eob",
+ cr_eob_init,
+ cr_eob_read,
+ cr_eob_close,
+ Curl_creader_def_needs_rewind,
+ cr_eob_total_length,
+ Curl_creader_def_resume_from,
+ Curl_creader_def_rewind,
+ Curl_creader_def_unpause,
+ Curl_creader_def_done,
+ sizeof(struct cr_eob_ctx)
+};
- /* Free the old scratch buffer */
- free(oldscratch);
+static CURLcode cr_eob_add(struct Curl_easy *data)
+{
+ struct Curl_creader *reader = NULL;
+ CURLcode result;
- /* Set the new amount too */
- data->req.upload_present = si;
- }
- else
- free(newscratch);
+ result = Curl_creader_create(&reader, data, &cr_eob,
+ CURL_CR_CONTENT_ENCODE);
+ if(!result)
+ result = Curl_creader_add(data, reader);
- return CURLE_OK;
+ if(result && reader)
+ Curl_creader_free(data, reader);
+ return result;
}
#endif /* CURL_DISABLE_SMTP */
diff --git a/Utilities/cmcurl/lib/smtp.h b/Utilities/cmcurl/lib/smtp.h
index 7a04c21..7c2af68 100644
--- a/Utilities/cmcurl/lib/smtp.h
+++ b/Utilities/cmcurl/lib/smtp.h
@@ -84,17 +84,4 @@ struct smtp_conn {
extern const struct Curl_handler Curl_handler_smtp;
extern const struct Curl_handler Curl_handler_smtps;
-/* this is the 5-bytes End-Of-Body marker for SMTP */
-#define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a"
-#define SMTP_EOB_LEN 5
-#define SMTP_EOB_FIND_LEN 3
-
-/* if found in data, replace it with this string instead */
-#define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e"
-#define SMTP_EOB_REPL_LEN 4
-
-CURLcode Curl_smtp_escape_eob(struct Curl_easy *data,
- const ssize_t nread,
- const ssize_t offset);
-
#endif /* HEADER_CURL_SMTP_H */
diff --git a/Utilities/cmcurl/lib/socks.c b/Utilities/cmcurl/lib/socks.c
index ecd2f7e..bd5962a 100644
--- a/Utilities/cmcurl/lib/socks.c
+++ b/Utilities/cmcurl/lib/socks.c
@@ -341,7 +341,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
case CONNECT_RESOLVING:
/* check if we have the name resolved by now */
- dns = Curl_fetch_addr(data, sx->hostname, (int)conn->port);
+ dns = Curl_fetch_addr(data, sx->hostname, conn->primary.remote_port);
if(dns) {
#ifdef CURLRES_ASYNCH
@@ -1175,7 +1175,7 @@ static CURLcode socks_proxy_cf_connect(struct Curl_cfilter *cf,
result = connect_SOCKS(cf, sx, data);
if(!result && sx->state == CONNECT_DONE) {
cf->connected = TRUE;
- Curl_verboseconnect(data, conn);
+ Curl_verboseconnect(data, conn, cf->sockindex);
socks_proxy_cf_free(cf);
}
diff --git a/Utilities/cmcurl/lib/socks_gssapi.c b/Utilities/cmcurl/lib/socks_gssapi.c
index 2437150..c0b42b8 100644
--- a/Utilities/cmcurl/lib/socks_gssapi.c
+++ b/Utilities/cmcurl/lib/socks_gssapi.c
@@ -475,7 +475,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
gss_recv_token.length, &actualread);
if(result || (actualread != us_length)) {
- failf(data, "Failed to receive GSS-API encryptrion type.");
+ failf(data, "Failed to receive GSS-API encryption type.");
gss_release_buffer(&gss_status, &gss_recv_token);
gss_delete_sec_context(&gss_status, &gss_context, NULL);
return CURLE_COULDNT_CONNECT;
diff --git a/Utilities/cmcurl/lib/strtoofft.c b/Utilities/cmcurl/lib/strtoofft.c
index 077b257..580fd23 100644
--- a/Utilities/cmcurl/lib/strtoofft.c
+++ b/Utilities/cmcurl/lib/strtoofft.c
@@ -79,11 +79,10 @@ static int get_char(char c, int base);
static curl_off_t strtooff(const char *nptr, char **endptr, int base)
{
char *end;
- int is_negative = 0;
- int overflow;
+ bool is_negative = FALSE;
+ bool overflow = FALSE;
int i;
curl_off_t value = 0;
- curl_off_t newval;
/* Skip leading whitespace. */
end = (char *)nptr;
@@ -93,7 +92,7 @@ static curl_off_t strtooff(const char *nptr, char **endptr, int base)
/* Handle the sign, if any. */
if(end[0] == '-') {
- is_negative = 1;
+ is_negative = TRUE;
end++;
}
else if(end[0] == '+') {
@@ -129,19 +128,15 @@ static curl_off_t strtooff(const char *nptr, char **endptr, int base)
}
/* Loop handling digits. */
- value = 0;
- overflow = 0;
for(i = get_char(end[0], base);
i != -1;
end++, i = get_char(end[0], base)) {
- newval = base * value + i;
- if(newval < value) {
- /* We've overflowed. */
- overflow = 1;
+
+ if(value > (CURL_OFF_T_MAX - i) / base) {
+ overflow = TRUE;
break;
}
- else
- value = newval;
+ value = base * value + i;
}
if(!overflow) {
@@ -217,7 +212,7 @@ static int get_char(char c, int base)
CURLofft curlx_strtoofft(const char *str, char **endp, int base,
curl_off_t *num)
{
- char *end;
+ char *end = NULL;
curl_off_t number;
errno = 0;
*num = 0; /* clear by default */
diff --git a/Utilities/cmcurl/lib/telnet.c b/Utilities/cmcurl/lib/telnet.c
index 34dc5e8..56ee085 100644
--- a/Utilities/cmcurl/lib/telnet.c
+++ b/Utilities/cmcurl/lib/telnet.c
@@ -1231,20 +1231,24 @@ process_iac:
static CURLcode send_telnet_data(struct Curl_easy *data,
char *buffer, ssize_t nread)
{
- ssize_t i, outlen;
+ size_t i, outlen;
unsigned char *outbuf;
CURLcode result = CURLE_OK;
- ssize_t bytes_written, total_written = 0;
+ size_t bytes_written;
+ size_t total_written = 0;
struct connectdata *conn = data->conn;
struct TELNET *tn = data->req.p.telnet;
DEBUGASSERT(tn);
+ DEBUGASSERT(nread > 0);
+ if(nread < 0)
+ return CURLE_TOO_LARGE;
if(memchr(buffer, CURL_IAC, nread)) {
/* only use the escape buffer when necessary */
Curl_dyn_reset(&tn->out);
- for(i = 0; i < nread && !result; i++) {
+ for(i = 0; i < (size_t)nread && !result; i++) {
result = Curl_dyn_addn(&tn->out, &buffer[i], 1);
if(!result && ((unsigned char)buffer[i] == CURL_IAC))
/* IAC is FF in hex */
@@ -1255,7 +1259,7 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
outbuf = Curl_dyn_uptr(&tn->out);
}
else {
- outlen = nread;
+ outlen = (size_t)nread;
outbuf = (unsigned char *)buffer;
}
while(!result && total_written < outlen) {
@@ -1270,8 +1274,8 @@ static CURLcode send_telnet_data(struct Curl_easy *data,
break;
default: /* write! */
bytes_written = 0;
- result = Curl_nwrite(data, FIRSTSOCKET, outbuf + total_written,
- outlen - total_written, &bytes_written);
+ result = Curl_xfer_send(data, outbuf + total_written,
+ outlen - total_written, &bytes_written);
total_written += bytes_written;
break;
}
@@ -1464,7 +1468,7 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
}
if(events.lNetworkEvents & FD_READ) {
/* read data from network */
- result = Curl_read(data, sockfd, buffer, sizeof(buffer), &nread);
+ result = Curl_xfer_recv(data, buffer, sizeof(buffer), &nread);
/* read would've blocked. Loop again */
if(result == CURLE_AGAIN)
break;
@@ -1545,7 +1549,7 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
default: /* read! */
if(pfd[0].revents & POLLIN) {
/* read data from network */
- result = Curl_read(data, sockfd, buffer, sizeof(buffer), &nread);
+ result = Curl_xfer_recv(data, buffer, sizeof(buffer), &nread);
/* read would've blocked. Loop again */
if(result == CURLE_AGAIN)
break;
@@ -1635,7 +1639,7 @@ static CURLcode telnet_do(struct Curl_easy *data, bool *done)
}
#endif
/* mark this as "no further transfer wanted" */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
return result;
}
diff --git a/Utilities/cmcurl/lib/tftp.c b/Utilities/cmcurl/lib/tftp.c
index 4288110..ff2b7b7 100644
--- a/Utilities/cmcurl/lib/tftp.c
+++ b/Utilities/cmcurl/lib/tftp.c
@@ -452,8 +452,6 @@ static CURLcode tftp_send_first(struct tftp_state_data *state,
if(data->state.upload) {
/* If we are uploading, send an WRQ */
setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
- state->data->req.upload_fromhere =
- (char *)state->spacket.data + 4;
if(data->state.infilesize != -1)
Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
@@ -708,6 +706,8 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
struct SingleRequest *k = &data->req;
size_t cb; /* Bytes currently read */
char buffer[STRERROR_LEN];
+ char *bufptr;
+ bool eos;
switch(event) {
@@ -771,13 +771,14 @@ static CURLcode tftp_tx(struct tftp_state_data *state, tftp_event_t event)
* data block.
* */
state->sbytes = 0;
- state->data->req.upload_fromhere = (char *)state->spacket.data + 4;
+ bufptr = (char *)state->spacket.data + 4;
do {
- result = Curl_fillreadbuffer(data, state->blksize - state->sbytes, &cb);
+ result = Curl_client_read(data, bufptr, state->blksize - state->sbytes,
+ &cb, &eos);
if(result)
return result;
state->sbytes += (int)cb;
- state->data->req.upload_fromhere += cb;
+ bufptr += cb;
} while(state->sbytes < state->blksize && cb);
sbytes = sendto(state->sockfd, (void *) state->spacket.data,
@@ -1240,7 +1241,7 @@ static CURLcode tftp_multi_statemach(struct Curl_easy *data, bool *done)
*done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
if(*done)
/* Tell curl we're done */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
}
else {
/* no timeouts to handle, check our socket */
@@ -1263,7 +1264,7 @@ static CURLcode tftp_multi_statemach(struct Curl_easy *data, bool *done)
*done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
if(*done)
/* Tell curl we're done */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
}
/* if rc == 0, then select() timed out */
}
diff --git a/Utilities/cmcurl/lib/transfer.c b/Utilities/cmcurl/lib/transfer.c
index 3ae4b61..e31d1d6 100644
--- a/Utilities/cmcurl/lib/transfer.c
+++ b/Utilities/cmcurl/lib/transfer.c
@@ -63,6 +63,7 @@
#include "content_encoding.h"
#include "hostip.h"
#include "cfilters.h"
+#include "cw-out.h"
#include "transfer.h"
#include "sendf.h"
#include "speedcheck.h"
@@ -114,260 +115,6 @@ char *Curl_checkheaders(const struct Curl_easy *data,
}
#endif
-CURLcode Curl_get_upload_buffer(struct Curl_easy *data)
-{
- if(!data->state.ulbuf) {
- data->state.ulbuf = malloc(data->set.upload_buffer_size);
- if(!data->state.ulbuf)
- return CURLE_OUT_OF_MEMORY;
- }
- return CURLE_OK;
-}
-
-#ifndef CURL_DISABLE_HTTP
-/*
- * This function will be called to loop through the trailers buffer
- * until no more data is available for sending.
- */
-static size_t trailers_read(char *buffer, size_t size, size_t nitems,
- void *raw)
-{
- struct Curl_easy *data = (struct Curl_easy *)raw;
- struct dynbuf *trailers_buf = &data->state.trailers_buf;
- size_t bytes_left = Curl_dyn_len(trailers_buf) -
- data->state.trailers_bytes_sent;
- size_t to_copy = (size*nitems < bytes_left) ? size*nitems : bytes_left;
- if(to_copy) {
- memcpy(buffer,
- Curl_dyn_ptr(trailers_buf) + data->state.trailers_bytes_sent,
- to_copy);
- data->state.trailers_bytes_sent += to_copy;
- }
- return to_copy;
-}
-
-static size_t trailers_left(void *raw)
-{
- struct Curl_easy *data = (struct Curl_easy *)raw;
- struct dynbuf *trailers_buf = &data->state.trailers_buf;
- return Curl_dyn_len(trailers_buf) - data->state.trailers_bytes_sent;
-}
-#endif
-
-/*
- * This function will call the read callback to fill our buffer with data
- * to upload.
- */
-CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
- size_t *nreadp)
-{
- size_t buffersize = bytes;
- size_t nread;
- curl_read_callback readfunc = NULL;
- void *extra_data = NULL;
- int eof_index = 0;
-
-#ifndef CURL_DISABLE_HTTP
- if(data->state.trailers_state == TRAILERS_INITIALIZED) {
- struct curl_slist *trailers = NULL;
- CURLcode result;
- int trailers_ret_code;
-
- /* at this point we already verified that the callback exists
- so we compile and store the trailers buffer, then proceed */
- infof(data,
- "Moving trailers state machine from initialized to sending.");
- data->state.trailers_state = TRAILERS_SENDING;
- Curl_dyn_init(&data->state.trailers_buf, DYN_TRAILERS);
-
- data->state.trailers_bytes_sent = 0;
- Curl_set_in_callback(data, true);
- trailers_ret_code = data->set.trailer_callback(&trailers,
- data->set.trailer_data);
- Curl_set_in_callback(data, false);
- if(trailers_ret_code == CURL_TRAILERFUNC_OK) {
- result = Curl_http_compile_trailers(trailers, &data->state.trailers_buf,
- data);
- }
- else {
- failf(data, "operation aborted by trailing headers callback");
- *nreadp = 0;
- result = CURLE_ABORTED_BY_CALLBACK;
- }
- if(result) {
- Curl_dyn_free(&data->state.trailers_buf);
- curl_slist_free_all(trailers);
- return result;
- }
- infof(data, "Successfully compiled trailers.");
- curl_slist_free_all(trailers);
- }
-#endif
-
-#ifndef CURL_DISABLE_HTTP
- /* if we are transmitting trailing data, we don't need to write
- a chunk size so we skip this */
- if(data->req.upload_chunky &&
- data->state.trailers_state == TRAILERS_NONE) {
- /* if chunked Transfer-Encoding */
- buffersize -= (8 + 2 + 2); /* 32bit hex + CRLF + CRLF */
- data->req.upload_fromhere += (8 + 2); /* 32bit hex + CRLF */
- }
-
- if(data->state.trailers_state == TRAILERS_SENDING) {
- /* if we're here then that means that we already sent the last empty chunk
- but we didn't send a final CR LF, so we sent 0 CR LF. We then start
- pulling trailing data until we have no more at which point we
- simply return to the previous point in the state machine as if
- nothing happened.
- */
- readfunc = trailers_read;
- extra_data = (void *)data;
- eof_index = 1;
- }
- else
-#endif
- {
- readfunc = data->state.fread_func;
- extra_data = data->state.in;
- }
-
- if(!data->req.fread_eof[eof_index]) {
- Curl_set_in_callback(data, true);
- nread = readfunc(data->req.upload_fromhere, 1, buffersize, extra_data);
- Curl_set_in_callback(data, false);
- /* make sure the callback is not called again after EOF */
- data->req.fread_eof[eof_index] = !nread;
- }
- else
- nread = 0;
-
- if(nread == CURL_READFUNC_ABORT) {
- failf(data, "operation aborted by callback");
- *nreadp = 0;
- return CURLE_ABORTED_BY_CALLBACK;
- }
- if(nread == CURL_READFUNC_PAUSE) {
- struct SingleRequest *k = &data->req;
-
- if(data->conn->handler->flags & PROTOPT_NONETWORK) {
- /* protocols that work without network cannot be paused. This is
- actually only FILE:// just now, and it can't pause since the transfer
- isn't done using the "normal" procedure. */
- failf(data, "Read callback asked for PAUSE when not supported");
- return CURLE_READ_ERROR;
- }
-
- /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
- k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
- if(data->req.upload_chunky) {
- /* Back out the preallocation done above */
- data->req.upload_fromhere -= (8 + 2);
- }
- *nreadp = 0;
-
- return CURLE_OK; /* nothing was read */
- }
- else if(nread > buffersize) {
- /* the read function returned a too large value */
- *nreadp = 0;
- failf(data, "read function returned funny value");
- return CURLE_READ_ERROR;
- }
-
-#ifndef CURL_DISABLE_HTTP
- if(!data->req.forbidchunk && data->req.upload_chunky) {
- /* if chunked Transfer-Encoding
- * build chunk:
- *
- * <HEX SIZE> CRLF
- * <DATA> CRLF
- */
- /* On non-ASCII platforms the <DATA> may or may not be
- translated based on state.prefer_ascii while the protocol
- portion must always be translated to the network encoding.
- To further complicate matters, line end conversion might be
- done later on, so we need to prevent CRLFs from becoming
- CRCRLFs if that's the case. To do this we use bare LFs
- here, knowing they'll become CRLFs later on.
- */
-
- bool added_crlf = FALSE;
- int hexlen = 0;
- const char *endofline_native;
- const char *endofline_network;
-
- if(
-#ifdef CURL_DO_LINEEND_CONV
- (data->state.prefer_ascii) ||
-#endif
- (data->set.crlf)) {
- /* \n will become \r\n later on */
- endofline_native = "\n";
- endofline_network = "\x0a";
- }
- else {
- endofline_native = "\r\n";
- endofline_network = "\x0d\x0a";
- }
-
- /* if we're not handling trailing data, proceed as usual */
- if(data->state.trailers_state != TRAILERS_SENDING) {
- char hexbuffer[11] = "";
- hexlen = msnprintf(hexbuffer, sizeof(hexbuffer),
- "%zx%s", nread, endofline_native);
-
- /* move buffer pointer */
- data->req.upload_fromhere -= hexlen;
- nread += hexlen;
-
- /* copy the prefix to the buffer, leaving out the NUL */
- memcpy(data->req.upload_fromhere, hexbuffer, hexlen);
-
- /* always append ASCII CRLF to the data unless
- we have a valid trailer callback */
- if((nread-hexlen) == 0 &&
- data->set.trailer_callback != NULL &&
- data->state.trailers_state == TRAILERS_NONE) {
- data->state.trailers_state = TRAILERS_INITIALIZED;
- }
- else {
- memcpy(data->req.upload_fromhere + nread,
- endofline_network,
- strlen(endofline_network));
- added_crlf = TRUE;
- }
- }
-
- if(data->state.trailers_state == TRAILERS_SENDING &&
- !trailers_left(data)) {
- Curl_dyn_free(&data->state.trailers_buf);
- data->state.trailers_state = TRAILERS_DONE;
- data->set.trailer_data = NULL;
- data->set.trailer_callback = NULL;
- /* mark the transfer as done */
- data->req.upload_done = TRUE;
- infof(data, "Signaling end of chunked upload after trailers.");
- }
- else
- if((nread - hexlen) == 0 &&
- data->state.trailers_state != TRAILERS_INITIALIZED) {
- /* mark this as done once this chunk is transferred */
- data->req.upload_done = TRUE;
- infof(data,
- "Signaling end of chunked upload via terminating chunk.");
- }
-
- if(added_crlf)
- nread += strlen(endofline_network); /* for the added end of line */
- }
-#endif
-
- *nreadp = nread;
-
- return CURLE_OK;
-}
-
static int data_pending(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
@@ -447,7 +194,7 @@ static ssize_t Curl_xfer_recv_resp(struct Curl_easy *data,
return 0;
}
- *err = Curl_read(data, data->conn->sockfd, buf, blen, &nread);
+ *err = Curl_xfer_recv(data, buf, blen, &nread);
if(*err)
return -1;
DEBUGASSERT(nread >= 0);
@@ -462,18 +209,19 @@ static ssize_t Curl_xfer_recv_resp(struct Curl_easy *data,
*/
static CURLcode readwrite_data(struct Curl_easy *data,
struct SingleRequest *k,
- int *didwhat, bool *done)
+ int *didwhat)
{
struct connectdata *conn = data->conn;
CURLcode result = CURLE_OK;
- char *buf;
- size_t blen;
+ char *buf, *xfer_buf;
+ size_t blen, xfer_blen;
int maxloops = 10;
curl_off_t total_received = 0;
bool is_multiplex = FALSE;
- DEBUGASSERT(data->state.buffer);
- *done = FALSE;
+ result = Curl_multi_xfer_buf_borrow(data, &xfer_buf, &xfer_blen);
+ if(result)
+ goto out;
/* This is where we loop until we have read everything there is to
read or we get a CURLE_AGAIN */
@@ -489,16 +237,17 @@ static CURLcode readwrite_data(struct Curl_easy *data,
is_multiplex = Curl_conn_is_multiplex(conn, FIRSTSOCKET);
}
- buf = data->state.buffer;
- bytestoread = data->set.buffer_size;
+ buf = xfer_buf;
+ bytestoread = xfer_blen;
- /* Observe any imposed speed limit */
if(bytestoread && data->set.max_recv_speed) {
- curl_off_t net_limit = data->set.max_recv_speed - total_received;
- if(net_limit <= 0)
+ /* In case of speed limit on receiving: if this loop already got
+ * data, break out. If not, limit the amount of bytes to receive.
+ * The overall, timed, speed limiting is done in multi.c */
+ if(total_received)
break;
- if((size_t)net_limit < bytestoread)
- bytestoread = (size_t)net_limit;
+ if((size_t)data->set.max_recv_speed < bytestoread)
+ bytestoread = (size_t)data->set.max_recv_speed;
}
nread = Curl_xfer_recv_resp(data, buf, bytestoread,
@@ -530,8 +279,8 @@ static CURLcode readwrite_data(struct Curl_easy *data,
}
total_received += blen;
- result = Curl_xfer_write_resp(data, buf, blen, is_eos, done);
- if(result || *done)
+ result = Curl_xfer_write_resp(data, buf, blen, is_eos);
+ if(result || data->req.done)
goto out;
/* if we are done, we stop receiving. On multiplexed connections,
@@ -564,22 +313,12 @@ static CURLcode readwrite_data(struct Curl_easy *data,
}
out:
+ Curl_multi_xfer_buf_release(data, xfer_buf);
if(result)
DEBUGF(infof(data, "readwrite_data() -> %d", result));
return result;
}
-CURLcode Curl_done_sending(struct Curl_easy *data,
- struct SingleRequest *k)
-{
- k->keepon &= ~KEEP_SEND; /* we're done writing */
-
- /* These functions should be moved into the handler struct! */
- Curl_conn_ev_data_done_send(data);
-
- return CURLE_OK;
-}
-
#if defined(_WIN32) && defined(USE_WINSOCK)
#ifndef SIO_IDEAL_SEND_BACKLOG_QUERY
#define SIO_IDEAL_SEND_BACKLOG_QUERY 0x4004747B
@@ -602,245 +341,42 @@ static void win_update_buffer_size(curl_socket_t sockfd)
#endif
#define curl_upload_refill_watermark(data) \
- ((ssize_t)((data)->set.upload_buffer_size >> 5))
+ ((size_t)((data)->set.upload_buffer_size >> 5))
/*
* Send data to upload to the server, when the socket is writable.
*/
-static CURLcode readwrite_upload(struct Curl_easy *data,
- struct connectdata *conn,
- int *didwhat)
+static CURLcode readwrite_upload(struct Curl_easy *data, int *didwhat)
{
- ssize_t i, si;
- ssize_t bytes_written;
- CURLcode result;
- ssize_t nread; /* number of bytes read */
- bool sending_http_headers = FALSE;
- struct SingleRequest *k = &data->req;
-
- *didwhat |= KEEP_SEND;
-
- do {
- curl_off_t nbody;
- ssize_t offset = 0;
-
- if(0 != k->upload_present &&
- k->upload_present < curl_upload_refill_watermark(data) &&
- !k->upload_chunky &&/*(variable sized chunked header; append not safe)*/
- !k->upload_done && /*!(k->upload_done once k->upload_present sent)*/
- !(k->writebytecount + k->upload_present - k->pendingheader ==
- data->state.infilesize)) {
- offset = k->upload_present;
- }
-
- /* only read more data if there's no upload data already
- present in the upload buffer, or if appending to upload buffer */
- if(0 == k->upload_present || offset) {
- result = Curl_get_upload_buffer(data);
- if(result)
- return result;
- if(offset && k->upload_fromhere != data->state.ulbuf)
- memmove(data->state.ulbuf, k->upload_fromhere, offset);
- /* init the "upload from here" pointer */
- k->upload_fromhere = data->state.ulbuf;
-
- if(!k->upload_done) {
- /* HTTP pollution, this should be written nicer to become more
- protocol agnostic. */
- size_t fillcount;
- struct HTTP *http = k->p.http;
-
- if((k->exp100 == EXP100_SENDING_REQUEST) &&
- (http->sending == HTTPSEND_BODY)) {
- /* If this call is to send body data, we must take some action:
- We have sent off the full HTTP 1.1 request, and we shall now
- go into the Expect: 100 state and await such a header */
- k->exp100 = EXP100_AWAITING_CONTINUE; /* wait for the header */
- k->keepon &= ~KEEP_SEND; /* disable writing */
- k->start100 = Curl_now(); /* timeout count starts now */
- *didwhat &= ~KEEP_SEND; /* we didn't write anything actually */
- /* set a timeout for the multi interface */
- Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
- break;
- }
-
- if(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)) {
- if(http->sending == HTTPSEND_REQUEST)
- /* We're sending the HTTP request headers, not the data.
- Remember that so we don't change the line endings. */
- sending_http_headers = TRUE;
- else
- sending_http_headers = FALSE;
- }
-
- k->upload_fromhere += offset;
- result = Curl_fillreadbuffer(data, data->set.upload_buffer_size-offset,
- &fillcount);
- k->upload_fromhere -= offset;
- if(result)
- return result;
-
- nread = offset + fillcount;
- }
- else
- nread = 0; /* we're done uploading/reading */
-
- if(!nread && (k->keepon & KEEP_SEND_PAUSE)) {
- /* this is a paused transfer */
- break;
- }
- if(nread <= 0) {
- result = Curl_done_sending(data, k);
- if(result)
- return result;
- break;
- }
-
- /* store number of bytes available for upload */
- k->upload_present = nread;
-
- /* convert LF to CRLF if so asked */
- if((!sending_http_headers) && (
-#ifdef CURL_DO_LINEEND_CONV
- /* always convert if we're FTPing in ASCII mode */
- (data->state.prefer_ascii) ||
-#endif
- (data->set.crlf))) {
- /* Do we need to allocate a scratch buffer? */
- if(!data->state.scratch) {
- data->state.scratch = malloc(2 * data->set.upload_buffer_size);
- if(!data->state.scratch) {
- failf(data, "Failed to alloc scratch buffer");
-
- return CURLE_OUT_OF_MEMORY;
- }
- }
-
- /*
- * ASCII/EBCDIC Note: This is presumably a text (not binary)
- * transfer so the data should already be in ASCII.
- * That means the hex values for ASCII CR (0x0d) & LF (0x0a)
- * must be used instead of the escape sequences \r & \n.
- */
- if(offset)
- memcpy(data->state.scratch, k->upload_fromhere, offset);
- for(i = offset, si = offset; i < nread; i++, si++) {
- if(k->upload_fromhere[i] == 0x0a) {
- data->state.scratch[si++] = 0x0d;
- data->state.scratch[si] = 0x0a;
- if(!data->set.crlf) {
- /* we're here only because FTP is in ASCII mode...
- bump infilesize for the LF we just added */
- if(data->state.infilesize != -1)
- data->state.infilesize++;
- }
- }
- else
- data->state.scratch[si] = k->upload_fromhere[i];
- }
-
- if(si != nread) {
- /* only perform the special operation if we really did replace
- anything */
- nread = si;
-
- /* upload from the new (replaced) buffer instead */
- k->upload_fromhere = data->state.scratch;
+ CURLcode result = CURLE_OK;
- /* set the new amount too */
- k->upload_present = nread;
- }
- }
+ if((data->req.keepon & KEEP_SEND_PAUSE))
+ return CURLE_OK;
-#ifndef CURL_DISABLE_SMTP
- if(conn->handler->protocol & PROTO_FAMILY_SMTP) {
- result = Curl_smtp_escape_eob(data, nread, offset);
- if(result)
- return result;
- }
-#endif /* CURL_DISABLE_SMTP */
- } /* if 0 == k->upload_present or appended to upload buffer */
- else {
- /* We have a partial buffer left from a previous "round". Use
- that instead of reading more data */
- }
+ /* We should not get here when the sending is already done. It
+ * probably means that someone set `data-req.keepon |= KEEP_SEND`
+ * when it should not. */
+ DEBUGASSERT(!Curl_req_done_sending(data));
- /* write to socket (send away data) */
- result = Curl_write(data,
- conn->writesockfd, /* socket to send to */
- k->upload_fromhere, /* buffer pointer */
- k->upload_present, /* buffer size */
- &bytes_written); /* actually sent */
+ if(!Curl_req_done_sending(data)) {
+ *didwhat |= KEEP_SEND;
+ result = Curl_req_send_more(data);
if(result)
return result;
#if defined(_WIN32) && defined(USE_WINSOCK)
+ /* FIXME: this looks like it would fit better into cf-socket.c
+ * but then I do not know enough Windows to say... */
{
struct curltime n = Curl_now();
- if(Curl_timediff(n, k->last_sndbuf_update) > 1000) {
- win_update_buffer_size(conn->writesockfd);
- k->last_sndbuf_update = n;
+ if(Curl_timediff(n, data->conn->last_sndbuf_update) > 1000) {
+ win_update_buffer_size(data->conn->writesockfd);
+ data->conn->last_sndbuf_update = n;
}
}
#endif
-
- if(k->pendingheader) {
- /* parts of what was sent was header */
- curl_off_t n = CURLMIN(k->pendingheader, bytes_written);
- /* show the data before we change the pointer upload_fromhere */
- Curl_debug(data, CURLINFO_HEADER_OUT, k->upload_fromhere, (size_t)n);
- k->pendingheader -= n;
- nbody = bytes_written - n; /* size of the written body part */
- }
- else
- nbody = bytes_written;
-
- if(nbody) {
- /* show the data before we change the pointer upload_fromhere */
- Curl_debug(data, CURLINFO_DATA_OUT,
- &k->upload_fromhere[bytes_written - nbody],
- (size_t)nbody);
-
- k->writebytecount += nbody;
- Curl_pgrsSetUploadCounter(data, k->writebytecount);
- }
-
- if((!k->upload_chunky || k->forbidchunk) &&
- (k->writebytecount == data->state.infilesize)) {
- /* we have sent all data we were supposed to */
- k->upload_done = TRUE;
- infof(data, "We are completely uploaded and fine");
- }
-
- if(k->upload_present != bytes_written) {
- /* we only wrote a part of the buffer (if anything), deal with it! */
-
- /* store the amount of bytes left in the buffer to write */
- k->upload_present -= bytes_written;
-
- /* advance the pointer where to find the buffer when the next send
- is to happen */
- k->upload_fromhere += bytes_written;
- }
- else {
- /* we've uploaded that buffer now */
- result = Curl_get_upload_buffer(data);
- if(result)
- return result;
- k->upload_fromhere = data->state.ulbuf;
- k->upload_present = 0; /* no more bytes left */
-
- if(k->upload_done) {
- result = Curl_done_sending(data, k);
- if(result)
- return result;
- }
- }
-
-
- } while(0); /* just to break out from! */
-
- return CURLE_OK;
+ }
+ return result;
}
static int select_bits_paused(struct Curl_easy *data, int select_bits)
@@ -865,8 +401,7 @@ static int select_bits_paused(struct Curl_easy *data, int select_bits)
* Curl_readwrite() is the low-level function to be called when data is to
* be read and written to/from the connection.
*/
-CURLcode Curl_readwrite(struct Curl_easy *data,
- bool *done)
+CURLcode Curl_readwrite(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
struct SingleRequest *k = &data->req;
@@ -912,8 +447,8 @@ CURLcode Curl_readwrite(struct Curl_easy *data,
#ifdef USE_HYPER
if(conn->datastream) {
- result = conn->datastream(data, conn, &didwhat, done, select_bits);
- if(result || *done)
+ result = conn->datastream(data, conn, &didwhat, select_bits);
+ if(result || data->req.done)
goto out;
}
else {
@@ -922,16 +457,17 @@ CURLcode Curl_readwrite(struct Curl_easy *data,
the stream was rewound (in which case we have data in a
buffer) */
if((k->keepon & KEEP_RECV) && (select_bits & CURL_CSELECT_IN)) {
- result = readwrite_data(data, k, &didwhat, done);
- if(result || *done)
+ result = readwrite_data(data, k, &didwhat);
+ if(result || data->req.done)
goto out;
}
/* If we still have writing to do, we check if we have a writable socket. */
- if((k->keepon & KEEP_SEND) && (select_bits & CURL_CSELECT_OUT)) {
+ if(((k->keepon & KEEP_SEND) && (select_bits & CURL_CSELECT_OUT)) ||
+ (k->keepon & KEEP_SEND_TIMED)) {
/* write */
- result = readwrite_upload(data, conn, &didwhat);
+ result = readwrite_upload(data, &didwhat);
if(result)
goto out;
}
@@ -941,31 +477,6 @@ CURLcode Curl_readwrite(struct Curl_easy *data,
now = Curl_now();
if(!didwhat) {
- /* no read no write, this is a timeout? */
- if(k->exp100 == EXP100_AWAITING_CONTINUE) {
- /* This should allow some time for the header to arrive, but only a
- very short time as otherwise it'll be too much wasted time too
- often. */
-
- /* Quoting RFC2616, section "8.2.3 Use of the 100 (Continue) Status":
-
- Therefore, when a client sends this header field to an origin server
- (possibly via a proxy) from which it has never seen a 100 (Continue)
- status, the client SHOULD NOT wait for an indefinite period before
- sending the request body.
-
- */
-
- timediff_t ms = Curl_timediff(now, k->start100);
- if(ms >= data->set.expect_100_timeout) {
- /* we've waited long enough, continue anyway */
- k->exp100 = EXP100_SEND_DATA;
- k->keepon |= KEEP_SEND;
- Curl_expire_done(data, EXPIRE_100_TIMEOUT);
- infof(data, "Done waiting for 100-continue");
- }
- }
-
result = Curl_conn_ev_data_idle(data);
if(result)
goto out;
@@ -1002,7 +513,6 @@ CURLcode Curl_readwrite(struct Curl_easy *data,
* The transfer has been performed. Just make some general checks before
* returning.
*/
-
if(!(data->req.no_body) && (k->size != -1) &&
(k->bytecount != k->size) &&
#ifdef CURL_DO_LINEEND_CONV
@@ -1024,8 +534,10 @@ CURLcode Curl_readwrite(struct Curl_easy *data,
}
}
- /* Now update the "done" boolean we return */
- *done = (0 == (k->keepon&(KEEP_RECVBITS|KEEP_SENDBITS))) ? TRUE : FALSE;
+ /* If there is nothing more to send/recv, the request is done */
+ if(0 == (k->keepon&(KEEP_RECVBITS|KEEP_SENDBITS)))
+ data->req.done = TRUE;
+
out:
if(result)
DEBUGF(infof(data, "Curl_readwrite() -> %d", result));
@@ -1400,7 +912,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
data->state.url = newurl;
data->state.url_alloc = TRUE;
-
+ Curl_req_soft_reset(&data->req, data);
infof(data, "Issue another request to this URL: '%s'", data->state.url);
/*
@@ -1446,6 +958,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
&& !(data->set.keep_post & CURL_REDIR_POST_301)) {
infof(data, "Switch from POST to GET");
data->state.httpreq = HTTPREQ_GET;
+ Curl_creader_set_rewind(data, FALSE);
}
break;
case 302: /* Found */
@@ -1471,6 +984,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
&& !(data->set.keep_post & CURL_REDIR_POST_302)) {
infof(data, "Switch from POST to GET");
data->state.httpreq = HTTPREQ_GET;
+ Curl_creader_set_rewind(data, FALSE);
}
break;
@@ -1573,23 +1087,16 @@ CURLcode Curl_retry_request(struct Curl_easy *data, char **url)
prevent i.e HTTP transfers to return
error just because nothing has been
transferred! */
-
-
- if((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
- data->req.writebytecount) {
- data->state.rewindbeforesend = TRUE;
- infof(data, "state.rewindbeforesend = TRUE");
- }
+ Curl_creader_set_rewind(data, TRUE);
}
return CURLE_OK;
}
/*
- * Curl_setup_transfer() is called to setup some basic properties for the
+ * Curl_xfer_setup() is called to setup some basic properties for the
* upcoming transfer.
*/
-void
-Curl_setup_transfer(
+void Curl_xfer_setup(
struct Curl_easy *data, /* transfer */
int sockindex, /* socket index to read from or -1 */
curl_off_t size, /* -1 if unknown at this point */
@@ -1600,22 +1107,19 @@ Curl_setup_transfer(
{
struct SingleRequest *k = &data->req;
struct connectdata *conn = data->conn;
- struct HTTP *http = data->req.p.http;
- bool httpsending;
+ bool want_send = Curl_req_want_send(data);
DEBUGASSERT(conn != NULL);
DEBUGASSERT((sockindex <= 1) && (sockindex >= -1));
+ DEBUGASSERT((writesockindex <= 1) && (writesockindex >= -1));
- httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
- (http->sending == HTTPSEND_REQUEST));
-
- if(conn->bits.multiplex || conn->httpversion >= 20 || httpsending) {
+ if(conn->bits.multiplex || conn->httpversion >= 20 || want_send) {
/* when multiplexing, the read/write sockets need to be the same! */
conn->sockfd = sockindex == -1 ?
((writesockindex == -1 ? CURL_SOCKET_BAD : conn->sock[writesockindex])) :
conn->sock[sockindex];
conn->writesockfd = conn->sockfd;
- if(httpsending)
+ if(want_send)
/* special and very HTTP-specific */
writesockindex = FIRSTSOCKET;
}
@@ -1644,51 +1148,22 @@ Curl_setup_transfer(
if(sockindex != -1)
k->keepon |= KEEP_RECV;
- if(writesockindex != -1) {
- /* HTTP 1.1 magic:
-
- Even if we require a 100-return code before uploading data, we might
- need to write data before that since the REQUEST may not have been
- finished sent off just yet.
-
- Thus, we must check if the request has been sent before we set the
- state info where we wait for the 100-return code
- */
- if((data->state.expect100header) &&
- (conn->handler->protocol&PROTO_FAMILY_HTTP) &&
- (http->sending == HTTPSEND_BODY)) {
- /* wait with write until we either got 100-continue or a timeout */
- k->exp100 = EXP100_AWAITING_CONTINUE;
- k->start100 = Curl_now();
-
- /* Set a timeout for the multi interface. Add the inaccuracy margin so
- that we don't fire slightly too early and get denied to run. */
- Curl_expire(data, data->set.expect_100_timeout, EXPIRE_100_TIMEOUT);
- }
- else {
- if(data->state.expect100header)
- /* when we've sent off the rest of the headers, we must await a
- 100-continue but first finish sending the request */
- k->exp100 = EXP100_SENDING_REQUEST;
-
- /* enable the write bit when we're not waiting for continue */
- k->keepon |= KEEP_SEND;
- }
- } /* if(writesockindex != -1) */
+ if(writesockindex != -1)
+ k->keepon |= KEEP_SEND;
} /* if(k->getheader || !data->req.no_body) */
}
CURLcode Curl_xfer_write_resp(struct Curl_easy *data,
char *buf, size_t blen,
- bool is_eos, bool *done)
+ bool is_eos)
{
CURLcode result = CURLE_OK;
if(data->conn->handler->write_resp) {
/* protocol handlers offering this function take full responsibility
* for writing all received download data to the client. */
- result = data->conn->handler->write_resp(data, buf, blen, is_eos, done);
+ result = data->conn->handler->write_resp(data, buf, blen, is_eos);
}
else {
/* No special handling by protocol handler, write all received data
@@ -1716,3 +1191,63 @@ CURLcode Curl_xfer_write_resp(struct Curl_easy *data,
}
return result;
}
+
+CURLcode Curl_xfer_write_done(struct Curl_easy *data, bool premature)
+{
+ (void)premature;
+ return Curl_cw_out_done(data);
+}
+
+CURLcode Curl_xfer_send(struct Curl_easy *data,
+ const void *buf, size_t blen,
+ size_t *pnwritten)
+{
+ CURLcode result;
+ int sockindex;
+
+ if(!data || !data->conn)
+ return CURLE_FAILED_INIT;
+ /* FIXME: would like to enable this, but some protocols (MQTT) do not
+ * setup the transfer correctly, it seems
+ if(data->conn->writesockfd == CURL_SOCKET_BAD) {
+ failf(data, "transfer not setup for sending");
+ DEBUGASSERT(0);
+ return CURLE_SEND_ERROR;
+ } */
+ sockindex = ((data->conn->writesockfd != CURL_SOCKET_BAD) &&
+ (data->conn->writesockfd == data->conn->sock[SECONDARYSOCKET]));
+ result = Curl_conn_send(data, sockindex, buf, blen, pnwritten);
+ if(result == CURLE_AGAIN) {
+ result = CURLE_OK;
+ *pnwritten = 0;
+ }
+ return result;
+}
+
+CURLcode Curl_xfer_recv(struct Curl_easy *data,
+ char *buf, size_t blen,
+ ssize_t *pnrcvd)
+{
+ int sockindex;
+
+ if(!data || !data->conn)
+ return CURLE_FAILED_INIT;
+ /* FIXME: would like to enable this, but some protocols (MQTT) do not
+ * setup the transfer correctly, it seems
+ if(data->conn->sockfd == CURL_SOCKET_BAD) {
+ failf(data, "transfer not setup for receiving");
+ DEBUGASSERT(0);
+ return CURLE_RECV_ERROR;
+ } */
+ sockindex = ((data->conn->sockfd != CURL_SOCKET_BAD) &&
+ (data->conn->sockfd == data->conn->sock[SECONDARYSOCKET]));
+ if(data->set.buffer_size > 0 && (size_t)data->set.buffer_size < blen)
+ blen = (size_t)data->set.buffer_size;
+ return Curl_conn_recv(data, sockindex, buf, blen, pnrcvd);
+}
+
+CURLcode Curl_xfer_send_close(struct Curl_easy *data)
+{
+ Curl_conn_ev_data_done_send(data);
+ return CURLE_OK;
+}
diff --git a/Utilities/cmcurl/lib/transfer.h b/Utilities/cmcurl/lib/transfer.h
index 0507f1a..e65b2b1 100644
--- a/Utilities/cmcurl/lib/transfer.h
+++ b/Utilities/cmcurl/lib/transfer.h
@@ -45,17 +45,11 @@ typedef enum {
CURLcode Curl_follow(struct Curl_easy *data, char *newurl,
followtype type);
-CURLcode Curl_readwrite(struct Curl_easy *data, bool *done);
+CURLcode Curl_readwrite(struct Curl_easy *data);
int Curl_single_getsock(struct Curl_easy *data,
struct connectdata *conn, curl_socket_t *socks);
-CURLcode Curl_fillreadbuffer(struct Curl_easy *data, size_t bytes,
- size_t *nreadp);
CURLcode Curl_retry_request(struct Curl_easy *data, char **url);
bool Curl_meets_timecondition(struct Curl_easy *data, time_t timeofdoc);
-CURLcode Curl_get_upload_buffer(struct Curl_easy *data);
-
-CURLcode Curl_done_sending(struct Curl_easy *data,
- struct SingleRequest *k);
/**
* Write the transfer raw response bytes, as received from the connection.
@@ -72,11 +66,10 @@ CURLcode Curl_done_sending(struct Curl_easy *data,
*/
CURLcode Curl_xfer_write_resp(struct Curl_easy *data,
char *buf, size_t blen,
- bool is_eos, bool *done);
+ bool is_eos);
/* This sets up a forthcoming transfer */
-void
-Curl_setup_transfer (struct Curl_easy *data,
+void Curl_xfer_setup(struct Curl_easy *data,
int sockindex, /* socket index to read from or -1 */
curl_off_t size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */
@@ -85,4 +78,30 @@ Curl_setup_transfer (struct Curl_easy *data,
disables */
);
+/**
+ * Multi has set transfer to DONE. Last chance to trigger
+ * missing response things like writing an EOS to the client.
+ */
+CURLcode Curl_xfer_write_done(struct Curl_easy *data, bool premature);
+
+/**
+ * Send data on the socket/connection filter designated
+ * for transfer's outgoing data.
+ * Will return CURLE_OK on blocking with (*pnwritten == 0).
+ */
+CURLcode Curl_xfer_send(struct Curl_easy *data,
+ const void *buf, size_t blen,
+ size_t *pnwritten);
+
+/**
+ * Receive data on the socket/connection filter designated
+ * for transfer's incoming data.
+ * Will return CURLE_AGAIN on blocking with (*pnrcvd == 0).
+ */
+CURLcode Curl_xfer_recv(struct Curl_easy *data,
+ char *buf, size_t blen,
+ ssize_t *pnrcvd);
+
+CURLcode Curl_xfer_send_close(struct Curl_easy *data);
+
#endif /* HEADER_CURL_TRANSFER_H */
diff --git a/Utilities/cmcurl/lib/url.c b/Utilities/cmcurl/lib/url.c
index 36395a1..224b9f3 100644
--- a/Utilities/cmcurl/lib/url.c
+++ b/Utilities/cmcurl/lib/url.c
@@ -261,7 +261,7 @@ CURLcode Curl_close(struct Curl_easy **datap)
free(data->state.range);
/* freed here just in case DONE wasn't called */
- Curl_free_request_state(data);
+ Curl_req_free(&data->req, data);
/* Close down all open SSL info and sessions */
Curl_ssl_close_all(data);
@@ -269,10 +269,6 @@ CURLcode Curl_close(struct Curl_easy **datap)
Curl_safefree(data->state.scratch);
Curl_ssl_free_certinfo(data);
- /* Cleanup possible redirect junk */
- free(data->req.newurl);
- data->req.newurl = NULL;
-
if(data->state.referer_alloc) {
Curl_safefree(data->state.referer);
data->state.referer_alloc = FALSE;
@@ -280,9 +276,7 @@ CURLcode Curl_close(struct Curl_easy **datap)
data->state.referer = NULL;
up_free(data);
- Curl_safefree(data->state.buffer);
Curl_dyn_free(&data->state.headerb);
- Curl_safefree(data->state.ulbuf);
Curl_flush_cookies(data, TRUE);
Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
Curl_altsvc_cleanup(&data->asi);
@@ -326,16 +320,7 @@ CURLcode Curl_close(struct Curl_easy **datap)
Curl_safefree(data->state.aptr.proxyuser);
Curl_safefree(data->state.aptr.proxypasswd);
-#ifndef CURL_DISABLE_DOH
- if(data->req.doh) {
- Curl_dyn_free(&data->req.doh->probe[0].serverdoh);
- Curl_dyn_free(&data->req.doh->probe[1].serverdoh);
- curl_slist_free_all(data->req.doh->headers);
- Curl_safefree(data->req.doh);
- }
-#endif
-
-#ifndef CURL_DISABLE_HTTP
+#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_FORM_API)
Curl_mime_cleanpart(data->state.formp);
Curl_safefree(data->state.formp);
#endif
@@ -368,7 +353,6 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
set->fread_func_set = (curl_read_callback)fread;
set->is_fread_set = 0;
- set->seek_func = ZERO_NULL;
set->seek_client = ZERO_NULL;
set->filesize = -1; /* we don't know the size */
@@ -520,9 +504,17 @@ CURLcode Curl_open(struct Curl_easy **curl)
data->magic = CURLEASY_MAGIC_NUMBER;
+ result = Curl_req_init(&data->req);
+ if(result) {
+ DEBUGF(fprintf(stderr, "Error: request init failed\n"));
+ free(data);
+ return result;
+ }
+
result = Curl_resolver_init(data, &data->state.async.resolver);
if(result) {
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
+ Curl_req_free(&data->req, data);
free(data);
return result;
}
@@ -546,6 +538,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
Curl_resolver_cleanup(data->state.async.resolver);
Curl_dyn_free(&data->state.headerb);
Curl_freeset(data);
+ Curl_req_free(&data->req, data);
free(data);
data = NULL;
}
@@ -1009,9 +1002,9 @@ ConnectionExists(struct Curl_easy *data,
if(!canmultiplex) {
if(Curl_resolver_asynch() &&
- /* primary_ip[0] is NUL only if the resolving of the name hasn't
+ /* remote_ip[0] is NUL only if the resolving of the name hasn't
completed yet and until then we don't reuse this connection */
- !check->primary_ip[0])
+ !check->primary.remote_ip[0])
continue;
}
@@ -1334,11 +1327,15 @@ ConnectionExists(struct Curl_easy *data,
*/
#ifndef CURL_DISABLE_VERBOSE_STRINGS
void Curl_verboseconnect(struct Curl_easy *data,
- struct connectdata *conn)
+ struct connectdata *conn, int sockindex)
{
- if(data->set.verbose)
+ if(data->set.verbose && sockindex == SECONDARYSOCKET)
+ infof(data, "Connected 2nd connection to %s port %u",
+ conn->secondary.remote_ip, conn->secondary.remote_port);
+ else
infof(data, "Connected to %s (%s) port %u",
- CURL_CONN_HOST_DISPNAME(conn), conn->primary_ip, conn->port);
+ CURL_CONN_HOST_DISPNAME(conn), conn->primary.remote_ip,
+ conn->primary.remote_port);
}
#endif
@@ -1358,7 +1355,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->sockfd = CURL_SOCKET_BAD;
conn->writesockfd = CURL_SOCKET_BAD;
conn->connection_id = -1; /* no ID */
- conn->port = -1; /* unknown at this point */
+ conn->primary.remote_port = -1; /* unknown at this point */
conn->remote_port = -1; /* unknown at this point */
/* Default protocol-independent behavior doesn't support persistent
@@ -1971,7 +1968,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
else {
unsigned long port = strtoul(data->state.up.port, NULL, 10);
- conn->port = conn->remote_port =
+ conn->primary.remote_port = conn->remote_port =
(data->set.use_port && data->state.allow_port) ?
data->set.use_port : curlx_ultous(port);
}
@@ -2047,32 +2044,14 @@ static CURLcode setup_connection_internals(struct Curl_easy *data,
p = conn->handler; /* May have changed. */
}
- if(conn->port < 0)
+ if(conn->primary.remote_port < 0)
/* we check for -1 here since if proxy was detected already, this
was very likely already set to the proxy port */
- conn->port = p->defport;
+ conn->primary.remote_port = p->defport;
return CURLE_OK;
}
-/*
- * Curl_free_request_state() should free temp data that was allocated in the
- * Curl_easy for this single request.
- */
-
-void Curl_free_request_state(struct Curl_easy *data)
-{
- Curl_safefree(data->req.p.http);
- Curl_safefree(data->req.newurl);
-#ifndef CURL_DISABLE_DOH
- if(data->req.doh) {
- Curl_close(&data->req.doh->probe[0].easy);
- Curl_close(&data->req.doh->probe[1].easy);
- }
-#endif
- Curl_client_cleanup(data);
-}
-
#ifndef CURL_DISABLE_PROXY
@@ -2314,8 +2293,9 @@ static CURLcode parse_proxy(struct Curl_easy *data,
}
if(port >= 0) {
proxyinfo->port = port;
- if(conn->port < 0 || sockstype || !conn->socks_proxy.host.rawalloc)
- conn->port = port;
+ if(conn->primary.remote_port < 0 || sockstype ||
+ !conn->socks_proxy.host.rawalloc)
+ conn->primary.remote_port = port;
}
/* now, clone the proxy host name */
@@ -3213,8 +3193,8 @@ static CURLcode resolve_proxy(struct Curl_easy *data,
if(!conn->hostname_resolve)
return CURLE_OUT_OF_MEMORY;
- rc = Curl_resolv_timeout(data, conn->hostname_resolve, (int)conn->port,
- &hostaddr, timeout_ms);
+ rc = Curl_resolv_timeout(data, conn->hostname_resolve,
+ conn->primary.remote_port, &hostaddr, timeout_ms);
conn->dns_entry = hostaddr;
if(rc == CURLRESOLV_PENDING)
*async = TRUE;
@@ -3244,7 +3224,7 @@ static CURLcode resolve_host(struct Curl_easy *data,
/* If not connecting via a proxy, extract the port from the URL, if it is
* there, thus overriding any defaults that might have been set above. */
- conn->port = conn->bits.conn_to_port ? conn->conn_to_port :
+ conn->primary.remote_port = conn->bits.conn_to_port ? conn->conn_to_port :
conn->remote_port;
/* Resolve target host right on */
@@ -3252,8 +3232,8 @@ static CURLcode resolve_host(struct Curl_easy *data,
if(!conn->hostname_resolve)
return CURLE_OUT_OF_MEMORY;
- rc = Curl_resolv_timeout(data, conn->hostname_resolve, (int)conn->port,
- &hostaddr, timeout_ms);
+ rc = Curl_resolv_timeout(data, conn->hostname_resolve,
+ conn->primary.remote_port, &hostaddr, timeout_ms);
conn->dns_entry = hostaddr;
if(rc == CURLRESOLV_PENDING)
*async = TRUE;
@@ -3590,7 +3570,7 @@ static CURLcode create_conn(struct Curl_easy *data,
/* this is supposed to be the connect function so we better at least check
that the file is present here! */
DEBUGASSERT(conn->handler->connect_it);
- Curl_persistconninfo(data, conn, NULL, -1);
+ Curl_persistconninfo(data, conn, NULL);
result = conn->handler->connect_it(data, &done);
/* Setup a "faked" transfer that'll do nothing */
@@ -3610,7 +3590,7 @@ static CURLcode create_conn(struct Curl_easy *data,
(void)conn->handler->done(data, result, FALSE);
goto out;
}
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
}
/* since we skip do_init() */
@@ -3621,10 +3601,10 @@ static CURLcode create_conn(struct Curl_easy *data,
#endif
/* Setup filter for network connections */
- conn->recv[FIRSTSOCKET] = Curl_conn_recv;
- conn->send[FIRSTSOCKET] = Curl_conn_send;
- conn->recv[SECONDARYSOCKET] = Curl_conn_recv;
- conn->send[SECONDARYSOCKET] = Curl_conn_send;
+ conn->recv[FIRSTSOCKET] = Curl_cf_recv;
+ conn->send[FIRSTSOCKET] = Curl_cf_send;
+ conn->recv[SECONDARYSOCKET] = Curl_cf_recv;
+ conn->send[SECONDARYSOCKET] = Curl_cf_send;
conn->bits.tcp_fastopen = data->set.tcp_fastopen;
/* Complete the easy's SSL configuration for connection cache matching */
@@ -3789,13 +3769,6 @@ static CURLcode create_conn(struct Curl_easy *data,
/* Continue connectdata initialization here. */
- /*
- * Inherit the proper values from the urldata struct AFTER we have arranged
- * the persistent connection stuff
- */
- conn->seek_func = data->set.seek_func;
- conn->seek_client = data->set.seek_client;
-
/*************************************************************
* Resolve the address of the server or proxy
*************************************************************/
@@ -3849,6 +3822,9 @@ CURLcode Curl_setup_conn(struct Curl_easy *data,
if(!conn->bits.reuse)
result = Curl_conn_setup(data, conn, FIRSTSOCKET, conn->dns_entry,
CURL_CF_SSL_DEFAULT);
+ if(!result)
+ result = Curl_headers_init(data);
+
/* not sure we need this flag to be passed around any more */
*protocol_done = FALSE;
return result;
@@ -3863,11 +3839,8 @@ CURLcode Curl_connect(struct Curl_easy *data,
*asyncp = FALSE; /* assume synchronous resolves by default */
- /* init the single-transfer specific data */
- Curl_free_request_state(data);
- memset(&data->req, 0, sizeof(struct SingleRequest));
- data->req.size = data->req.maxdownload = -1;
- data->req.no_body = data->set.opt_no_body;
+ /* Set the request to virgin state based on transfer settings */
+ Curl_req_hard_reset(&data->req, data);
/* call the stuff that needs to be called */
result = create_conn(data, &conn, asyncp);
@@ -3910,8 +3883,6 @@ CURLcode Curl_connect(struct Curl_easy *data,
CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
{
- struct SingleRequest *k = &data->req;
-
/* if this is a pushed stream, we need this: */
CURLcode result = Curl_preconnect(data);
if(result)
@@ -3927,18 +3898,15 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn)
}
data->state.done = FALSE; /* *_done() is not called yet */
- data->state.expect100header = FALSE;
if(data->req.no_body)
/* in HTTP lingo, no body means using the HEAD request... */
data->state.httpreq = HTTPREQ_HEAD;
- k->start = Curl_now(); /* start time */
- k->header = TRUE; /* assume header */
- k->bytecount = 0;
- k->ignorebody = FALSE;
+ result = Curl_req_start(&data->req, data);
+ if(result)
+ return result;
- Curl_client_cleanup(data);
Curl_speedinit(data);
Curl_pgrsSetUploadCounter(data, 0);
Curl_pgrsSetDownloadCounter(data, 0);
diff --git a/Utilities/cmcurl/lib/url.h b/Utilities/cmcurl/lib/url.h
index 7c1a29b..198a00a 100644
--- a/Utilities/cmcurl/lib/url.h
+++ b/Utilities/cmcurl/lib/url.h
@@ -41,7 +41,6 @@ void Curl_disconnect(struct Curl_easy *data,
struct connectdata *, bool dead_connection);
CURLcode Curl_setup_conn(struct Curl_easy *data,
bool *protocol_done);
-void Curl_free_request_state(struct Curl_easy *data);
CURLcode Curl_parse_login_details(const char *login, const size_t len,
char **userptr, char **passwdptr,
char **optionsptr);
@@ -59,9 +58,10 @@ const struct Curl_handler *Curl_getn_scheme_handler(const char *scheme,
specified */
#ifdef CURL_DISABLE_VERBOSE_STRINGS
-#define Curl_verboseconnect(x,y) Curl_nop_stmt
+#define Curl_verboseconnect(x,y,z) Curl_nop_stmt
#else
-void Curl_verboseconnect(struct Curl_easy *data, struct connectdata *conn);
+void Curl_verboseconnect(struct Curl_easy *data, struct connectdata *conn,
+ int sockindex);
#endif
#if defined(USE_HTTP2) || defined(USE_HTTP3)
diff --git a/Utilities/cmcurl/lib/urlapi.c b/Utilities/cmcurl/lib/urlapi.c
index 3cd0362..dc42489 100644
--- a/Utilities/cmcurl/lib/urlapi.c
+++ b/Utilities/cmcurl/lib/urlapi.c
@@ -531,7 +531,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
portptr = strchr(hostname, ':');
if(portptr) {
- char *rest;
+ char *rest = NULL;
long port;
size_t keep = portptr - hostname;
@@ -681,7 +681,7 @@ static int ipv4_normalize(struct dynbuf *host)
return HOST_IPV6;
while(!done) {
- char *endp;
+ char *endp = NULL;
unsigned long l;
if(!ISDIGIT(*c))
/* most importantly this doesn't allow a leading plus or minus */
diff --git a/Utilities/cmcurl/lib/urldata.h b/Utilities/cmcurl/lib/urldata.h
index 9dcccc7..ce28f25 100644
--- a/Utilities/cmcurl/lib/urldata.h
+++ b/Utilities/cmcurl/lib/urldata.h
@@ -53,6 +53,8 @@
#define PORT_GOPHER 70
#define PORT_MQTT 1883
+struct curl_trc_featt;
+
#ifdef USE_WEBSOCKETS
/* CURLPROTO_GOPHERS (29) is the highest publicly used protocol bit number,
* the rest are internal information. If we use higher bits we only do this on
@@ -141,6 +143,7 @@ typedef unsigned int curl_prot_t;
#include "splay.h"
#include "dynbuf.h"
#include "dynhds.h"
+#include "request.h"
/* return the count of bytes sent, or -1 on error */
typedef ssize_t (Curl_send)(struct Curl_easy *data, /* transfer */
@@ -160,7 +163,6 @@ typedef ssize_t (Curl_recv)(struct Curl_easy *data, /* transfer */
typedef CURLcode (*Curl_datastream)(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
- bool *done,
int select_res);
#endif
@@ -266,11 +268,17 @@ typedef enum {
/* SSL backend-specific data; declared differently by each SSL backend */
struct ssl_backend_data;
+typedef enum {
+ CURL_SSL_PEER_DNS,
+ CURL_SSL_PEER_IPV4,
+ CURL_SSL_PEER_IPV6
+} ssl_peer_type;
+
struct ssl_peer {
char *hostname; /* hostname for verification */
char *dispname; /* display version of hostname */
char *sni; /* SNI version of hostname or NULL if not usable */
- BIT(is_ip_address); /* if hostname is an IPv4|6 address */
+ ssl_peer_type type; /* type of the peer information */
};
struct ssl_primary_config {
@@ -519,10 +527,6 @@ struct ConnectBits {
the TCP layer connect */
BIT(retry); /* this connection is about to get closed and then
re-attempted at another connection. */
- BIT(authneg); /* TRUE when the auth phase has started, which means
- that we are creating a request with an auth header,
- but it is not the final request in the auth
- negotiation. */
#ifndef CURL_DISABLE_FTP
BIT(ftp_use_epsv); /* As set with CURLOPT_FTP_USE_EPSV, but if we find out
EPSV doesn't work we disable it for the forthcoming
@@ -575,6 +579,14 @@ struct hostname {
#define KEEP_RECV_PAUSE (1<<4) /* reading is paused */
#define KEEP_SEND_PAUSE (1<<5) /* writing is paused */
+/* KEEP_SEND_TIMED is set when the transfer should attempt sending
+ * at timer (or other) events. A transfer waiting on a timer will
+ * remove KEEP_SEND to suppress POLLOUTs of the connection.
+ * Adding KEEP_SEND_TIMED will then attempt to send whenever the transfer
+ * enters the "readwrite" loop, e.g. when a timer fires.
+ * This is used in HTTP for 'Expect: 100-continue' waiting. */
+#define KEEP_SEND_TIMED (1<<6)
+
#define KEEP_RECVBITS (KEEP_RECV | KEEP_RECV_HOLD | KEEP_RECV_PAUSE)
#define KEEP_SENDBITS (KEEP_SEND | KEEP_SEND_HOLD | KEEP_SEND_PAUSE)
@@ -612,22 +624,6 @@ struct easy_pollset {
unsigned char actions[MAX_SOCKSPEREASYHANDLE];
};
-enum expect100 {
- EXP100_SEND_DATA, /* enough waiting, just send the body now */
- EXP100_AWAITING_CONTINUE, /* waiting for the 100 Continue header */
- EXP100_SENDING_REQUEST, /* still sending the request but will wait for
- the 100 header once done with the request */
- EXP100_FAILED /* used on 417 Expectation Failed */
-};
-
-enum upgrade101 {
- UPGR101_INIT, /* default state */
- UPGR101_WS, /* upgrade to WebSockets requested */
- UPGR101_H2, /* upgrade to HTTP/2 requested */
- UPGR101_RECEIVED, /* 101 response received */
- UPGR101_WORKING /* talking upgraded protocol */
-};
-
enum doh_slots {
/* Explicit values for first two symbols so as to match hard-coded
* constants in existing code
@@ -647,111 +643,6 @@ enum doh_slots {
};
/*
- * Request specific data in the easy handle (Curl_easy). Previously,
- * these members were on the connectdata struct but since a conn struct may
- * now be shared between different Curl_easys, we store connection-specific
- * data here. This struct only keeps stuff that's interesting for *this*
- * request, as it will be cleared between multiple ones
- */
-struct SingleRequest {
- curl_off_t size; /* -1 if unknown at this point */
- curl_off_t maxdownload; /* in bytes, the maximum amount of data to fetch,
- -1 means unlimited */
- curl_off_t bytecount; /* total number of bytes read */
- curl_off_t writebytecount; /* number of bytes written */
-
- curl_off_t pendingheader; /* this many bytes left to send is actually
- header and not body */
- struct curltime start; /* transfer started at this time */
- unsigned int headerbytecount; /* received server headers (not CONNECT
- headers) */
- unsigned int allheadercount; /* all received headers (server + CONNECT) */
- unsigned int deductheadercount; /* this amount of bytes doesn't count when
- we check if anything has been transferred
- at the end of a connection. We use this
- counter to make only a 100 reply (without
- a following second response code) result
- in a CURLE_GOT_NOTHING error code */
- int headerline; /* counts header lines to better track the
- first one */
- curl_off_t offset; /* possible resume offset read from the
- Content-Range: header */
- int httpcode; /* error code from the 'HTTP/1.? XXX' or
- 'RTSP/1.? XXX' line */
- int keepon;
- struct curltime start100; /* time stamp to wait for the 100 code from */
- enum expect100 exp100; /* expect 100 continue state */
- enum upgrade101 upgr101; /* 101 upgrade state */
-
- /* Client Writer stack, handles trasnfer- and content-encodings, protocol
- * checks, pausing by client callbacks. */
- struct Curl_cwriter *writer_stack;
- time_t timeofdoc;
- long bodywrites;
- char *location; /* This points to an allocated version of the Location:
- header data */
- char *newurl; /* Set to the new URL to use when a redirect or a retry is
- wanted */
-
- /* 'upload_present' is used to keep a byte counter of how much data there is
- still left in the buffer, aimed for upload. */
- ssize_t upload_present;
-
- /* 'upload_fromhere' is used as a read-pointer when we uploaded parts of a
- buffer, so the next read should read from where this pointer points to,
- and the 'upload_present' contains the number of bytes available at this
- position */
- char *upload_fromhere;
-
- /* Allocated protocol-specific data. Each protocol handler makes sure this
- points to data it needs. */
- union {
- struct FILEPROTO *file;
- struct FTP *ftp;
- struct HTTP *http;
- struct IMAP *imap;
- struct ldapreqinfo *ldap;
- struct MQTT *mqtt;
- struct POP3 *pop3;
- struct RTSP *rtsp;
- struct smb_request *smb;
- struct SMTP *smtp;
- struct SSHPROTO *ssh;
- struct TELNET *telnet;
- } p;
-#ifndef CURL_DISABLE_DOH
- struct dohdata *doh; /* DoH specific data for this request */
-#endif
-#if defined(_WIN32) && defined(USE_WINSOCK)
- struct curltime last_sndbuf_update; /* last time readwrite_upload called
- win_update_buffer_size */
-#endif
- char fread_eof[2]; /* the body read callback (index 0) returned EOF or
- the trailer read callback (index 1) returned EOF */
-#ifndef CURL_DISABLE_COOKIES
- unsigned char setcookies;
-#endif
- BIT(header); /* incoming data has HTTP header */
- BIT(content_range); /* set TRUE if Content-Range: was found */
- BIT(download_done); /* set to TRUE when download is complete */
- BIT(eos_written); /* iff EOS has been written to client */
- BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
- upload and we're uploading the last chunk */
- BIT(ignorebody); /* we read a response-body but we ignore it! */
- BIT(http_bodyless); /* HTTP response status code is between 100 and 199,
- 204 or 304 */
- BIT(chunk); /* if set, this is a chunked transfer-encoding */
- BIT(ignore_cl); /* ignore content-length */
- BIT(upload_chunky); /* set TRUE if we are doing chunked transfer-encoding
- on upload */
- BIT(getheader); /* TRUE if header parsing is wanted */
- BIT(forbidchunk); /* used only to explicitly forbid chunk-upload for
- specific upload buffers. See readmoredata() in http.c
- for details. */
- BIT(no_body); /* the response has no body */
-};
-
-/*
* Specific protocol handler.
*/
@@ -819,7 +710,7 @@ struct Curl_handler {
allow the protocol to do extra handling in writing response to
the client. */
CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t blen,
- bool is_eos, bool *done);
+ bool is_eos);
/* This function can perform various checks on the connection. See
CONNCHECK_* for more information about the checks that can be performed,
@@ -875,6 +766,13 @@ struct Curl_handler {
#define CONNRESULT_NONE 0 /* No extra information. */
#define CONNRESULT_DEAD (1<<0) /* The connection is dead. */
+struct ip_quadruple {
+ char remote_ip[MAX_IPADR_LEN];
+ char local_ip[MAX_IPADR_LEN];
+ int remote_port;
+ int local_port;
+};
+
struct proxy_info {
struct hostname host;
int port;
@@ -930,14 +828,13 @@ struct connectdata {
struct proxy_info socks_proxy;
struct proxy_info http_proxy;
#endif
- /* 'primary_ip' and 'primary_port' get filled with peer's numerical
- ip address and port number whenever an outgoing connection is
- *attempted* from the primary socket to a remote address. When more
- than one address is tried for a connection these will hold data
+ /* 'primary' and 'secondary' get filled with IP quadruple
+ (local/remote numerical ip address and port) whenever a is *attempted*.
+ When more than one address is tried for a connection these will hold data
for the last attempt. When the connection is actually established
these are updated with data which comes directly from the socket. */
-
- char primary_ip[MAX_IPADR_LEN];
+ struct ip_quadruple primary;
+ struct ip_quadruple secondary;
char *user; /* user name string, allocated */
char *passwd; /* password string, allocated */
char *options; /* options string, allocated */
@@ -990,14 +887,17 @@ struct connectdata {
#endif /* however, some of them are ftp specific. */
struct Curl_llist easyq; /* List of easy handles using this connection */
- curl_seek_callback seek_func; /* function that seeks the input */
- void *seek_client; /* pointer to pass to the seek() above */
/*************** Request - specific items ************/
#if defined(USE_WINDOWS_SSPI) && defined(SECPKG_ATTR_ENDPOINT_BINDINGS)
CtxtHandle *sslContext;
#endif
+#if defined(_WIN32) && defined(USE_WINSOCK)
+ struct curltime last_sndbuf_update; /* last time readwrite_upload called
+ win_update_buffer_size */
+#endif
+
#ifdef USE_GSASL
struct gsasldata gsasl;
#endif
@@ -1080,7 +980,6 @@ struct connectdata {
int socks5_gssapi_enctype;
#endif
/* The field below gets set in connect.c:connecthost() */
- int port; /* which port to use locally - to connect to */
int remote_port; /* the remote port, not the proxy port! */
int conn_to_port; /* the remote port to connect to. valid only if
bits.conn_to_port is set */
@@ -1135,22 +1034,16 @@ struct PureInfo {
curl_off_t retry_after; /* info from Retry-After: header */
unsigned int header_size; /* size of read header(s) in bytes */
- /* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip'
- and, 'conn_local_port' are copied over from the connectdata struct in
- order to allow curl_easy_getinfo() to return this information even when
- the session handle is no longer associated with a connection, and also
- allow curl_easy_reset() to clear this information from the session handle
- without disturbing information which is still alive, and that might be
- reused, in the connection cache. */
-
- char conn_primary_ip[MAX_IPADR_LEN];
- int conn_primary_port; /* this is the destination port to the connection,
- which might have been a proxy */
+ /* PureInfo primary ip_quadruple is copied over from the connectdata
+ struct in order to allow curl_easy_getinfo() to return this information
+ even when the session handle is no longer associated with a connection,
+ and also allow curl_easy_reset() to clear this information from the
+ session handle without disturbing information which is still alive, and
+ that might be reused, in the connection cache. */
+ struct ip_quadruple primary;
int conn_remote_port; /* this is the "remote port", which is the port
number of the used URL, independent of proxy or
not */
- char conn_local_ip[MAX_IPADR_LEN];
- int conn_local_port;
const char *conn_scheme;
unsigned int conn_protocol;
struct curl_certinfo certs; /* info about the certs. Asked for with
@@ -1158,6 +1051,7 @@ struct PureInfo {
CURLproxycode pxcode;
BIT(timecond); /* set to TRUE if the time condition didn't match, which
thus made the document NOT get fetched */
+ BIT(used_proxy); /* the transfer used a proxy */
};
@@ -1263,18 +1157,6 @@ struct Curl_data_priority {
#endif
};
-/*
- * This struct is for holding data that was attempted to get sent to the user's
- * callback but is held due to pausing. One instance per type (BOTH, HEADER,
- * BODY).
- */
-struct tempbuf {
- struct dynbuf b;
- int type; /* type of the 'tempwrite' buffer as a bitmask that is used with
- Curl_client_write() */
- BIT(paused_body); /* if PAUSE happened before/during BODY write */
-};
-
/* Timers */
typedef enum {
EXPIRE_100_TIMEOUT,
@@ -1337,8 +1219,6 @@ struct UrlState {
struct dynbuf headerb; /* buffer to store headers in */
struct curl_slist *hstslist; /* list of HSTS files set by
curl_easy_setopt(HSTS) calls */
- char *buffer; /* download buffer */
- char *ulbuf; /* allocated upload buffer or NULL */
curl_off_t current_speed; /* the ProgressShow() function sets this,
bytes / second */
@@ -1353,8 +1233,6 @@ struct UrlState {
int retrycount; /* number of retries on a new connection */
struct Curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
long sessionage; /* number of the most recent session */
- struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */
- unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
int os_errno; /* filled in with errno whenever an error occurs */
char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
long followlocation; /* redirect counter */
@@ -1387,8 +1265,6 @@ struct UrlState {
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__EMX__)
/* do FTP line-end conversions on most platforms */
#define CURL_DO_LINEEND_CONV
- /* for FTP downloads: track CRLF sequences that span blocks */
- BIT(prev_block_had_trailing_cr);
/* for FTP downloads: how many CRLFs did we converted to LFs? */
curl_off_t crlf_conversions;
#endif
@@ -1422,8 +1298,10 @@ struct UrlState {
this should be dealt with in pretransfer */
#ifndef CURL_DISABLE_HTTP
curl_mimepart *mimepost;
+#ifndef CURL_DISABLE_FORM_API
curl_mimepart *formp; /* storage for old API form-posting, allocated on
demand */
+#endif
size_t trailers_bytes_sent;
struct dynbuf trailers_buf; /* a buffer containing the compiled trailing
headers */
@@ -1442,6 +1320,10 @@ struct UrlState {
CURLcode hresult; /* used to pass return codes back from hyper callbacks */
#endif
+#ifndef CURL_DISABLE_VERBOSE_STRINGS
+ struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */
+#endif
+
/* Dynamically allocated strings, MUST be freed before this struct is
killed. */
struct dynamically_allocated_data {
@@ -1490,7 +1372,6 @@ struct UrlState {
BIT(authproblem); /* TRUE if there's some problem authenticating */
/* set after initial USER failure, to prevent an authentication loop */
BIT(wildcardmatch); /* enable wildcard matching */
- BIT(expect100header); /* TRUE if we added Expect: 100-continue */
BIT(disableexpect); /* TRUE if Expect: is disabled due to a previous
417 response */
BIT(use_range);
@@ -1509,9 +1390,6 @@ struct UrlState {
BIT(url_alloc); /* URL string is malloc()'ed */
BIT(referer_alloc); /* referer string is malloc()ed */
BIT(wildcard_resolve); /* Set to true if any resolve change is a wildcard */
- BIT(rewindbeforesend);/* TRUE when the sending couldn't be stopped even
- though it will be discarded. We must call the data
- rewind callback before trying to send again. */
BIT(upload); /* upload request */
BIT(internal); /* internal: true if this easy handle was created for
internal use and the user does not have ownership of the
@@ -1720,7 +1598,9 @@ struct UserDefined {
curl_off_t set_resume_from; /* continue [ftp] transfer from here */
struct curl_slist *headers; /* linked list of extra headers */
struct curl_httppost *httppost; /* linked list of old POST data */
+#if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API)
curl_mimepart mimepost; /* MIME/POST data. */
+#endif
#ifndef CURL_DISABLE_TELNET
struct curl_slist *telnet_options; /* linked list of telnet options */
#endif
@@ -1933,6 +1813,12 @@ struct UserDefined {
#endif
};
+#ifndef CURL_DISABLE_MIME
+#define IS_MIME_POST(a) ((a)->set.mimepost.kind != MIMEKIND_NONE)
+#else
+#define IS_MIME_POST(a) FALSE
+#endif
+
struct Names {
struct Curl_hash *hostcache;
enum {
diff --git a/Utilities/cmcurl/lib/vauth/digest.c b/Utilities/cmcurl/lib/vauth/digest.c
index 416da0f..358bfb6 100644
--- a/Utilities/cmcurl/lib/vauth/digest.c
+++ b/Utilities/cmcurl/lib/vauth/digest.c
@@ -38,6 +38,7 @@
#include "curl_hmac.h"
#include "curl_md5.h"
#include "curl_sha256.h"
+#include "curl_sha512_256.h"
#include "vtls/vtls.h"
#include "warnless.h"
#include "strtok.h"
@@ -150,7 +151,7 @@ static void auth_digest_md5_to_ascii(unsigned char *source, /* 16 bytes */
msnprintf((char *) &dest[i * 2], 3, "%02x", source[i]);
}
-/* Convert sha256 chunk to RFC7616 -suitable ascii string */
+/* Convert sha256 or SHA-512/256 chunk to RFC7616 -suitable ascii string */
static void auth_digest_sha256_to_ascii(unsigned char *source, /* 32 bytes */
unsigned char *dest) /* 65 bytes */
{
@@ -601,10 +602,20 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
digest->algo = ALGO_SHA256;
else if(strcasecompare(content, "SHA-256-SESS"))
digest->algo = ALGO_SHA256SESS;
- else if(strcasecompare(content, "SHA-512-256"))
+ else if(strcasecompare(content, "SHA-512-256")) {
+#ifdef CURL_HAVE_SHA512_256
digest->algo = ALGO_SHA512_256;
- else if(strcasecompare(content, "SHA-512-256-SESS"))
+#else /* ! CURL_HAVE_SHA512_256 */
+ return CURLE_NOT_BUILT_IN;
+#endif /* ! CURL_HAVE_SHA512_256 */
+ }
+ else if(strcasecompare(content, "SHA-512-256-SESS")) {
+#ifdef CURL_HAVE_SHA512_256
digest->algo = ALGO_SHA512_256SESS;
+#else /* ! CURL_HAVE_SHA512_256 */
+ return CURLE_NOT_BUILT_IN;
+#endif /* ! CURL_HAVE_SHA512_256 */
+ }
else
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -717,8 +728,10 @@ static CURLcode auth_create_digest_http_message(
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ result = hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
+ if(result)
+ return result;
convert_to_ascii(hashbuf, (unsigned char *)userh);
}
@@ -738,8 +751,10 @@ static CURLcode auth_create_digest_http_message(
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ result = hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
+ if(result)
+ return result;
convert_to_ascii(hashbuf, ha1);
if(digest->algo & SESSION_ALGO) {
@@ -748,8 +763,10 @@ static CURLcode auth_create_digest_http_message(
if(!tmp)
return CURLE_OUT_OF_MEMORY;
- hash(hashbuf, (unsigned char *) tmp, strlen(tmp));
+ result = hash(hashbuf, (unsigned char *) tmp, strlen(tmp));
free(tmp);
+ if(result)
+ return result;
convert_to_ascii(hashbuf, ha1);
}
@@ -775,7 +792,11 @@ static CURLcode auth_create_digest_http_message(
char hashed[65];
char *hashthis2;
- hash(hashbuf, (const unsigned char *)"", 0);
+ result = hash(hashbuf, (const unsigned char *)"", 0);
+ if(result) {
+ free(hashthis);
+ return result;
+ }
convert_to_ascii(hashbuf, (unsigned char *)hashed);
hashthis2 = aprintf("%s:%s", hashthis, hashed);
@@ -786,8 +807,10 @@ static CURLcode auth_create_digest_http_message(
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ result = hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
+ if(result)
+ return result;
convert_to_ascii(hashbuf, ha2);
if(digest->qop) {
@@ -801,8 +824,10 @@ static CURLcode auth_create_digest_http_message(
if(!hashthis)
return CURLE_OUT_OF_MEMORY;
- hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
+ result = hash(hashbuf, (unsigned char *) hashthis, strlen(hashthis));
free(hashthis);
+ if(result)
+ return result;
convert_to_ascii(hashbuf, request_digest);
/* For test case 64 (snooped from a Mozilla 1.3a request)
@@ -957,12 +982,24 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
outptr, outlen,
auth_digest_md5_to_ascii,
Curl_md5it);
- DEBUGASSERT(digest->algo <= ALGO_SHA512_256SESS);
- return auth_create_digest_http_message(data, userp, passwdp,
- request, uripath, digest,
- outptr, outlen,
- auth_digest_sha256_to_ascii,
- Curl_sha256it);
+
+ if(digest->algo <= ALGO_SHA256SESS)
+ return auth_create_digest_http_message(data, userp, passwdp,
+ request, uripath, digest,
+ outptr, outlen,
+ auth_digest_sha256_to_ascii,
+ Curl_sha256it);
+#ifdef CURL_HAVE_SHA512_256
+ if(digest->algo <= ALGO_SHA512_256SESS)
+ return auth_create_digest_http_message(data, userp, passwdp,
+ request, uripath, digest,
+ outptr, outlen,
+ auth_digest_sha256_to_ascii,
+ Curl_sha512_256it);
+#endif /* CURL_HAVE_SHA512_256 */
+
+ /* Should be unreachable */
+ return CURLE_BAD_CONTENT_ENCODING;
}
/*
diff --git a/Utilities/cmcurl/lib/version.c b/Utilities/cmcurl/lib/version.c
index 34d4d7c..6d3a11a 100644
--- a/Utilities/cmcurl/lib/version.c
+++ b/Utilities/cmcurl/lib/version.c
@@ -212,9 +212,15 @@ char *curl_version(void)
#ifdef USE_LIBPSL
{
+#if defined(PSL_VERSION_MAJOR) && (PSL_VERSION_MAJOR > 0 || \
+ PSL_VERSION_MINOR >= 11)
int num = psl_check_version_number(0);
msnprintf(psl_version, sizeof(psl_version), "libpsl/%d.%d.%d",
num >> 16, (num >> 8) & 0xff, num & 0xff);
+#else
+ msnprintf(psl_version, sizeof(psl_version), "libpsl/%s",
+ psl_get_version());
+#endif
src[i++] = psl_version;
}
#endif
diff --git a/Utilities/cmcurl/lib/vquic/curl_msh3.c b/Utilities/cmcurl/lib/vquic/curl_msh3.c
index 7674bc1..a52bbdd 100644
--- a/Utilities/cmcurl/lib/vquic/curl_msh3.c
+++ b/Utilities/cmcurl/lib/vquic/curl_msh3.c
@@ -722,23 +722,6 @@ static bool cf_msh3_data_pending(struct Curl_cfilter *cf,
return pending;
}
-static void cf_msh3_active(struct Curl_cfilter *cf, struct Curl_easy *data)
-{
- struct cf_msh3_ctx *ctx = cf->ctx;
-
- /* use this socket from now on */
- cf->conn->sock[cf->sockindex] = ctx->sock[SP_LOCAL];
- /* the first socket info gets set at conn and data */
- if(cf->sockindex == FIRSTSOCKET) {
- cf->conn->remote_addr = &ctx->addr;
- #ifdef ENABLE_IPV6
- cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6)? TRUE : FALSE;
- #endif
- Curl_persistconninfo(data, cf->conn, ctx->l_ip, ctx->l_port);
- }
- ctx->active = TRUE;
-}
-
static CURLcode h3_data_pause(struct Curl_cfilter *cf,
struct Curl_easy *data,
bool pause)
@@ -785,10 +768,6 @@ static CURLcode cf_msh3_data_event(struct Curl_cfilter *cf,
}
}
break;
- case CF_CTRL_CONN_INFO_UPDATE:
- CURL_TRC_CF(data, cf, "req: update info");
- cf_msh3_active(cf, data);
- break;
default:
break;
}
diff --git a/Utilities/cmcurl/lib/vquic/curl_ngtcp2.c b/Utilities/cmcurl/lib/vquic/curl_ngtcp2.c
index a26b3e4..6b6b887 100644
--- a/Utilities/cmcurl/lib/vquic/curl_ngtcp2.c
+++ b/Utilities/cmcurl/lib/vquic/curl_ngtcp2.c
@@ -58,6 +58,7 @@
#include "http1.h"
#include "select.h"
#include "inet_pton.h"
+#include "transfer.h"
#include "vquic.h"
#include "vquic_int.h"
#include "vquic-tls.h"
@@ -145,11 +146,9 @@ struct cf_ngtcp2_ctx {
struct h3_stream_ctx {
int64_t id; /* HTTP/3 protocol identifier */
struct bufq sendbuf; /* h3 request body */
- struct bufq recvbuf; /* h3 response body */
struct h1_req_parser h1; /* h1 request parsing */
size_t sendbuf_len_in_flight; /* sendbuf amount "in flight" */
size_t upload_blocked_len; /* the amount written last and EGAINed */
- size_t recv_buf_nonflow; /* buffered bytes, not counting for flow control */
uint64_t error3; /* HTTP/3 stream error code */
curl_off_t upload_left; /* number of request bytes left to upload */
int status_code; /* HTTP status code */
@@ -190,11 +189,6 @@ static CURLcode h3_data_setup(struct Curl_cfilter *cf,
Curl_bufq_initp(&stream->sendbuf, &ctx->stream_bufcp,
H3_STREAM_SEND_CHUNKS, BUFQ_OPT_NONE);
stream->sendbuf_len_in_flight = 0;
- /* on recv, we need a flexible buffer limit since we also write
- * headers to it that are not counted against the nghttp3 flow limits. */
- Curl_bufq_initp(&stream->recvbuf, &ctx->stream_bufcp,
- H3_STREAM_RECV_CHUNKS, BUFQ_OPT_SOFT_LIMIT);
- stream->recv_buf_nonflow = 0;
Curl_h1_req_parse_init(&stream->h1, H1_PARSE_DEFAULT_MAX_LINE_LEN);
H3_STREAM_LCTX(data) = stream;
@@ -219,7 +213,6 @@ static void h3_data_done(struct Curl_cfilter *cf, struct Curl_easy *data)
}
Curl_bufq_free(&stream->sendbuf);
- Curl_bufq_free(&stream->recvbuf);
Curl_h1_req_parse_free(&stream->h1);
free(stream);
H3_STREAM_LCTX(data) = NULL;
@@ -387,36 +380,6 @@ static int cb_handshake_completed(ngtcp2_conn *tconn, void *user_data)
return 0;
}
-static void report_consumed_data(struct Curl_cfilter *cf,
- struct Curl_easy *data,
- size_t consumed)
-{
- struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
- struct cf_ngtcp2_ctx *ctx = cf->ctx;
-
- if(!stream)
- return;
- /* the HTTP/1.1 response headers are written to the buffer, but
- * consuming those does not count against flow control. */
- if(stream->recv_buf_nonflow) {
- if(consumed >= stream->recv_buf_nonflow) {
- consumed -= stream->recv_buf_nonflow;
- stream->recv_buf_nonflow = 0;
- }
- else {
- stream->recv_buf_nonflow -= consumed;
- consumed = 0;
- }
- }
- if(consumed > 0) {
- CURL_TRC_CF(data, cf, "[%" PRId64 "] ACK %zu bytes of DATA",
- stream->id, consumed);
- ngtcp2_conn_extend_max_stream_offset(ctx->qconn, stream->id,
- consumed);
- ngtcp2_conn_extend_max_offset(ctx->qconn, consumed);
- }
-}
-
static int cb_recv_stream_data(ngtcp2_conn *tconn, uint32_t flags,
int64_t stream_id, uint64_t offset,
const uint8_t *buf, size_t buflen,
@@ -796,46 +759,18 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id,
return 0;
}
-/*
- * write_resp_raw() copies response data in raw format to the `data`'s
- * receive buffer. If not enough space is available, it appends to the
- * `data`'s overflow buffer.
- */
-static CURLcode write_resp_raw(struct Curl_cfilter *cf,
- struct Curl_easy *data,
- const void *mem, size_t memlen,
- bool flow)
+static CURLcode write_resp_hds(struct Curl_easy *data,
+ const char *buf, size_t blen)
{
- struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
- CURLcode result = CURLE_OK;
- ssize_t nwritten;
-
- (void)cf;
- if(!stream) {
- return CURLE_RECV_ERROR;
- }
- nwritten = Curl_bufq_write(&stream->recvbuf, mem, memlen, &result);
- if(nwritten < 0) {
- return result;
- }
-
- if(!flow)
- stream->recv_buf_nonflow += (size_t)nwritten;
-
- if((size_t)nwritten < memlen) {
- /* This MUST not happen. Our recbuf is dimensioned to hold the
- * full max_stream_window and then some for this very reason. */
- DEBUGASSERT(0);
- return CURLE_RECV_ERROR;
- }
- return result;
+ return Curl_xfer_write_resp(data, (char *)buf, blen, FALSE);
}
static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream3_id,
- const uint8_t *buf, size_t buflen,
+ const uint8_t *buf, size_t blen,
void *user_data, void *stream_user_data)
{
struct Curl_cfilter *cf = user_data;
+ struct cf_ngtcp2_ctx *ctx = cf->ctx;
struct Curl_easy *data = stream_user_data;
struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
CURLcode result;
@@ -846,14 +781,19 @@ static int cb_h3_recv_data(nghttp3_conn *conn, int64_t stream3_id,
if(!stream)
return NGHTTP3_ERR_CALLBACK_FAILURE;
- result = write_resp_raw(cf, data, buf, buflen, TRUE);
+ result = Curl_xfer_write_resp(data, (char *)buf, blen, FALSE);
if(result) {
CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu, ERROR receiving %d",
- stream->id, buflen, result);
+ stream->id, blen, result);
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
- CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu", stream->id, buflen);
- h3_drain_stream(cf, data);
+ if(blen) {
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] ACK %zu bytes of DATA",
+ stream->id, blen);
+ ngtcp2_conn_extend_max_stream_offset(ctx->qconn, stream->id, blen);
+ ngtcp2_conn_extend_max_offset(ctx->qconn, blen);
+ }
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu", stream->id, blen);
return 0;
}
@@ -888,7 +828,7 @@ static int cb_h3_end_headers(nghttp3_conn *conn, int64_t stream_id,
if(!stream)
return 0;
/* add a CRLF only if we've received some headers */
- result = write_resp_raw(cf, data, "\r\n", 2, FALSE);
+ result = write_resp_hds(data, "\r\n", 2);
if(result) {
return -1;
}
@@ -934,7 +874,7 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
ncopy = msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
stream->status_code);
CURL_TRC_CF(data, cf, "[%" PRId64 "] status: %s", stream_id, line);
- result = write_resp_raw(cf, data, line, ncopy, FALSE);
+ result = write_resp_hds(data, line, ncopy);
if(result) {
return -1;
}
@@ -944,19 +884,19 @@ static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
CURL_TRC_CF(data, cf, "[%" PRId64 "] header: %.*s: %.*s",
stream_id, (int)h3name.len, h3name.base,
(int)h3val.len, h3val.base);
- result = write_resp_raw(cf, data, h3name.base, h3name.len, FALSE);
+ result = write_resp_hds(data, (const char *)h3name.base, h3name.len);
if(result) {
return -1;
}
- result = write_resp_raw(cf, data, ": ", 2, FALSE);
+ result = write_resp_hds(data, ": ", 2);
if(result) {
return -1;
}
- result = write_resp_raw(cf, data, h3val.base, h3val.len, FALSE);
+ result = write_resp_hds(data, (const char *)h3val.base, h3val.len);
if(result) {
return -1;
}
- result = write_resp_raw(cf, data, "\r\n", 2, FALSE);
+ result = write_resp_hds(data, "\r\n", 2);
if(result) {
return -1;
}
@@ -1092,7 +1032,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->id);
- *err = stream->resp_hds_complete? CURLE_PARTIAL_FILE : CURLE_HTTP3;
+ *err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
goto out;
}
else if(!stream->resp_hds_complete) {
@@ -1112,7 +1052,7 @@ out:
/* incoming data frames on the h3 stream */
static ssize_t cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
- char *buf, size_t len, CURLcode *err)
+ char *buf, size_t blen, CURLcode *err)
{
struct cf_ngtcp2_ctx *ctx = cf->ctx;
struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
@@ -1121,6 +1061,7 @@ static ssize_t cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
struct pkt_io_ctx pktx;
(void)ctx;
+ (void)buf;
CF_DATA_SAVE(save, cf, data);
DEBUGASSERT(cf->connected);
@@ -1136,46 +1077,18 @@ static ssize_t cf_ngtcp2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
goto out;
}
- if(!Curl_bufq_is_empty(&stream->recvbuf)) {
- nread = Curl_bufq_read(&stream->recvbuf,
- (unsigned char *)buf, len, err);
- if(nread < 0) {
- CURL_TRC_CF(data, cf, "[%" PRId64 "] read recvbuf(len=%zu) "
- "-> %zd, %d", stream->id, len, nread, *err);
- goto out;
- }
- report_consumed_data(cf, data, nread);
- }
-
if(cf_progress_ingress(cf, data, &pktx)) {
*err = CURLE_RECV_ERROR;
nread = -1;
goto out;
}
- /* recvbuf had nothing before, maybe after progressing ingress? */
- if(nread < 0 && !Curl_bufq_is_empty(&stream->recvbuf)) {
- nread = Curl_bufq_read(&stream->recvbuf,
- (unsigned char *)buf, len, err);
- if(nread < 0) {
- CURL_TRC_CF(data, cf, "[%" PRId64 "] read recvbuf(len=%zu) "
- "-> %zd, %d", stream->id, len, nread, *err);
- goto out;
- }
- report_consumed_data(cf, data, nread);
- }
-
- if(nread > 0) {
- h3_drain_stream(cf, data);
- }
- else {
- if(stream->closed) {
- nread = recv_closed_stream(cf, data, stream, err);
- goto out;
- }
- *err = CURLE_AGAIN;
- nread = -1;
+ if(stream->closed) {
+ nread = recv_closed_stream(cf, data, stream, err);
+ goto out;
}
+ *err = CURLE_AGAIN;
+ nread = -1;
out:
if(cf_progress_egress(cf, data, &pktx)) {
@@ -1189,8 +1102,8 @@ out:
nread = -1;
}
}
- CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_recv(len=%zu) -> %zd, %d",
- stream? stream->id : -1, len, nread, *err);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_recv(blen=%zu) -> %zd, %d",
+ stream? stream->id : -1, blen, nread, *err);
CF_DATA_RESTORE(cf, save);
return nread;
}
@@ -1593,7 +1506,6 @@ static CURLcode cf_progress_ingress(struct Curl_cfilter *cf,
struct cf_ngtcp2_ctx *ctx = cf->ctx;
struct pkt_io_ctx local_pktx;
size_t pkts_chunk = 128, i;
- size_t pkts_max = 10 * pkts_chunk;
CURLcode result = CURLE_OK;
if(!pktx) {
@@ -1608,17 +1520,13 @@ static CURLcode cf_progress_ingress(struct Curl_cfilter *cf,
if(result)
return result;
- for(i = 0; i < pkts_max; i += pkts_chunk) {
+ for(i = 0; i < 4; ++i) {
+ if(i)
+ pktx_update_time(pktx, cf);
pktx->pkt_count = 0;
result = vquic_recv_packets(cf, data, &ctx->q, pkts_chunk,
recv_pkt, pktx);
- if(result) /* error */
- break;
- if(pktx->pkt_count < pkts_chunk) /* got less than we could */
- break;
- /* give egress a chance before we receive more */
- result = cf_progress_egress(cf, data, pktx);
- if(result) /* error */
+ if(result || !pktx->pkt_count) /* error or got nothing */
break;
}
return result;
@@ -1769,7 +1677,7 @@ static CURLcode cf_progress_egress(struct Curl_cfilter *cf,
}
/* In UDP, there is a maximum theoretical packet paload length and
- * a minimum payload length that is "guarantueed" to work.
+ * a minimum payload length that is "guaranteed" to work.
* To detect if this minimum payload can be increased, ngtcp2 sends
* now and then a packet payload larger than the minimum. It that
* is ACKed by the peer, both parties know that it works and
@@ -1857,9 +1765,9 @@ out:
static bool cf_ngtcp2_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data)
{
- const struct h3_stream_ctx *stream = H3_STREAM_CTX(data);
(void)cf;
- return stream && !Curl_bufq_is_empty(&stream->recvbuf);
+ (void)data;
+ return FALSE;
}
static CURLcode h3_data_pause(struct Curl_cfilter *cf,
@@ -2070,8 +1978,7 @@ static CURLcode cf_connect_start(struct Curl_cfilter *cf,
if(result)
return result;
- Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd,
- &sockaddr, NULL, NULL, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd, &sockaddr, NULL);
if(!sockaddr)
return CURLE_QUIC_CONNECT_ERROR;
ctx->q.local_addrlen = sizeof(ctx->q.local_addr);
@@ -2186,13 +2093,11 @@ out:
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(result) {
- const char *r_ip = NULL;
- int r_port = 0;
+ struct ip_quadruple ip;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
infof(data, "QUIC connect to %s port %u failed: %s",
- r_ip, r_port, curl_easy_strerror(result));
+ ip.remote_ip, ip.remote_port, curl_easy_strerror(result));
}
#endif
if(!result && ctx->qconn) {
diff --git a/Utilities/cmcurl/lib/vquic/curl_osslq.c b/Utilities/cmcurl/lib/vquic/curl_osslq.c
index c499a00..1d53e2c 100644
--- a/Utilities/cmcurl/lib/vquic/curl_osslq.c
+++ b/Utilities/cmcurl/lib/vquic/curl_osslq.c
@@ -67,7 +67,7 @@
* Chunk size is large enough to take a full DATA frame */
#define H3_STREAM_WINDOW_SIZE (128 * 1024)
#define H3_STREAM_CHUNK_SIZE (16 * 1024)
-/* The pool keeps spares around and half of a full stream windows
+/* The pool keeps spares around and half of a full stream window
* seems good. More does not seem to improve performance.
* The benefit of the pool is that stream buffer to not keep
* spares. So memory consumption goes down when streams run empty,
@@ -100,7 +100,7 @@ typedef unsigned long sslerr_t;
static CURLcode cf_progress_ingress(struct Curl_cfilter *cf,
struct Curl_easy *data);
-static const char *SSL_ERROR_to_str(int err)
+static const char *osslq_SSL_ERROR_to_str(int err)
{
switch(err) {
case SSL_ERROR_NONE:
@@ -139,7 +139,7 @@ static const char *SSL_ERROR_to_str(int err)
}
/* Return error string for last OpenSSL error */
-static char *ossl_strerror(unsigned long error, char *buf, size_t size)
+static char *osslq_strerror(unsigned long error, char *buf, size_t size)
{
DEBUGASSERT(size);
*buf = '\0';
@@ -381,8 +381,8 @@ static CURLcode cf_osslq_h3conn_add_stream(struct cf_osslq_h3conn *h3,
}
static CURLcode cf_osslq_ssl_err(struct Curl_cfilter *cf,
- struct Curl_easy *data,
- int detail, CURLcode def_result)
+ struct Curl_easy *data,
+ int detail, CURLcode def_result)
{
struct cf_osslq_ctx *ctx = cf->ctx;
CURLcode result = def_result;
@@ -421,17 +421,17 @@ static CURLcode cf_osslq_ssl_err(struct Curl_cfilter *cf,
/* If client certificate is required, communicate the
error to client */
result = CURLE_SSL_CLIENTCERT;
- ossl_strerror(errdetail, ebuf, sizeof(ebuf));
+ osslq_strerror(errdetail, ebuf, sizeof(ebuf));
}
#endif
else if((lib == ERR_LIB_SSL) && (reason == SSL_R_PROTOCOL_IS_SHUTDOWN)) {
ctx->protocol_shutdown = TRUE;
- err_descr = "QUIC connectin has been shut down";
+ err_descr = "QUIC connection has been shut down";
result = def_result;
}
else {
result = def_result;
- ossl_strerror(errdetail, ebuf, sizeof(ebuf));
+ osslq_strerror(errdetail, ebuf, sizeof(ebuf));
}
/* detail is already set to the SSL error above */
@@ -443,16 +443,14 @@ static CURLcode cf_osslq_ssl_err(struct Curl_cfilter *cf,
if(CURLE_SSL_CONNECT_ERROR == result && errdetail == 0) {
char extramsg[80]="";
int sockerr = SOCKERRNO;
- const char *r_ip = NULL;
- int r_port = 0;
+ struct ip_quadruple ip;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
if(sockerr && detail == SSL_ERROR_SYSCALL)
Curl_strerror(sockerr, extramsg, sizeof(extramsg));
failf(data, "QUIC connect: %s in connection to %s:%d (%s)",
- extramsg[0] ? extramsg : SSL_ERROR_to_str(detail),
- ctx->peer.dispname, r_port, r_ip);
+ extramsg[0] ? extramsg : osslq_SSL_ERROR_to_str(detail),
+ ctx->peer.dispname, ip.remote_port, ip.remote_ip);
}
else {
/* Could be a CERT problem */
@@ -976,7 +974,7 @@ static nghttp3_callbacks ngh3_callbacks = {
};
static CURLcode cf_osslq_h3conn_init(struct cf_osslq_ctx *ctx, SSL *conn,
- void *user_data)
+ void *user_data)
{
struct cf_osslq_h3conn *h3 = &ctx->h3;
CURLcode result;
@@ -1039,7 +1037,6 @@ static CURLcode cf_osslq_ctx_start(struct Curl_cfilter *cf,
CURLcode result;
int rv;
const struct Curl_sockaddr_ex *peer_addr = NULL;
- int peer_port;
BIO *bio = NULL;
BIO_ADDR *baddr = NULL;
@@ -1061,8 +1058,7 @@ static CURLcode cf_osslq_ctx_start(struct Curl_cfilter *cf,
goto out;
result = CURLE_QUIC_CONNECT_ERROR;
- Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd,
- &peer_addr, NULL, &peer_port, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd, &peer_addr, NULL);
if(!peer_addr)
goto out;
@@ -1078,7 +1074,20 @@ static CURLcode cf_osslq_ctx_start(struct Curl_cfilter *cf,
goto out;
}
+ /* Type conversions, see #12861: OpenSSL wants an `int`, but on 64-bit
+ * Win32 systems, Microsoft defines SOCKET as `unsigned long long`.
+ */
+#if defined(_WIN32) && !defined(__LWIP_OPT_H__) && !defined(LWIP_HDR_OPT_H)
+ if(ctx->q.sockfd > INT_MAX) {
+ failf(data, "Windows socket identifier larger than MAX_INT, "
+ "unable to set in OpenSSL dgram API.");
+ result = CURLE_QUIC_CONNECT_ERROR;
+ goto out;
+ }
+ bio = BIO_new_dgram((int)ctx->q.sockfd, BIO_NOCLOSE);
+#else
bio = BIO_new_dgram(ctx->q.sockfd, BIO_NOCLOSE);
+#endif
if(!bio) {
result = CURLE_OUT_OF_MEMORY;
goto out;
@@ -1095,6 +1104,16 @@ static CURLcode cf_osslq_ctx_start(struct Curl_cfilter *cf,
goto out;
}
+#ifdef SSL_VALUE_QUIC_IDLE_TIMEOUT
+ /* Added in OpenSSL v3.3.x */
+ if(!SSL_set_feature_request_uint(ctx->tls.ssl, SSL_VALUE_QUIC_IDLE_TIMEOUT,
+ CURL_QUIC_MAX_IDLE_MS)) {
+ CURL_TRC_CF(data, cf, "error setting idle timeout, ");
+ result = CURLE_FAILED_INIT;
+ goto out;
+ }
+#endif
+
SSL_set_bio(ctx->tls.ssl, bio, bio);
bio = NULL;
SSL_set_connect_state(ctx->tls.ssl);
@@ -1146,7 +1165,7 @@ static ssize_t h3_quic_recv(void *reader_ctx,
SSL_get_stream_read_error_code(x->s->ssl, &app_error_code);
CURL_TRC_CF(x->data, x->cf, "[%" PRId64 "] h3_quic_recv -> RESET, "
"rv=%d, app_err=%" PRIu64,
- x->s->id, rv, app_error_code);
+ x->s->id, rv, app_error_code);
if(app_error_code != NGHTTP3_H3_NO_ERROR) {
x->s->reset = TRUE;
}
@@ -1361,7 +1380,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
size_t written;
int eos, ok, rv;
size_t total_len, acked_len = 0;
- bool blocked = FALSE;
+ bool blocked = FALSE, eos_written = FALSE;
n = nghttp3_conn_writev_stream(ctx->h3.conn, &stream_id, &eos,
vec, ARRAYSIZE(vec));
@@ -1392,9 +1411,19 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
for(i = 0; (i < n) && !blocked; ++i) {
/* Without stream->s.ssl, we closed that already, so
* pretend the write did succeed. */
+#ifdef SSL_WRITE_FLAG_CONCLUDE
+ /* Since OpenSSL v3.3.x, on last chunk set EOS if needed */
+ uint64_t flags = (eos && ((i + 1) == n))? SSL_WRITE_FLAG_CONCLUDE : 0;
+ written = vec[i].len;
+ ok = !s->ssl || SSL_write_ex2(s->ssl, vec[i].base, vec[i].len, flags,
+ &written);
+ if(ok && flags & SSL_WRITE_FLAG_CONCLUDE)
+ eos_written = TRUE;
+#else
written = vec[i].len;
ok = !s->ssl || SSL_write_ex(s->ssl, vec[i].base, vec[i].len,
&written);
+#endif
if(ok) {
/* As OpenSSL buffers the data, we count this as acknowledged
* from nghttp3's point of view */
@@ -1409,7 +1438,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
case SSL_ERROR_WANT_READ:
/* QUIC blocked us from writing more */
CURL_TRC_CF(data, cf, "[%"PRId64"] send %zu bytes to QUIC blocked",
- s->id, vec[i].len);
+ s->id, vec[i].len);
written = 0;
nghttp3_conn_block_stream(ctx->h3.conn, s->id);
s->send_blocked = blocked = TRUE;
@@ -1426,6 +1455,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
if(acked_len > 0 || (eos && !s->send_blocked)) {
/* Since QUIC buffers the data written internally, we can tell
* nghttp3 that it can move forward on it */
+ ctx->q.last_io = Curl_now();
rv = nghttp3_conn_add_write_offset(ctx->h3.conn, s->id, acked_len);
if(rv && rv != NGHTTP3_ERR_STREAM_NOT_FOUND) {
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
@@ -1444,7 +1474,7 @@ static CURLcode h3_send_streams(struct Curl_cfilter *cf,
"to QUIC, eos=%d", s->id, acked_len, total_len, eos);
}
- if(eos && !s->send_blocked) {
+ if(eos && !s->send_blocked && !eos_written) {
/* wrote everything and H3 indicates end of stream */
CURL_TRC_CF(data, cf, "[%" PRId64 "] closing QUIC stream", s->id);
SSL_stream_conclude(s->ssl, 0);
@@ -1569,6 +1599,7 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf,
if(err == 1) {
/* connected */
ctx->handshake_at = now;
+ ctx->q.last_io = now;
CURL_TRC_CF(data, cf, "handshake complete after %dms",
(int)Curl_timediff(now, ctx->started_at));
result = cf_osslq_verify_peer(cf, data);
@@ -1584,15 +1615,18 @@ static CURLcode cf_osslq_connect(struct Curl_cfilter *cf,
int detail = SSL_get_error(ctx->tls.ssl, err);
switch(detail) {
case SSL_ERROR_WANT_READ:
+ ctx->q.last_io = now;
CURL_TRC_CF(data, cf, "QUIC SSL_connect() -> WANT_RECV");
result = Curl_vquic_tls_before_recv(&ctx->tls, cf, data);
goto out;
case SSL_ERROR_WANT_WRITE:
+ ctx->q.last_io = now;
CURL_TRC_CF(data, cf, "QUIC SSL_connect() -> WANT_SEND");
result = CURLE_OK;
goto out;
#ifdef SSL_ERROR_WANT_ASYNC
case SSL_ERROR_WANT_ASYNC:
+ ctx->q.last_io = now;
CURL_TRC_CF(data, cf, "QUIC SSL_connect() -> WANT_ASYNC");
result = CURLE_OK;
goto out;
@@ -1619,13 +1653,11 @@ out:
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(result) {
- const char *r_ip = NULL;
- int r_port = 0;
+ struct ip_quadruple ip;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
infof(data, "QUIC connect to %s port %u failed: %s",
- r_ip, r_port, curl_easy_strerror(result));
+ ip.remote_ip, ip.remote_port, curl_easy_strerror(result));
}
#endif
if(!result)
@@ -1885,7 +1917,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->s.id);
- *err = stream->resp_hds_complete? CURLE_PARTIAL_FILE : CURLE_HTTP3;
+ *err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
goto out;
}
else if(!stream->resp_hds_complete) {
@@ -2055,7 +2087,24 @@ static bool cf_osslq_conn_is_alive(struct Curl_cfilter *cf,
if(!ctx->tls.ssl)
goto out;
- /* TODO: how to check negotiated connection idle time? */
+#ifdef SSL_VALUE_QUIC_IDLE_TIMEOUT
+ /* Added in OpenSSL v3.3.x */
+ {
+ timediff_t idletime;
+ uint64_t idle_ms = ctx->max_idle_ms;
+ if(!SSL_get_value_uint(ctx->tls.ssl, SSL_VALUE_CLASS_FEATURE_NEGOTIATED,
+ SSL_VALUE_QUIC_IDLE_TIMEOUT, &idle_ms)) {
+ CURL_TRC_CF(data, cf, "error getting negotiated idle timeout, "
+ "assume connection is dead.");
+ goto out;
+ }
+ CURL_TRC_CF(data, cf, "negotiated idle timeout: %zums", (size_t)idle_ms);
+ idletime = Curl_timediff(Curl_now(), ctx->q.last_io);
+ if(idletime > 0 && (uint64_t)idletime > idle_ms)
+ goto out;
+ }
+
+#endif
if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending))
goto out;
@@ -2111,15 +2160,24 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
int query, int *pres1, void *pres2)
{
struct cf_osslq_ctx *ctx = cf->ctx;
- struct cf_call_data save;
switch(query) {
case CF_QUERY_MAX_CONCURRENT: {
- /* TODO: how to get this? */
- CF_DATA_SAVE(save, cf, data);
+#ifdef SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL
+ /* Added in OpenSSL v3.3.x */
+ uint64_t v;
+ if(!SSL_get_value_uint(ctx->tls.ssl, SSL_VALUE_CLASS_GENERIC,
+ SSL_VALUE_QUIC_STREAM_BIDI_LOCAL_AVAIL, &v)) {
+ CURL_TRC_CF(data, cf, "error getting available local bidi streams");
+ return CURLE_HTTP3;
+ }
+ /* we report avail + in_use */
+ v += CONN_INUSE(cf->conn);
+ *pres1 = (v > INT_MAX)? INT_MAX : (int)v;
+#else
*pres1 = 100;
+#endif
CURL_TRC_CF(data, cf, "query max_conncurrent -> %d", *pres1);
- CF_DATA_RESTORE(cf, save);
return CURLE_OK;
}
case CF_QUERY_CONNECT_REPLY_MS:
diff --git a/Utilities/cmcurl/lib/vquic/curl_quiche.c b/Utilities/cmcurl/lib/vquic/curl_quiche.c
index fcb0eb8..2ebc50c 100644
--- a/Utilities/cmcurl/lib/vquic/curl_quiche.c
+++ b/Utilities/cmcurl/lib/vquic/curl_quiche.c
@@ -732,7 +732,7 @@ static ssize_t recv_closed_stream(struct Curl_cfilter *cf,
if(stream->reset) {
failf(data,
"HTTP/3 stream %" PRId64 " reset by server", stream->id);
- *err = stream->resp_got_header? CURLE_PARTIAL_FILE : CURLE_HTTP3;
+ *err = data->req.bytecount? CURLE_PARTIAL_FILE : CURLE_HTTP3;
CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_recv, was reset -> %d",
stream->id, *err);
}
@@ -1243,8 +1243,7 @@ static CURLcode cf_connect_start(struct Curl_cfilter *cf,
if(result)
return result;
- Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd,
- &sockaddr, NULL, NULL, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, &ctx->q.sockfd, &sockaddr, NULL);
ctx->q.local_addrlen = sizeof(ctx->q.local_addr);
rv = getsockname(ctx->q.sockfd, (struct sockaddr *)&ctx->q.local_addr,
&ctx->q.local_addrlen);
@@ -1390,13 +1389,11 @@ static CURLcode cf_quiche_connect(struct Curl_cfilter *cf,
out:
#ifndef CURL_DISABLE_VERBOSE_STRINGS
if(result && result != CURLE_AGAIN) {
- const char *r_ip;
- int r_port;
+ struct ip_quadruple ip;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
infof(data, "connect to %s port %u failed: %s",
- r_ip, r_port, curl_easy_strerror(result));
+ ip.remote_ip, ip.remote_port, curl_easy_strerror(result));
}
#endif
return result;
diff --git a/Utilities/cmcurl/lib/vquic/vquic-tls.c b/Utilities/cmcurl/lib/vquic/vquic-tls.c
index cc7794e..ecba607 100644
--- a/Utilities/cmcurl/lib/vquic/vquic-tls.c
+++ b/Utilities/cmcurl/lib/vquic/vquic-tls.c
@@ -375,6 +375,7 @@ static CURLcode curl_wssl_init_ctx(struct quic_tls_ctx *ctx,
char error_buffer[256];
ERR_error_string_n(ERR_get_error(), error_buffer, sizeof(error_buffer));
failf(data, "wolfSSL failed to set ciphers: %s", error_buffer);
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
goto out;
}
@@ -382,6 +383,7 @@ static CURLcode curl_wssl_init_ctx(struct quic_tls_ctx *ctx,
conn_config->curves :
(char *)QUIC_GROUPS) != 1) {
failf(data, "wolfSSL failed to set curves");
+ result = CURLE_BAD_FUNCTION_ARGUMENT;
goto out;
}
@@ -392,6 +394,7 @@ static CURLcode curl_wssl_init_ctx(struct quic_tls_ctx *ctx,
wolfSSL_CTX_set_keylog_callback(ctx->ssl_ctx, keylog_callback);
#else
failf(data, "wolfSSL was built without keylog callback");
+ result = CURLE_NOT_BUILT_IN;
goto out;
#endif
}
@@ -414,6 +417,7 @@ static CURLcode curl_wssl_init_ctx(struct quic_tls_ctx *ctx,
" CAfile: %s CApath: %s",
ssl_cafile ? ssl_cafile : "none",
ssl_capath ? ssl_capath : "none");
+ result = CURLE_SSL_CACERT_BADFILE;
goto out;
}
infof(data, " CAfile: %s", ssl_cafile ? ssl_cafile : "none");
diff --git a/Utilities/cmcurl/lib/vquic/vquic.c b/Utilities/cmcurl/lib/vquic/vquic.c
index 612d25b..066caf9 100644
--- a/Utilities/cmcurl/lib/vquic/vquic.c
+++ b/Utilities/cmcurl/lib/vquic/vquic.c
@@ -370,12 +370,10 @@ static CURLcode recvmmsg_packets(struct Curl_cfilter *cf,
goto out;
}
if(!cf->connected && SOCKERRNO == ECONNREFUSED) {
- const char *r_ip = NULL;
- int r_port = 0;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ struct ip_quadruple ip;
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
failf(data, "QUIC: connection to %s port %u refused",
- r_ip, r_port);
+ ip.remote_ip, ip.remote_port);
result = CURLE_COULDNT_CONNECT;
goto out;
}
@@ -440,12 +438,10 @@ static CURLcode recvmsg_packets(struct Curl_cfilter *cf,
goto out;
}
if(!cf->connected && SOCKERRNO == ECONNREFUSED) {
- const char *r_ip = NULL;
- int r_port = 0;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ struct ip_quadruple ip;
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
failf(data, "QUIC: connection to %s port %u refused",
- r_ip, r_port);
+ ip.remote_ip, ip.remote_port);
result = CURLE_COULDNT_CONNECT;
goto out;
}
@@ -500,12 +496,10 @@ static CURLcode recvfrom_packets(struct Curl_cfilter *cf,
goto out;
}
if(!cf->connected && SOCKERRNO == ECONNREFUSED) {
- const char *r_ip = NULL;
- int r_port = 0;
- Curl_cf_socket_peek(cf->next, data, NULL, NULL,
- &r_ip, &r_port, NULL, NULL);
+ struct ip_quadruple ip;
+ Curl_cf_socket_peek(cf->next, data, NULL, NULL, &ip);
failf(data, "QUIC: connection to %s port %u refused",
- r_ip, r_port);
+ ip.remote_ip, ip.remote_port);
result = CURLE_COULDNT_CONNECT;
goto out;
}
diff --git a/Utilities/cmcurl/lib/vssh/libssh.c b/Utilities/cmcurl/lib/vssh/libssh.c
index c6dc63a..da7ce6a 100644
--- a/Utilities/cmcurl/lib/vssh/libssh.c
+++ b/Utilities/cmcurl/lib/vssh/libssh.c
@@ -1292,10 +1292,10 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
position. */
if(data->state.resume_from > 0) {
/* Let's read off the proper amount of bytes from the input. */
- if(conn->seek_func) {
+ if(data->set.seek_func) {
Curl_set_in_callback(data, true);
- seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
- SEEK_SET);
+ seekerr = data->set.seek_func(data->set.seek_client,
+ data->state.resume_from, SEEK_SET);
Curl_set_in_callback(data, false);
}
@@ -1349,9 +1349,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
/* upload data */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
/* store this original bitmask setup to use later on if we can't
@@ -1575,7 +1575,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
sshc->sftp_dir = NULL;
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
state(data, SSH_STOP);
break;
@@ -1665,6 +1665,8 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
size = 0;
}
else {
+ if((to - from) == CURL_OFF_T_MAX)
+ return CURLE_RANGE_ERROR;
size = to - from + 1;
}
@@ -1718,14 +1720,14 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
/* Setup the actual download */
if(data->req.size == 0) {
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
- Curl_setup_transfer(data, FIRSTSOCKET, data->req.size, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, data->req.size, FALSE, -1);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
/* we want to use the _receiving_ function even when the socket turns
@@ -1847,9 +1849,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
}
/* upload data */
- Curl_setup_transfer(data, -1, data->req.size, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, data->req.size, FALSE, FIRSTSOCKET);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
/* store this original bitmask setup to use later on if we can't
@@ -1891,9 +1893,9 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
/* download data */
bytecount = ssh_scp_request_get_size(sshc->scp_session);
data->req.maxdownload = (curl_off_t) bytecount;
- Curl_setup_transfer(data, FIRSTSOCKET, bytecount, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, bytecount, FALSE, -1);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
/* we want to use the _receiving_ function even when the socket turns
diff --git a/Utilities/cmcurl/lib/vssh/libssh2.c b/Utilities/cmcurl/lib/vssh/libssh2.c
index e9dfef9..3cfbe12 100644
--- a/Utilities/cmcurl/lib/vssh/libssh2.c
+++ b/Utilities/cmcurl/lib/vssh/libssh2.c
@@ -2142,10 +2142,10 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
position. */
if(data->state.resume_from > 0) {
/* Let's read off the proper amount of bytes from the input. */
- if(conn->seek_func) {
+ if(data->set.seek_func) {
Curl_set_in_callback(data, true);
- seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
- SEEK_SET);
+ seekerr = data->set.seek_func(data->set.seek_client,
+ data->state.resume_from, SEEK_SET);
Curl_set_in_callback(data, false);
}
@@ -2195,9 +2195,9 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
/* upload data */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
if(result) {
@@ -2448,7 +2448,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
Curl_safefree(sshp->readdir_longentry);
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
state(data, SSH_STOP);
break;
@@ -2544,6 +2544,8 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
size = 0;
}
else {
+ if((to - from) == CURL_OFF_T_MAX)
+ return CURLE_RANGE_ERROR;
size = to - from + 1;
}
@@ -2588,14 +2590,14 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
/* Setup the actual download */
if(data->req.size == 0) {
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
- Curl_setup_transfer(data, FIRSTSOCKET, data->req.size, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, data->req.size, FALSE, -1);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
/* we want to use the _receiving_ function even when the socket turns
@@ -2739,9 +2741,9 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
/* upload data */
data->req.size = data->state.infilesize;
Curl_pgrsSetUploadSize(data, data->state.infilesize);
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
if(result) {
@@ -2810,9 +2812,9 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
/* download data */
bytecount = (curl_off_t)sb.st_size;
data->req.maxdownload = (curl_off_t)sb.st_size;
- Curl_setup_transfer(data, FIRSTSOCKET, bytecount, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, bytecount, FALSE, -1);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
/* we want to use the _receiving_ function even when the socket turns
@@ -3191,12 +3193,13 @@ static ssize_t ssh_tls_recv(libssh2_socket_t sock, void *buffer,
struct connectdata *conn = data->conn;
Curl_recv *backup = conn->recv[0];
struct ssh_conn *ssh = &conn->proto.sshc;
+ int socknum = Curl_conn_sockindex(data, sock);
(void)flags;
/* swap in the TLS reader function for this call only, and then swap back
the SSH one again */
conn->recv[0] = ssh->tls_recv;
- result = Curl_read(data, sock, buffer, length, &nread);
+ result = Curl_conn_recv(data, socknum, buffer, length, &nread);
conn->recv[0] = backup;
if(result == CURLE_AGAIN)
return -EAGAIN; /* magic return code for libssh2 */
@@ -3210,24 +3213,25 @@ static ssize_t ssh_tls_send(libssh2_socket_t sock, const void *buffer,
size_t length, int flags, void **abstract)
{
struct Curl_easy *data = (struct Curl_easy *)*abstract;
- ssize_t nwrite;
+ size_t nwrite;
CURLcode result;
struct connectdata *conn = data->conn;
Curl_send *backup = conn->send[0];
struct ssh_conn *ssh = &conn->proto.sshc;
+ int socknum = Curl_conn_sockindex(data, sock);
(void)flags;
/* swap in the TLS writer function for this call only, and then swap back
the SSH one again */
conn->send[0] = ssh->tls_send;
- result = Curl_write(data, sock, buffer, length, &nwrite);
+ result = Curl_conn_send(data, socknum, buffer, length, &nwrite);
conn->send[0] = backup;
if(result == CURLE_AGAIN)
return -EAGAIN; /* magic return code for libssh2 */
else if(result)
return -1; /* error */
- Curl_debug(data, CURLINFO_DATA_OUT, (char *)buffer, (size_t)nwrite);
- return nwrite;
+ Curl_debug(data, CURLINFO_DATA_OUT, (char *)buffer, nwrite);
+ return (ssize_t)nwrite;
}
#endif
@@ -3268,7 +3272,7 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done)
#endif /* CURL_LIBSSH2_DEBUG */
/* libcurl MUST to set custom memory functions so that the kbd_callback
- funciton's memory allocations can be properled freed */
+ function's memory allocations can be properly freed */
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
my_libssh2_free,
my_libssh2_realloc, data);
diff --git a/Utilities/cmcurl/lib/vssh/wolfssh.c b/Utilities/cmcurl/lib/vssh/wolfssh.c
index 7396791c..1127591 100644
--- a/Utilities/cmcurl/lib/vssh/wolfssh.c
+++ b/Utilities/cmcurl/lib/vssh/wolfssh.c
@@ -625,10 +625,10 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
if(data->state.resume_from > 0) {
/* Let's read off the proper amount of bytes from the input. */
int seekerr = CURL_SEEKFUNC_OK;
- if(conn->seek_func) {
+ if(data->set.seek_func) {
Curl_set_in_callback(data, true);
- seekerr = conn->seek_func(conn->seek_client, data->state.resume_from,
- SEEK_SET);
+ seekerr = data->set.seek_func(data->set.seek_client,
+ data->state.resume_from, SEEK_SET);
Curl_set_in_callback(data, false);
}
@@ -678,9 +678,9 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
Curl_pgrsSetUploadSize(data, data->state.infilesize);
}
/* upload data */
- Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
+ Curl_xfer_setup(data, -1, -1, FALSE, FIRSTSOCKET);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->sockfd = conn->writesockfd;
if(result) {
@@ -778,14 +778,14 @@ static CURLcode wssh_statemach_act(struct Curl_easy *data, bool *block)
/* Setup the actual download */
if(data->req.size == 0) {
/* no data to transfer */
- Curl_setup_transfer(data, -1, -1, FALSE, -1);
+ Curl_xfer_setup(data, -1, -1, FALSE, -1);
infof(data, "File already completely downloaded");
state(data, SSH_STOP);
break;
}
- Curl_setup_transfer(data, FIRSTSOCKET, data->req.size, FALSE, -1);
+ Curl_xfer_setup(data, FIRSTSOCKET, data->req.size, FALSE, -1);
- /* not set by Curl_setup_transfer to preserve keepon bits */
+ /* not set by Curl_xfer_setup to preserve keepon bits */
conn->writesockfd = conn->sockfd;
/* we want to use the _receiving_ function even when the socket turns
diff --git a/Utilities/cmcurl/lib/vtls/bearssl.c b/Utilities/cmcurl/lib/vtls/bearssl.c
index 58394ba..16f9c4e 100644
--- a/Utilities/cmcurl/lib/vtls/bearssl.c
+++ b/Utilities/cmcurl/lib/vtls/bearssl.c
@@ -707,7 +707,7 @@ static CURLcode bearssl_connect_step1(struct Curl_cfilter *cf,
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, proto.data);
}
- if(connssl->peer.is_ip_address) {
+ if(connssl->peer.type != CURL_SSL_PEER_DNS) {
if(verifyhost) {
failf(data, "BearSSL: "
"host verification of IP address is not supported");
diff --git a/Utilities/cmcurl/lib/vtls/gtls.c b/Utilities/cmcurl/lib/vtls/gtls.c
index b95c5be..6eaa6a8 100644
--- a/Utilities/cmcurl/lib/vtls/gtls.c
+++ b/Utilities/cmcurl/lib/vtls/gtls.c
@@ -117,6 +117,8 @@ static ssize_t gtls_pull(void *s, void *buf, size_t blen)
(CURLE_AGAIN == result)? EAGAIN : EINVAL);
nread = -1;
}
+ else if(nread == 0)
+ connssl->peer_closed = TRUE;
return nread;
}
@@ -1489,7 +1491,7 @@ static int gtls_shutdown(struct Curl_cfilter *cf,
bool done = FALSE;
char buf[120];
- while(!done) {
+ while(!done && !connssl->peer_closed) {
int what = SOCKET_READABLE(Curl_conn_cf_get_socket(cf, data),
SSL_SHUTDOWN_TIMEOUT);
if(what > 0) {
diff --git a/Utilities/cmcurl/lib/vtls/mbedtls.c b/Utilities/cmcurl/lib/vtls/mbedtls.c
index 7d70de5..5f07e78 100644
--- a/Utilities/cmcurl/lib/vtls/mbedtls.c
+++ b/Utilities/cmcurl/lib/vtls/mbedtls.c
@@ -110,7 +110,8 @@ struct mbed_ssl_backend_data {
};
/* apply threading? */
-#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
+#if (defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \
+ defined(_WIN32)
#define THREADING_SUPPORT
#endif
@@ -123,7 +124,6 @@ static mbedtls_entropy_context ts_entropy;
static int entropy_init_initialized = 0;
-/* start of entropy_init_mutex() */
static void entropy_init_mutex(mbedtls_entropy_context *ctx)
{
/* lock 0 = entropy_init_mutex() */
@@ -134,9 +134,18 @@ static void entropy_init_mutex(mbedtls_entropy_context *ctx)
}
Curl_mbedtlsthreadlock_unlock_function(0);
}
-/* end of entropy_init_mutex() */
-/* start of entropy_func_mutex() */
+static void entropy_cleanup_mutex(mbedtls_entropy_context *ctx)
+{
+ /* lock 0 = use same lock as init */
+ Curl_mbedtlsthreadlock_lock_function(0);
+ if(entropy_init_initialized == 1) {
+ mbedtls_entropy_free(ctx);
+ entropy_init_initialized = 0;
+ }
+ Curl_mbedtlsthreadlock_unlock_function(0);
+}
+
static int entropy_func_mutex(void *data, unsigned char *output, size_t len)
{
int ret;
@@ -147,7 +156,6 @@ static int entropy_func_mutex(void *data, unsigned char *output, size_t len)
return ret;
}
-/* end of entropy_func_mutex() */
#endif /* THREADING_SUPPORT */
@@ -237,6 +245,23 @@ static const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_fr =
#define PUB_DER_MAX_BYTES (RSA_PUB_DER_MAX_BYTES > ECP_PUB_DER_MAX_BYTES ? \
RSA_PUB_DER_MAX_BYTES : ECP_PUB_DER_MAX_BYTES)
+#if MBEDTLS_VERSION_NUMBER >= 0x03020000
+static CURLcode mbedtls_version_from_curl(
+ mbedtls_ssl_protocol_version* mbedver, long version)
+{
+ switch(version) {
+ case CURL_SSLVERSION_TLSv1_0:
+ case CURL_SSLVERSION_TLSv1_1:
+ case CURL_SSLVERSION_TLSv1_2:
+ *mbedver = MBEDTLS_SSL_VERSION_TLS1_2;
+ return CURLE_OK;
+ case CURL_SSLVERSION_TLSv1_3:
+ break;
+ }
+
+ return CURLE_SSL_CONNECT_ERROR;
+}
+#else
static CURLcode mbedtls_version_from_curl(int *mbedver, long version)
{
#if MBEDTLS_VERSION_NUMBER >= 0x03000000
@@ -267,6 +292,7 @@ static CURLcode mbedtls_version_from_curl(int *mbedver, long version)
return CURLE_SSL_CONNECT_ERROR;
}
+#endif
static CURLcode
set_ssl_version_min_max(struct Curl_cfilter *cf, struct Curl_easy *data)
@@ -275,7 +301,10 @@ set_ssl_version_min_max(struct Curl_cfilter *cf, struct Curl_easy *data)
struct mbed_ssl_backend_data *backend =
(struct mbed_ssl_backend_data *)connssl->backend;
struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf);
-#if MBEDTLS_VERSION_NUMBER >= 0x03000000
+#if MBEDTLS_VERSION_NUMBER >= 0x03020000
+ mbedtls_ssl_protocol_version mbedtls_ver_min = MBEDTLS_SSL_VERSION_TLS1_2;
+ mbedtls_ssl_protocol_version mbedtls_ver_max = MBEDTLS_SSL_VERSION_TLS1_2;
+#elif MBEDTLS_VERSION_NUMBER >= 0x03000000
int mbedtls_ver_min = MBEDTLS_SSL_MINOR_VERSION_3;
int mbedtls_ver_max = MBEDTLS_SSL_MINOR_VERSION_3;
#else
@@ -313,10 +342,15 @@ set_ssl_version_min_max(struct Curl_cfilter *cf, struct Curl_easy *data)
return result;
}
+#if MBEDTLS_VERSION_NUMBER >= 0x03020000
+ mbedtls_ssl_conf_min_tls_version(&backend->config, mbedtls_ver_min);
+ mbedtls_ssl_conf_max_tls_version(&backend->config, mbedtls_ver_max);
+#else
mbedtls_ssl_conf_min_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
mbedtls_ver_min);
mbedtls_ssl_conf_max_version(&backend->config, MBEDTLS_SSL_MAJOR_VERSION_3,
mbedtls_ver_max);
+#endif
return result;
}
@@ -351,7 +385,6 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
}
#ifdef THREADING_SUPPORT
- entropy_init_mutex(&ts_entropy);
mbedtls_ctr_drbg_init(&backend->ctr_drbg);
ret = mbedtls_ctr_drbg_seed(&backend->ctr_drbg, entropy_func_mutex,
@@ -654,14 +687,13 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
&backend->clicert, &backend->pk);
}
- if(connssl->peer.sni) {
- if(mbedtls_ssl_set_hostname(&backend->ssl, connssl->peer.sni)) {
- /* mbedtls_ssl_set_hostname() sets the name to use in CN/SAN checks and
- the name to set in the SNI extension. So even if curl connects to a
- host specified as an IP address, this function must be used. */
- failf(data, "Failed to set SNI");
- return CURLE_SSL_CONNECT_ERROR;
- }
+ if(mbedtls_ssl_set_hostname(&backend->ssl, connssl->peer.sni?
+ connssl->peer.sni : connssl->peer.hostname)) {
+ /* mbedtls_ssl_set_hostname() sets the name to use in CN/SAN checks and
+ the name to set in the SNI extension. So even if curl connects to a
+ host specified as an IP address, this function must be used. */
+ failf(data, "Failed to set SNI");
+ return CURLE_SSL_CONNECT_ERROR;
}
#ifdef HAS_ALPN
@@ -775,6 +807,7 @@ mbed_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
peercert = mbedtls_ssl_get_peer_cert(&backend->ssl);
if(peercert && data->set.verbose) {
+#ifndef MBEDTLS_X509_REMOVE_INFO
const size_t bufsize = 16384;
char *buffer = malloc(bufsize);
@@ -787,6 +820,9 @@ mbed_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
infof(data, "Unable to dump certificate information");
free(buffer);
+#else
+ infof(data, "Unable to dump certificate information");
+#endif
}
if(pinnedpubkey) {
@@ -1216,14 +1252,19 @@ static CURLcode mbedtls_connect(struct Curl_cfilter *cf,
*/
static int mbedtls_init(void)
{
- return Curl_mbedtlsthreadlock_thread_setup();
+ if(!Curl_mbedtlsthreadlock_thread_setup())
+ return 0;
+#ifdef THREADING_SUPPORT
+ entropy_init_mutex(&ts_entropy);
+#endif
+ return 1;
}
static void mbedtls_cleanup(void)
{
#ifdef THREADING_SUPPORT
- mbedtls_entropy_free(&ts_entropy);
-#endif /* THREADING_SUPPORT */
+ entropy_cleanup_mutex(&ts_entropy);
+#endif
(void)Curl_mbedtlsthreadlock_thread_cleanup();
}
diff --git a/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.c b/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.c
index 22b1b22..b96a904 100644
--- a/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.c
+++ b/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.c
@@ -26,12 +26,12 @@
#if defined(USE_MBEDTLS) && \
((defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \
- defined(USE_THREADS_WIN32))
+ defined(_WIN32))
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
# include <pthread.h>
# define MBEDTLS_MUTEX_T pthread_mutex_t
-#elif defined(USE_THREADS_WIN32)
+#elif defined(_WIN32)
# define MBEDTLS_MUTEX_T HANDLE
#endif
@@ -59,7 +59,7 @@ int Curl_mbedtlsthreadlock_thread_setup(void)
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
if(pthread_mutex_init(&mutex_buf[i], NULL))
return 0; /* pthread_mutex_init failed */
-#elif defined(USE_THREADS_WIN32)
+#elif defined(_WIN32)
mutex_buf[i] = CreateMutex(0, FALSE, 0);
if(mutex_buf[i] == 0)
return 0; /* CreateMutex failed */
@@ -80,7 +80,7 @@ int Curl_mbedtlsthreadlock_thread_cleanup(void)
#if defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)
if(pthread_mutex_destroy(&mutex_buf[i]))
return 0; /* pthread_mutex_destroy failed */
-#elif defined(USE_THREADS_WIN32)
+#elif defined(_WIN32)
if(!CloseHandle(mutex_buf[i]))
return 0; /* CloseHandle failed */
#endif /* USE_THREADS_POSIX && HAVE_PTHREAD_H */
@@ -100,7 +100,7 @@ int Curl_mbedtlsthreadlock_lock_function(int n)
"Error: mbedtlsthreadlock_lock_function failed\n"));
return 0; /* pthread_mutex_lock failed */
}
-#elif defined(USE_THREADS_WIN32)
+#elif defined(_WIN32)
if(WaitForSingleObject(mutex_buf[n], INFINITE) == WAIT_FAILED) {
DEBUGF(fprintf(stderr,
"Error: mbedtlsthreadlock_lock_function failed\n"));
@@ -120,7 +120,7 @@ int Curl_mbedtlsthreadlock_unlock_function(int n)
"Error: mbedtlsthreadlock_unlock_function failed\n"));
return 0; /* pthread_mutex_unlock failed */
}
-#elif defined(USE_THREADS_WIN32)
+#elif defined(_WIN32)
if(!ReleaseMutex(mutex_buf[n])) {
DEBUGF(fprintf(stderr,
"Error: mbedtlsthreadlock_unlock_function failed\n"));
diff --git a/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.h b/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.h
index 2b0bd41..4846268 100644
--- a/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.h
+++ b/Utilities/cmcurl/lib/vtls/mbedtls_threadlock.h
@@ -29,7 +29,7 @@
#ifdef USE_MBEDTLS
#if (defined(USE_THREADS_POSIX) && defined(HAVE_PTHREAD_H)) || \
- defined(USE_THREADS_WIN32)
+ defined(_WIN32)
int Curl_mbedtlsthreadlock_thread_setup(void);
int Curl_mbedtlsthreadlock_thread_cleanup(void);
@@ -43,7 +43,7 @@ int Curl_mbedtlsthreadlock_unlock_function(int n);
#define Curl_mbedtlsthreadlock_lock_function(x) 1
#define Curl_mbedtlsthreadlock_unlock_function(x) 1
-#endif /* USE_THREADS_POSIX || USE_THREADS_WIN32 */
+#endif /* (USE_THREADS_POSIX && HAVE_PTHREAD_H) || _WIN32 */
#endif /* USE_MBEDTLS */
diff --git a/Utilities/cmcurl/lib/vtls/openssl.c b/Utilities/cmcurl/lib/vtls/openssl.c
index ef5883d..953fbfc 100644
--- a/Utilities/cmcurl/lib/vtls/openssl.c
+++ b/Utilities/cmcurl/lib/vtls/openssl.c
@@ -777,6 +777,9 @@ static int ossl_bio_cf_in_read(BIO *bio, char *buf, int blen)
if(CURLE_AGAIN == result)
BIO_set_retry_read(bio);
}
+ else if(nread == 0) {
+ connssl->peer_closed = TRUE;
+ }
/* Before returning server replies to the SSL instance, we need
* to have setup the x509 store or verification will fail. */
@@ -1895,16 +1898,41 @@ static void ossl_close(struct Curl_cfilter *cf, struct Curl_easy *data)
DEBUGASSERT(backend);
if(backend->handle) {
- if(cf->next && cf->next->connected) {
+ /* Send the TLS shutdown if we are still connected *and* if
+ * the peer did not already close the connection. */
+ if(cf->next && cf->next->connected && !connssl->peer_closed) {
char buf[1024];
int nread, err;
long sslerr;
/* Maybe the server has already sent a close notify alert.
Read it to avoid an RST on the TCP connection. */
- (void)SSL_read(backend->handle, buf, (int)sizeof(buf));
ERR_clear_error();
- if(SSL_shutdown(backend->handle) == 1) {
+ nread = SSL_read(backend->handle, buf, (int)sizeof(buf));
+ err = SSL_get_error(backend->handle, nread);
+ if(!nread && err == SSL_ERROR_ZERO_RETURN) {
+ CURLcode result;
+ ssize_t n;
+ size_t blen = sizeof(buf);
+ CURL_TRC_CF(data, cf, "peer has shutdown TLS");
+ /* SSL_read() will not longer touch the socket, let's receive
+ * directly from the next filter to see if the underlying
+ * connection has also been closed. */
+ n = Curl_conn_cf_recv(cf->next, data, buf, blen, &result);
+ if(!n) {
+ connssl->peer_closed = TRUE;
+ CURL_TRC_CF(data, cf, "peer closed connection");
+ }
+ }
+ ERR_clear_error();
+ if(connssl->peer_closed) {
+ /* As the peer closed, we do not expect it to read anything more we
+ * may send. It may be harmful, leading to TCP RST and delaying
+ * a lingering close. Just leave. */
+ CURL_TRC_CF(data, cf, "not from sending TLS shutdown on "
+ "connection closed by peer");
+ }
+ else if(SSL_shutdown(backend->handle) == 1) {
CURL_TRC_CF(data, cf, "SSL shutdown finished");
}
else {
@@ -2142,7 +2170,7 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
struct ssl_peer *peer, X509 *server_cert)
{
bool matched = FALSE;
- int target = GEN_DNS; /* target type, GEN_DNS or GEN_IPADD */
+ int target; /* target type, GEN_DNS or GEN_IPADD */
size_t addrlen = 0;
STACK_OF(GENERAL_NAME) *altnames;
#ifdef ENABLE_IPV6
@@ -2157,19 +2185,28 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
(void)conn;
hostlen = strlen(peer->hostname);
- if(peer->is_ip_address) {
+ switch(peer->type) {
+ case CURL_SSL_PEER_IPV4:
+ if(!Curl_inet_pton(AF_INET, peer->hostname, &addr))
+ return CURLE_PEER_FAILED_VERIFICATION;
+ target = GEN_IPADD;
+ addrlen = sizeof(struct in_addr);
+ break;
#ifdef ENABLE_IPV6
- if(conn->bits.ipv6_ip &&
- Curl_inet_pton(AF_INET6, peer->hostname, &addr)) {
- target = GEN_IPADD;
- addrlen = sizeof(struct in6_addr);
- }
- else
+ case CURL_SSL_PEER_IPV6:
+ if(!Curl_inet_pton(AF_INET6, peer->hostname, &addr))
+ return CURLE_PEER_FAILED_VERIFICATION;
+ target = GEN_IPADD;
+ addrlen = sizeof(struct in6_addr);
+ break;
#endif
- if(Curl_inet_pton(AF_INET, peer->hostname, &addr)) {
- target = GEN_IPADD;
- addrlen = sizeof(struct in_addr);
- }
+ case CURL_SSL_PEER_DNS:
+ target = GEN_DNS;
+ break;
+ default:
+ DEBUGASSERT(0);
+ failf(data, "unexpected ssl peer type: %d", peer->type);
+ return CURLE_PEER_FAILED_VERIFICATION;
}
/* get a "list" of alternative names */
@@ -2250,9 +2287,12 @@ CURLcode Curl_ossl_verifyhost(struct Curl_easy *data, struct connectdata *conn,
/* an alternative name matched */
;
else if(dNSName || iPAddress) {
- infof(data, " subjectAltName does not match %s", peer->dispname);
+ const char *tname = (peer->type == CURL_SSL_PEER_DNS) ? "host name" :
+ (peer->type == CURL_SSL_PEER_IPV4) ?
+ "ipv4 address" : "ipv6 address";
+ infof(data, " subjectAltName does not match %s %s", tname, peer->dispname);
failf(data, "SSL: no alternative certificate subject name matches "
- "target host name '%s'", peer->dispname);
+ "target %s '%s'", tname, peer->dispname);
result = CURLE_PEER_FAILED_VERIFICATION;
}
else {
diff --git a/Utilities/cmcurl/lib/vtls/rustls.c b/Utilities/cmcurl/lib/vtls/rustls.c
index d589709..ceb26c5 100644
--- a/Utilities/cmcurl/lib/vtls/rustls.c
+++ b/Utilities/cmcurl/lib/vtls/rustls.c
@@ -7,6 +7,7 @@
*
* Copyright (C) Jacob Hoffman-Andrews,
* <github@hoffman-andrews.com>
+ * Copyright (C) kpcyrd, <kpcyrd@archlinux.org>
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -85,6 +86,7 @@ static int
read_cb(void *userdata, uint8_t *buf, uintptr_t len, uintptr_t *out_n)
{
struct io_ctx *io_ctx = userdata;
+ struct ssl_connect_data *const connssl = io_ctx->cf->ctx;
CURLcode result;
int ret = 0;
ssize_t nread = Curl_conn_cf_recv(io_ctx->cf->next, io_ctx->data,
@@ -96,6 +98,8 @@ read_cb(void *userdata, uint8_t *buf, uintptr_t len, uintptr_t *out_n)
else
ret = EINVAL;
}
+ else if(nread == 0)
+ connssl->peer_closed = TRUE;
*out_n = (int)nread;
return ret;
}
@@ -291,7 +295,7 @@ cr_send(struct Curl_cfilter *cf, struct Curl_easy *data,
DEBUGASSERT(backend);
rconn = backend->conn;
- CURL_TRC_CF(data, cf, "cf_send: %ld plain bytes", plainlen);
+ CURL_TRC_CF(data, cf, "cf_send: %zu plain bytes", plainlen);
io_ctx.cf = cf;
io_ctx.data = data;
@@ -342,7 +346,7 @@ cr_send(struct Curl_cfilter *cf, struct Curl_easy *data,
/* A server certificate verify callback for rustls that always returns
RUSTLS_RESULT_OK, or in other words disable certificate verification. */
-static enum rustls_result
+static uint32_t
cr_verify_none(void *userdata UNUSED_PARAM,
const rustls_verify_server_cert_params *params UNUSED_PARAM)
{
@@ -373,7 +377,10 @@ cr_init_backend(struct Curl_cfilter *cf, struct Curl_easy *data,
struct ssl_primary_config *conn_config = Curl_ssl_cf_get_primary_config(cf);
struct rustls_connection *rconn = NULL;
struct rustls_client_config_builder *config_builder = NULL;
- struct rustls_root_cert_store *roots = NULL;
+ const struct rustls_root_cert_store *roots = NULL;
+ struct rustls_root_cert_store_builder *roots_builder = NULL;
+ struct rustls_web_pki_server_cert_verifier_builder *verifier_builder = NULL;
+ struct rustls_server_cert_verifier *server_cert_verifier = NULL;
const struct curl_blob *ca_info_blob = conn_config->ca_info_blob;
const char * const ssl_cafile =
/* CURLOPT_CAINFO_BLOB overrides CURLOPT_CAINFO */
@@ -414,38 +421,60 @@ cr_init_backend(struct Curl_cfilter *cf, struct Curl_easy *data,
hostname = "example.invalid";
}
}
- else if(ca_info_blob) {
- roots = rustls_root_cert_store_new();
-
- /* Enable strict parsing only if verification isn't disabled. */
- result = rustls_root_cert_store_add_pem(roots, ca_info_blob->data,
- ca_info_blob->len, verifypeer);
- if(result != RUSTLS_RESULT_OK) {
- failf(data, "rustls: failed to parse trusted certificates from blob");
- rustls_root_cert_store_free(roots);
- rustls_client_config_free(
- rustls_client_config_builder_build(config_builder));
- return CURLE_SSL_CACERT_BADFILE;
+ else if(ca_info_blob || ssl_cafile) {
+ roots_builder = rustls_root_cert_store_builder_new();
+
+ if(ca_info_blob) {
+ /* Enable strict parsing only if verification isn't disabled. */
+ result = rustls_root_cert_store_builder_add_pem(roots_builder,
+ ca_info_blob->data,
+ ca_info_blob->len,
+ verifypeer);
+ if(result != RUSTLS_RESULT_OK) {
+ failf(data, "rustls: failed to parse trusted certificates from blob");
+ rustls_root_cert_store_builder_free(roots_builder);
+ rustls_client_config_free(
+ rustls_client_config_builder_build(config_builder));
+ return CURLE_SSL_CACERT_BADFILE;
+ }
+ }
+ else if(ssl_cafile) {
+ /* Enable strict parsing only if verification isn't disabled. */
+ result = rustls_root_cert_store_builder_load_roots_from_file(
+ roots_builder, ssl_cafile, verifypeer);
+ if(result != RUSTLS_RESULT_OK) {
+ failf(data, "rustls: failed to load trusted certificates");
+ rustls_root_cert_store_builder_free(roots_builder);
+ rustls_client_config_free(
+ rustls_client_config_builder_build(config_builder));
+ return CURLE_SSL_CACERT_BADFILE;
+ }
}
- result = rustls_client_config_builder_use_roots(config_builder, roots);
- rustls_root_cert_store_free(roots);
+ result = rustls_root_cert_store_builder_build(roots_builder, &roots);
+ rustls_root_cert_store_builder_free(roots_builder);
if(result != RUSTLS_RESULT_OK) {
failf(data, "rustls: failed to load trusted certificates");
rustls_client_config_free(
rustls_client_config_builder_build(config_builder));
return CURLE_SSL_CACERT_BADFILE;
}
- }
- else if(ssl_cafile) {
- result = rustls_client_config_builder_load_roots_from_file(
- config_builder, ssl_cafile);
+
+ verifier_builder = rustls_web_pki_server_cert_verifier_builder_new(roots);
+
+ result = rustls_web_pki_server_cert_verifier_builder_build(
+ verifier_builder, &server_cert_verifier);
+ rustls_web_pki_server_cert_verifier_builder_free(verifier_builder);
if(result != RUSTLS_RESULT_OK) {
failf(data, "rustls: failed to load trusted certificates");
+ rustls_server_cert_verifier_free(server_cert_verifier);
rustls_client_config_free(
rustls_client_config_builder_build(config_builder));
return CURLE_SSL_CACERT_BADFILE;
}
+
+ rustls_client_config_builder_set_server_verifier(config_builder,
+ server_cert_verifier);
}
backend->config = rustls_client_config_builder_build(config_builder);
@@ -671,7 +700,7 @@ cr_close(struct Curl_cfilter *cf, struct Curl_easy *data)
DEBUGASSERT(backend);
- if(backend->conn) {
+ if(backend->conn && !connssl->peer_closed) {
rustls_connection_send_close_notify(backend->conn);
n = cr_send(cf, data, NULL, 0, &tmperr);
if(n < 0) {
diff --git a/Utilities/cmcurl/lib/vtls/schannel.c b/Utilities/cmcurl/lib/vtls/schannel.c
index 45c3373..8736b9e 100644
--- a/Utilities/cmcurl/lib/vtls/schannel.c
+++ b/Utilities/cmcurl/lib/vtls/schannel.c
@@ -1159,7 +1159,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
}
/* Warn if SNI is disabled due to use of an IP address */
- if(connssl->peer.is_ip_address) {
+ if(connssl->peer.type != CURL_SSL_PEER_DNS) {
infof(data, "schannel: using IP address, SNI is not supported by OS.");
}
@@ -2133,7 +2133,6 @@ schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
infof(data, "schannel: server indicated shutdown in a prior call");
goto cleanup;
}
-
/* It's debatable what to return when !len. Regardless we can't return
immediately because there may be data to decrypt (in the case we want to
decrypt all encrypted cached data) so handle !len later in cleanup.
@@ -2317,10 +2316,10 @@ schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
/* In Windows 2000 SEC_I_CONTEXT_EXPIRED (close_notify) is not
returned so we have to work around that in cleanup. */
backend->recv_sspi_close_notify = true;
- if(!backend->recv_connection_closed) {
+ if(!backend->recv_connection_closed)
backend->recv_connection_closed = true;
- infof(data, "schannel: server closed the connection");
- }
+ infof(data,
+ "schannel: server close notification received (close_notify)");
goto cleanup;
}
}
@@ -2443,7 +2442,10 @@ static bool schannel_data_pending(struct Curl_cfilter *cf,
if(backend->ctxt) /* SSL/TLS is in use */
return (backend->decdata_offset > 0 ||
- (backend->encdata_offset > 0 && !backend->encdata_is_incomplete));
+ (backend->encdata_offset > 0 && !backend->encdata_is_incomplete) ||
+ backend->recv_connection_closed ||
+ backend->recv_sspi_close_notify ||
+ backend->recv_unrecoverable_err);
else
return FALSE;
}
diff --git a/Utilities/cmcurl/lib/vtls/sectransp.c b/Utilities/cmcurl/lib/vtls/sectransp.c
index 1f37305..67f534c 100644
--- a/Utilities/cmcurl/lib/vtls/sectransp.c
+++ b/Utilities/cmcurl/lib/vtls/sectransp.c
@@ -2008,7 +2008,7 @@ static CURLcode sectransp_connect_step1(struct Curl_cfilter *cf,
return CURLE_SSL_CONNECT_ERROR;
}
- if(connssl->peer.is_ip_address) {
+ if(connssl->peer.type != CURL_SSL_PEER_DNS) {
infof(data, "WARNING: using IP address, SNI is being disabled by "
"the OS.");
}
diff --git a/Utilities/cmcurl/lib/vtls/vtls.c b/Utilities/cmcurl/lib/vtls/vtls.c
index e928ba5..d13a3cb 100644
--- a/Utilities/cmcurl/lib/vtls/vtls.c
+++ b/Utilities/cmcurl/lib/vtls/vtls.c
@@ -774,9 +774,13 @@ void Curl_ssl_adjust_pollset(struct Curl_cfilter *cf, struct Curl_easy *data,
if(sock != CURL_SOCKET_BAD) {
if(connssl->connecting_state == ssl_connect_2_writing) {
Curl_pollset_set_out_only(data, ps, sock);
+ CURL_TRC_CF(data, cf, "adjust_pollset, POLLOUT fd=%"
+ CURL_FORMAT_SOCKET_T, sock);
}
else {
Curl_pollset_set_in_only(data, ps, sock);
+ CURL_TRC_CF(data, cf, "adjust_pollset, POLLIN fd=%"
+ CURL_FORMAT_SOCKET_T, sock);
}
}
}
@@ -1512,7 +1516,7 @@ void Curl_ssl_peer_cleanup(struct ssl_peer *peer)
free(peer->sni);
free(peer->hostname);
peer->hostname = peer->sni = peer->dispname = NULL;
- peer->is_ip_address = FALSE;
+ peer->type = CURL_SSL_PEER_DNS;
}
static void cf_close(struct Curl_cfilter *cf, struct Curl_easy *data)
@@ -1526,18 +1530,23 @@ static void cf_close(struct Curl_cfilter *cf, struct Curl_easy *data)
cf->connected = FALSE;
}
-static int is_ip_address(const char *hostname)
+static ssl_peer_type get_peer_type(const char *hostname)
{
+ if(hostname && hostname[0]) {
#ifdef ENABLE_IPV6
- struct in6_addr addr;
+ struct in6_addr addr;
#else
- struct in_addr addr;
+ struct in_addr addr;
#endif
- return (hostname && hostname[0] && (Curl_inet_pton(AF_INET, hostname, &addr)
+ if(Curl_inet_pton(AF_INET, hostname, &addr))
+ return CURL_SSL_PEER_IPV4;
#ifdef ENABLE_IPV6
- || Curl_inet_pton(AF_INET6, hostname, &addr)
+ else if(Curl_inet_pton(AF_INET6, hostname, &addr)) {
+ return CURL_SSL_PEER_IPV6;
+ }
#endif
- ));
+ }
+ return CURL_SSL_PEER_DNS;
}
CURLcode Curl_ssl_peer_init(struct ssl_peer *peer, struct Curl_cfilter *cf)
@@ -1566,6 +1575,7 @@ CURLcode Curl_ssl_peer_init(struct ssl_peer *peer, struct Curl_cfilter *cf)
}
/* change if ehostname changed */
+ DEBUGASSERT(!ehostname || ehostname[0]);
if(ehostname && (!peer->hostname
|| strcmp(ehostname, peer->hostname))) {
Curl_ssl_peer_cleanup(peer);
@@ -1585,8 +1595,8 @@ CURLcode Curl_ssl_peer_init(struct ssl_peer *peer, struct Curl_cfilter *cf)
}
peer->sni = NULL;
- peer->is_ip_address = is_ip_address(peer->hostname)? TRUE : FALSE;
- if(peer->hostname[0] && !peer->is_ip_address) {
+ peer->type = get_peer_type(peer->hostname);
+ if(peer->type == CURL_SSL_PEER_DNS && peer->hostname[0]) {
/* not an IP address, normalize according to RCC 6066 ch. 3,
* max len of SNI is 2^16-1, no trailing dot */
size_t len = strlen(peer->hostname);
@@ -1715,32 +1725,17 @@ static ssize_t ssl_cf_recv(struct Curl_cfilter *cf,
{
struct cf_call_data save;
ssize_t nread;
- size_t ntotal = 0;
CF_DATA_SAVE(save, cf, data);
*err = CURLE_OK;
- /* Do receive until we fill the buffer somehwhat or EGAIN, error or EOF */
- while(!ntotal || (len - ntotal) > (4*1024)) {
+ nread = Curl_ssl->recv_plain(cf, data, buf, len, err);
+ if(nread > 0) {
+ DEBUGASSERT((size_t)nread <= len);
+ }
+ else if(nread == 0) {
+ /* eof */
*err = CURLE_OK;
- nread = Curl_ssl->recv_plain(cf, data, buf + ntotal, len - ntotal, err);
- if(nread < 0) {
- if(*err == CURLE_AGAIN && ntotal > 0) {
- /* we EAGAINed after having reed data, return the success amount */
- *err = CURLE_OK;
- break;
- }
- /* we have a an error to report */
- goto out;
- }
- else if(nread == 0) {
- /* eof */
- break;
- }
- ntotal += (size_t)nread;
- DEBUGASSERT((size_t)ntotal <= len);
}
- nread = (ssize_t)ntotal;
-out:
CURL_TRC_CF(data, cf, "cf_recv(len=%zu) -> %zd, %d", len,
nread, *err);
CF_DATA_RESTORE(cf, save);
diff --git a/Utilities/cmcurl/lib/vtls/vtls_int.h b/Utilities/cmcurl/lib/vtls/vtls_int.h
index af7ae55..0361fa9 100644
--- a/Utilities/cmcurl/lib/vtls/vtls_int.h
+++ b/Utilities/cmcurl/lib/vtls/vtls_int.h
@@ -76,6 +76,7 @@ struct ssl_connect_data {
int port; /* remote port at origin */
BIT(use_alpn); /* if ALPN shall be used in handshake */
BIT(reused_session); /* session-ID was reused for this */
+ BIT(peer_closed); /* peer has closed connection */
};
diff --git a/Utilities/cmcurl/lib/vtls/wolfssl.c b/Utilities/cmcurl/lib/vtls/wolfssl.c
index a3c017c..3187bb8 100644
--- a/Utilities/cmcurl/lib/vtls/wolfssl.c
+++ b/Utilities/cmcurl/lib/vtls/wolfssl.c
@@ -232,7 +232,6 @@ static const struct group_name_map gnm[] = {
static int wolfssl_bio_cf_create(WOLFSSL_BIO *bio)
{
wolfSSL_BIO_set_shutdown(bio, 1);
- wolfSSL_BIO_set_init(bio, 1);
wolfSSL_BIO_set_data(bio, NULL);
return 1;
}
@@ -321,6 +320,8 @@ static int wolfssl_bio_cf_in_read(WOLFSSL_BIO *bio, char *buf, int blen)
wolfSSL_BIO_clear_retry_flags(bio);
if(nread < 0 && CURLE_AGAIN == result)
BIO_set_retry_read(bio);
+ else if(nread == 0)
+ connssl->peer_closed = TRUE;
return (int)nread;
}
@@ -1059,7 +1060,8 @@ static void wolfssl_close(struct Curl_cfilter *cf, struct Curl_easy *data)
/* Maybe the server has already sent a close notify alert.
Read it to avoid an RST on the TCP connection. */
(void)wolfSSL_read(backend->handle, buf, (int)sizeof(buf));
- (void)wolfSSL_shutdown(backend->handle);
+ if(!connssl->peer_closed)
+ (void)wolfSSL_shutdown(backend->handle);
wolfSSL_free(backend->handle);
backend->handle = NULL;
}
diff --git a/Utilities/cmcurl/lib/ws.c b/Utilities/cmcurl/lib/ws.c
index d976518..5bc5ecc 100644
--- a/Utilities/cmcurl/lib/ws.c
+++ b/Utilities/cmcurl/lib/ws.c
@@ -363,7 +363,7 @@ struct ws_cw_ctx {
static CURLcode ws_cw_init(struct Curl_easy *data,
struct Curl_cwriter *writer)
{
- struct ws_cw_ctx *ctx = (struct ws_cw_ctx *)writer;
+ struct ws_cw_ctx *ctx = writer->ctx;
(void)data;
Curl_bufq_init2(&ctx->buf, WS_CHUNK_SIZE, 1, BUFQ_OPT_SOFT_LIMIT);
return CURLE_OK;
@@ -371,7 +371,7 @@ static CURLcode ws_cw_init(struct Curl_easy *data,
static void ws_cw_close(struct Curl_easy *data, struct Curl_cwriter *writer)
{
- struct ws_cw_ctx *ctx = (struct ws_cw_ctx *)writer;
+ struct ws_cw_ctx *ctx = writer->ctx;
(void) data;
Curl_bufq_free(&ctx->buf);
}
@@ -423,7 +423,7 @@ static CURLcode ws_cw_write(struct Curl_easy *data,
struct Curl_cwriter *writer, int type,
const char *buf, size_t nbytes)
{
- struct ws_cw_ctx *ctx = (struct ws_cw_ctx *)writer;
+ struct ws_cw_ctx *ctx = writer->ctx;
struct websocket *ws;
CURLcode result;
@@ -754,13 +754,26 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
DEBUGASSERT(data->conn);
ws = data->conn->proto.ws;
if(!ws) {
+ size_t chunk_size = WS_CHUNK_SIZE;
ws = calloc(1, sizeof(*ws));
if(!ws)
return CURLE_OUT_OF_MEMORY;
data->conn->proto.ws = ws;
- Curl_bufq_init2(&ws->recvbuf, WS_CHUNK_SIZE, WS_CHUNK_COUNT,
+#ifdef DEBUGBUILD
+ {
+ char *p = getenv("CURL_WS_CHUNK_SIZE");
+ if(p) {
+ long l = strtol(p, NULL, 10);
+ if(l > 0 && l <= (1*1024*1024)) {
+ chunk_size = (size_t)l;
+ }
+ }
+ }
+#endif
+ DEBUGF(infof(data, "WS, using chunk size %zu", chunk_size));
+ Curl_bufq_init2(&ws->recvbuf, chunk_size, WS_CHUNK_COUNT,
BUFQ_OPT_SOFT_LIMIT);
- Curl_bufq_init2(&ws->sendbuf, WS_CHUNK_SIZE, WS_CHUNK_COUNT,
+ Curl_bufq_init2(&ws->sendbuf, chunk_size, WS_CHUNK_COUNT,
BUFQ_OPT_SOFT_LIMIT);
ws_dec_init(&ws->dec);
ws_enc_init(&ws->enc);
@@ -834,7 +847,7 @@ CURLcode Curl_ws_accept(struct Curl_easy *data,
struct ws_collect {
struct Curl_easy *data;
- void *buffer;
+ unsigned char *buffer;
size_t buflen;
size_t bufidx;
int frame_age;
@@ -886,7 +899,7 @@ static ssize_t ws_client_collect(const unsigned char *buf, size_t buflen,
return -1;
}
*err = CURLE_OK;
- memcpy(ctx->buffer, buf, nwritten);
+ memcpy(ctx->buffer + ctx->bufidx, buf, nwritten);
ctx->bufidx += nwritten;
}
return nwritten;
@@ -1001,14 +1014,17 @@ static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws,
if(!Curl_bufq_is_empty(&ws->sendbuf)) {
CURLcode result;
const unsigned char *out;
- size_t outlen;
- ssize_t n;
+ size_t outlen, n;
while(Curl_bufq_peek(&ws->sendbuf, &out, &outlen)) {
if(data->set.connect_only)
result = Curl_senddata(data, out, outlen, &n);
- else
- result = Curl_write(data, data->conn->writesockfd, out, outlen, &n);
+ else {
+ result = Curl_xfer_send(data, out, outlen, &n);
+ if(!result && !n && outlen)
+ result = CURLE_AGAIN;
+ }
+
if(result) {
if(result == CURLE_AGAIN) {
if(!complete) {
@@ -1027,8 +1043,8 @@ static CURLcode ws_flush(struct Curl_easy *data, struct websocket *ws,
}
}
else {
- infof(data, "WS: flushed %zu bytes", (size_t)n);
- Curl_bufq_skip(&ws->sendbuf, (size_t)n);
+ infof(data, "WS: flushed %zu bytes", n);
+ Curl_bufq_skip(&ws->sendbuf, n);
}
}
}
@@ -1041,8 +1057,8 @@ CURL_EXTERN CURLcode curl_ws_send(CURL *data, const void *buffer,
unsigned int flags)
{
struct websocket *ws;
- ssize_t nwritten, n;
- size_t space;
+ ssize_t n;
+ size_t nwritten, space;
CURLcode result;
*sent = 0;
@@ -1073,15 +1089,14 @@ CURL_EXTERN CURLcode curl_ws_send(CURL *data, const void *buffer,
/* raw mode sends exactly what was requested, and this is from within
the write callback */
if(Curl_is_in_callback(data)) {
- result = Curl_write(data, data->conn->writesockfd, buffer, buflen,
- &nwritten);
+ result = Curl_xfer_send(data, buffer, buflen, &nwritten);
}
else
result = Curl_senddata(data, buffer, buflen, &nwritten);
infof(data, "WS: wanted to send %zu bytes, sent %zu bytes",
buflen, nwritten);
- *sent = (nwritten >= 0)? (size_t)nwritten : 0;
+ *sent = nwritten;
return result;
}
@@ -1091,7 +1106,7 @@ CURL_EXTERN CURLcode curl_ws_send(CURL *data, const void *buffer,
return result;
/* TODO: the current design does not allow partial writes, afaict.
- * It is not clear who the application is supposed to react. */
+ * It is not clear how the application is supposed to react. */
space = Curl_bufq_space(&ws->sendbuf);
DEBUGF(infof(data, "curl_ws_send(len=%zu), sendbuf len=%zu space %zu",
buflen, Curl_bufq_len(&ws->sendbuf), space));
@@ -1148,11 +1163,6 @@ static CURLcode ws_setup_conn(struct Curl_easy *data,
}
-void Curl_ws_done(struct Curl_easy *data)
-{
- (void)data;
-}
-
static CURLcode ws_disconnect(struct Curl_easy *data,
struct connectdata *conn,
bool dead_connection)
diff --git a/Utilities/cmcurl/lib/ws.h b/Utilities/cmcurl/lib/ws.h
index 5f40d45..baa77b4 100644
--- a/Utilities/cmcurl/lib/ws.h
+++ b/Utilities/cmcurl/lib/ws.h
@@ -75,7 +75,6 @@ struct websocket {
CURLcode Curl_ws_request(struct Curl_easy *data, REQTYPE *req);
CURLcode Curl_ws_accept(struct Curl_easy *data, const char *mem, size_t len);
-void Curl_ws_done(struct Curl_easy *data);
extern const struct Curl_handler Curl_handler_ws;
#ifdef USE_SSL
@@ -85,7 +84,6 @@ extern const struct Curl_handler Curl_handler_wss;
#else
#define Curl_ws_request(x,y) CURLE_OK
-#define Curl_ws_done(x) Curl_nop_stmt
#define Curl_ws_free(x) Curl_nop_stmt
#endif
diff --git a/Utilities/cmzlib/Copyright.txt b/Utilities/cmzlib/Copyright.txt
index 85de4a1..7df3d0a 100644
--- a/Utilities/cmzlib/Copyright.txt
+++ b/Utilities/cmzlib/Copyright.txt
@@ -1,7 +1,7 @@
'zlib' general purpose compression library
-version 1.2.13, October 13th, 2022
+version 1.3.1, January 22nd, 2024
-Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
+Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
diff --git a/Utilities/cmzlib/README b/Utilities/cmzlib/README
index ba34d18..c5f9175 100644
--- a/Utilities/cmzlib/README
+++ b/Utilities/cmzlib/README
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY
-zlib 1.2.13 is a general purpose data compression library. All the code is
+zlib 1.3.1 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -29,18 +29,17 @@ PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
-http://marknelson.us/1997/01/01/zlib-engine/ .
+https://marknelson.us/posts/1997/01/01/zlib-engine.html .
-The changes made in version 1.2.13 are documented in the file ChangeLog.
+The changes made in version 1.3.1 are documented in the file ChangeLog.
Unsupported third party contributions are provided in directory contrib/ .
-zlib is available in Java using the java.util.zip package, documented at
-http://java.sun.com/developer/technicalArticles/Programming/compression/ .
+zlib is available in Java using the java.util.zip package. Follow the API
+Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .
-A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
-at CPAN (Comprehensive Perl Archive Network) sites, including
-http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
+A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
+can be found at https://github.com/pmqs/IO-Compress .
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
@@ -64,7 +63,7 @@ Notes for some targets:
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.
-- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
+- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
@@ -84,7 +83,7 @@ Acknowledgments:
Copyright notice:
- (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
diff --git a/Utilities/cmzlib/adler32.c b/Utilities/cmzlib/adler32.c
index d0be438..04b81d2 100644
--- a/Utilities/cmzlib/adler32.c
+++ b/Utilities/cmzlib/adler32.c
@@ -7,8 +7,6 @@
#include "zutil.h"
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
-
#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
@@ -60,11 +58,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif
/* ========================================================================= */
-uLong ZEXPORT adler32_z(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- z_size_t len;
-{
+uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
unsigned long sum2;
unsigned n;
@@ -131,20 +125,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
}
/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
return adler32_z(adler, buf, len);
}
/* ========================================================================= */
-local uLong adler32_combine_(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
+local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
unsigned long sum1;
unsigned long sum2;
unsigned rem;
@@ -169,18 +155,10 @@ local uLong adler32_combine_(adler1, adler2, len2)
}
/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
-{
+uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
-uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
+uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
diff --git a/Utilities/cmzlib/compress.c b/Utilities/cmzlib/compress.c
index 2ad5326..f43bacf 100644
--- a/Utilities/cmzlib/compress.c
+++ b/Utilities/cmzlib/compress.c
@@ -19,13 +19,8 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
-{
+int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
@@ -65,12 +60,8 @@ int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
/* ===========================================================================
*/
-int ZEXPORT compress(dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
+int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
@@ -78,9 +69,7 @@ int ZEXPORT compress(dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
-uLong ZEXPORT compressBound(sourceLen)
- uLong sourceLen;
-{
+uLong ZEXPORT compressBound(uLong sourceLen) {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
}
diff --git a/Utilities/cmzlib/crc32.c b/Utilities/cmzlib/crc32.c
index f8357b0..6c38f5c 100644
--- a/Utilities/cmzlib/crc32.c
+++ b/Utilities/cmzlib/crc32.c
@@ -103,19 +103,6 @@
# define ARMCRC32
#endif
-/* Local functions. */
-local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
-local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
-
-#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
- local z_word_t byte_swap OF((z_word_t word));
-#endif
-
-#if defined(W) && !defined(ARMCRC32)
- local z_crc_t crc_word OF((z_word_t data));
- local z_word_t crc_word_big OF((z_word_t data));
-#endif
-
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
/*
Swap the bytes in a z_word_t to convert between little and big endian. Any
@@ -123,9 +110,7 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
instruction, if one is available. This assumes that word_t is either 32 bits
or 64 bits.
*/
-local z_word_t byte_swap(word)
- z_word_t word;
-{
+local z_word_t byte_swap(z_word_t word) {
# if W == 8
return
(word & 0xff00000000000000) >> 56 |
@@ -146,24 +131,77 @@ local z_word_t byte_swap(word)
}
#endif
+#ifdef DYNAMIC_CRC_TABLE
+/* =========================================================================
+ * Table of powers of x for combining CRC-32s, filled in by make_crc_table()
+ * below.
+ */
+ local z_crc_t FAR x2n_table[32];
+#else
+/* =========================================================================
+ * Tables for byte-wise and braided CRC-32 calculations, and a table of powers
+ * of x for combining CRC-32s, all made by make_crc_table().
+ */
+# include "crc32.h"
+#endif
+
/* CRC polynomial. */
#define POLY 0xedb88320 /* p(x) reflected, with x^32 implied */
-#ifdef DYNAMIC_CRC_TABLE
+/*
+ Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
+ reflected. For speed, this requires that a not be zero.
+ */
+local z_crc_t multmodp(z_crc_t a, z_crc_t b) {
+ z_crc_t m, p;
+
+ m = (z_crc_t)1 << 31;
+ p = 0;
+ for (;;) {
+ if (a & m) {
+ p ^= b;
+ if ((a & (m - 1)) == 0)
+ break;
+ }
+ m >>= 1;
+ b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
+ }
+ return p;
+}
+/*
+ Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
+ initialized.
+ */
+local z_crc_t x2nmodp(z_off64_t n, unsigned k) {
+ z_crc_t p;
+
+ p = (z_crc_t)1 << 31; /* x^0 == 1 */
+ while (n) {
+ if (n & 1)
+ p = multmodp(x2n_table[k & 31], p);
+ n >>= 1;
+ k++;
+ }
+ return p;
+}
+
+#ifdef DYNAMIC_CRC_TABLE
+/* =========================================================================
+ * Build the tables for byte-wise and braided CRC-32 calculations, and a table
+ * of powers of x for combining CRC-32s.
+ */
local z_crc_t FAR crc_table[256];
-local z_crc_t FAR x2n_table[32];
-local void make_crc_table OF((void));
#ifdef W
local z_word_t FAR crc_big_table[256];
local z_crc_t FAR crc_braid_table[W][256];
local z_word_t FAR crc_braid_big_table[W][256];
- local void braid OF((z_crc_t [][256], z_word_t [][256], int, int));
+ local void braid(z_crc_t [][256], z_word_t [][256], int, int);
#endif
#ifdef MAKECRCH
- local void write_table OF((FILE *, const z_crc_t FAR *, int));
- local void write_table32hi OF((FILE *, const z_word_t FAR *, int));
- local void write_table64 OF((FILE *, const z_word_t FAR *, int));
+ local void write_table(FILE *, const z_crc_t FAR *, int);
+ local void write_table32hi(FILE *, const z_word_t FAR *, int);
+ local void write_table64(FILE *, const z_word_t FAR *, int);
#endif /* MAKECRCH */
/*
@@ -176,7 +214,6 @@ local void make_crc_table OF((void));
/* Definition of once functionality. */
typedef struct once_s once_t;
-local void once OF((once_t *, void (*)(void)));
/* Check for the availability of atomics. */
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
@@ -196,10 +233,7 @@ struct once_s {
invoke once() at the same time. The state must be a once_t initialized with
ONCE_INIT.
*/
-local void once(state, init)
- once_t *state;
- void (*init)(void);
-{
+local void once(once_t *state, void (*init)(void)) {
if (!atomic_load(&state->done)) {
if (atomic_flag_test_and_set(&state->begun))
while (!atomic_load(&state->done))
@@ -222,10 +256,7 @@ struct once_s {
/* Test and set. Alas, not atomic, but tries to minimize the period of
vulnerability. */
-local int test_and_set OF((int volatile *));
-local int test_and_set(flag)
- int volatile *flag;
-{
+local int test_and_set(int volatile *flag) {
int was;
was = *flag;
@@ -234,10 +265,7 @@ local int test_and_set(flag)
}
/* Run the provided init() function once. This is not thread-safe. */
-local void once(state, init)
- once_t *state;
- void (*init)(void);
-{
+local void once(once_t *state, void (*init)(void)) {
if (!state->done) {
if (test_and_set(&state->begun))
while (!state->done)
@@ -279,8 +307,7 @@ local once_t made = ONCE_INIT;
combinations of CRC register values and incoming bytes.
*/
-local void make_crc_table()
-{
+local void make_crc_table(void) {
unsigned i, j, n;
z_crc_t p;
@@ -447,11 +474,7 @@ local void make_crc_table()
Write the 32-bit values in table[0..k-1] to out, five per line in
hexadecimal separated by commas.
*/
-local void write_table(out, table, k)
- FILE *out;
- const z_crc_t FAR *table;
- int k;
-{
+local void write_table(FILE *out, const z_crc_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -464,11 +487,7 @@ local void write_table(out, table, k)
Write the high 32-bits of each value in table[0..k-1] to out, five per line
in hexadecimal separated by commas.
*/
-local void write_table32hi(out, table, k)
-FILE *out;
-const z_word_t FAR *table;
-int k;
-{
+local void write_table32hi(FILE *out, const z_word_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -484,11 +503,7 @@ int k;
bits. If not, then the type cast and format string can be adjusted
accordingly.
*/
-local void write_table64(out, table, k)
- FILE *out;
- const z_word_t FAR *table;
- int k;
-{
+local void write_table64(FILE *out, const z_word_t FAR *table, int k) {
int n;
for (n = 0; n < k; n++)
@@ -498,8 +513,7 @@ local void write_table64(out, table, k)
}
/* Actually do the deed. */
-int main()
-{
+int main(void) {
make_crc_table();
return 0;
}
@@ -511,12 +525,7 @@ int main()
Generate the little and big-endian braid tables for the given n and z_word_t
size w. Each array must have room for w blocks of 256 elements.
*/
-local void braid(ltl, big, n, w)
- z_crc_t ltl[][256];
- z_word_t big[][256];
- int n;
- int w;
-{
+local void braid(z_crc_t ltl[][256], z_word_t big[][256], int n, int w) {
int k;
z_crc_t i, p, q;
for (k = 0; k < w; k++) {
@@ -531,69 +540,13 @@ local void braid(ltl, big, n, w)
}
#endif
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables for byte-wise and braided CRC-32 calculations, and a table of powers
- * of x for combining CRC-32s, all made by make_crc_table().
- */
-#include "crc32.h"
#endif /* DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Routines used for CRC calculation. Some are also required for the table
- * generation above.
- */
-
-/*
- Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
- reflected. For speed, this requires that a not be zero.
- */
-local z_crc_t multmodp(a, b)
- z_crc_t a;
- z_crc_t b;
-{
- z_crc_t m, p;
-
- m = (z_crc_t)1 << 31;
- p = 0;
- for (;;) {
- if (a & m) {
- p ^= b;
- if ((a & (m - 1)) == 0)
- break;
- }
- m >>= 1;
- b = b & 1 ? (b >> 1) ^ POLY : b >> 1;
- }
- return p;
-}
-
-/*
- Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
- initialized.
- */
-local z_crc_t x2nmodp(n, k)
- z_off64_t n;
- unsigned k;
-{
- z_crc_t p;
-
- p = (z_crc_t)1 << 31; /* x^0 == 1 */
- while (n) {
- if (n & 1)
- p = multmodp(x2n_table[k & 31], p);
- n >>= 1;
- k++;
- }
- return p;
-}
-
/* =========================================================================
* This function can be used by asm versions of crc32(), and to force the
* generation of the CRC tables in a threaded application.
*/
-const z_crc_t FAR * ZEXPORT get_crc_table()
-{
+const z_crc_t FAR * ZEXPORT get_crc_table(void) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
@@ -619,11 +572,8 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
#define Z_BATCH_MIN 800 /* fewest words in a final batch */
-unsigned long ZEXPORT crc32_z(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- z_size_t len;
-{
+unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
+ z_size_t len) {
z_crc_t val;
z_word_t crc1, crc2;
const z_word_t *word;
@@ -723,18 +673,14 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
least-significant byte of the word as the first byte of data, without any pre
or post conditioning. This is used to combine the CRCs of each braid.
*/
-local z_crc_t crc_word(data)
- z_word_t data;
-{
+local z_crc_t crc_word(z_word_t data) {
int k;
for (k = 0; k < W; k++)
data = (data >> 8) ^ crc_table[data & 0xff];
return (z_crc_t)data;
}
-local z_word_t crc_word_big(data)
- z_word_t data;
-{
+local z_word_t crc_word_big(z_word_t data) {
int k;
for (k = 0; k < W; k++)
data = (data << 8) ^
@@ -745,11 +691,8 @@ local z_word_t crc_word_big(data)
#endif
/* ========================================================================= */
-unsigned long ZEXPORT crc32_z(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- z_size_t len;
-{
+unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf,
+ z_size_t len) {
/* Return initial CRC, if requested. */
if (buf == Z_NULL) return 0;
@@ -781,8 +724,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
words = (z_word_t const *)buf;
/* Do endian check at execution time instead of compile time, since ARM
- processors can change the endianess at execution time. If the
- compiler knows what the endianess will be, it can optimize out the
+ processors can change the endianness at execution time. If the
+ compiler knows what the endianness will be, it can optimize out the
check and the unused branch. */
endian = 1;
if (*(unsigned char *)&endian) {
@@ -1069,20 +1012,13 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif
/* ========================================================================= */
-unsigned long ZEXPORT crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- uInt len;
-{
+unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf,
+ uInt len) {
return crc32_z(crc, buf, len);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
-{
+uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
@@ -1090,18 +1026,12 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
-{
+uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2) {
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen64(len2)
- z_off64_t len2;
-{
+uLong ZEXPORT crc32_combine_gen64(z_off64_t len2) {
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
@@ -1109,17 +1039,11 @@ uLong ZEXPORT crc32_combine_gen64(len2)
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine_gen(len2)
- z_off_t len2;
-{
+uLong ZEXPORT crc32_combine_gen(z_off_t len2) {
return crc32_combine_gen64((z_off64_t)len2);
}
/* ========================================================================= */
-uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
- uLong crc1;
- uLong crc2;
- uLong op;
-{
+uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op) {
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
}
diff --git a/Utilities/cmzlib/deflate.c b/Utilities/cmzlib/deflate.c
index 92ded86..14aa1af 100644
--- a/Utilities/cmzlib/deflate.c
+++ b/Utilities/cmzlib/deflate.c
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
+ " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -60,9 +60,6 @@ const char deflate_copyright[] =
copyright string in the executable of your product.
*/
-/* ===========================================================================
- * Function prototypes.
- */
typedef enum {
need_more, /* block not completed, need more input or more output */
block_done, /* block flush performed */
@@ -70,29 +67,16 @@ typedef enum {
finish_done /* finish done, accept no more input or output */
} block_state;
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
+typedef block_state (*compress_func)(deflate_state *s, int flush);
/* Compression function. Returns the block state after the call. */
-local int deflateStateCheck OF((z_streamp strm));
-local void slide_hash OF((deflate_state *s));
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
+local block_state deflate_stored(deflate_state *s, int flush);
+local block_state deflate_fast(deflate_state *s, int flush);
#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local block_state deflate_rle OF((deflate_state *s, int flush));
-local block_state deflate_huff OF((deflate_state *s, int flush));
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-
-#ifdef ZLIB_DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
+local block_state deflate_slow(deflate_state *s, int flush);
#endif
+local block_state deflate_rle(deflate_state *s, int flush);
+local block_state deflate_huff(deflate_state *s, int flush);
/* ===========================================================================
* Local data
@@ -195,9 +179,12 @@ local const config configuration_table[10] = {
* bit values at the expense of memory usage). We slide even when level == 0 to
* keep the hash table consistent if we switch back to level > 0 later.
*/
-local void slide_hash(s)
- deflate_state *s;
-{
+#if defined(__has_feature)
+# if __has_feature(memory_sanitizer)
+ __attribute__((no_sanitize("memory")))
+# endif
+#endif
+local void slide_hash(deflate_state *s) {
unsigned n, m;
Posf *p;
uInt wsize = s->w_size;
@@ -221,30 +208,177 @@ local void slide_hash(s)
#endif
}
+/* ===========================================================================
+ * Read a new buffer from the current input stream, update the adler32
+ * and total number of bytes read. All deflate() input goes through
+ * this function so some applications may wish to modify it to avoid
+ * allocating a large strm->next_in buffer and copying from it.
+ * (See also flush_pending()).
+ */
+local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
+ unsigned len = strm->avail_in;
+
+ if (len > size) len = size;
+ if (len == 0) return 0;
+
+ strm->avail_in -= len;
+
+ zmemcpy(buf, strm->next_in, len);
+ if (strm->state->wrap == 1) {
+ strm->adler = adler32(strm->adler, buf, len);
+ }
+#ifdef GZIP
+ else if (strm->state->wrap == 2) {
+ strm->adler = crc32(strm->adler, buf, len);
+ }
+#endif
+ strm->next_in += len;
+ strm->total_in += len;
+
+ return len;
+}
+
+/* ===========================================================================
+ * Fill the window when the lookahead becomes insufficient.
+ * Updates strstart and lookahead.
+ *
+ * IN assertion: lookahead < MIN_LOOKAHEAD
+ * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
+ * At least one byte has been read, or avail_in == 0; reads are
+ * performed for at least two bytes (required for the zip translate_eol
+ * option -- not supported here).
+ */
+local void fill_window(deflate_state *s) {
+ unsigned n;
+ unsigned more; /* Amount of free space at the end of the window. */
+ uInt wsize = s->w_size;
+
+ Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
+
+ do {
+ more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+
+ /* Deal with !@#$% 64K limit: */
+ if (sizeof(int) <= 2) {
+ if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
+ more = wsize;
+
+ } else if (more == (unsigned)(-1)) {
+ /* Very unlikely, but possible on 16 bit machine if
+ * strstart == 0 && lookahead == 1 (input done a byte at time)
+ */
+ more--;
+ }
+ }
+
+ /* If the window is almost full and there is insufficient lookahead,
+ * move the upper half to the lower one to make room in the upper half.
+ */
+ if (s->strstart >= wsize + MAX_DIST(s)) {
+
+ zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
+ s->match_start -= wsize;
+ s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
+ s->block_start -= (long) wsize;
+ if (s->insert > s->strstart)
+ s->insert = s->strstart;
+ slide_hash(s);
+ more += wsize;
+ }
+ if (s->strm->avail_in == 0) break;
+
+ /* If there was no sliding:
+ * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
+ * more == window_size - lookahead - strstart
+ * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
+ * => more >= window_size - 2*WSIZE + 2
+ * In the BIG_MEM or MMAP case (not yet supported),
+ * window_size == input_size + MIN_LOOKAHEAD &&
+ * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
+ * Otherwise, window_size == 2*WSIZE so more >= 2.
+ * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
+ */
+ Assert(more >= 2, "more < 2");
+
+ n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
+ s->lookahead += n;
+
+ /* Initialize the hash value now that we have some input: */
+ if (s->lookahead + s->insert >= MIN_MATCH) {
+ uInt str = s->strstart - s->insert;
+ s->ins_h = s->window[str];
+ UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
+#if MIN_MATCH != 3
+ Call UPDATE_HASH() MIN_MATCH-3 more times
+#endif
+ while (s->insert) {
+ UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
+#ifndef FASTEST
+ s->prev[str & s->w_mask] = s->head[s->ins_h];
+#endif
+ s->head[s->ins_h] = (Pos)str;
+ str++;
+ s->insert--;
+ if (s->lookahead + s->insert < MIN_MATCH)
+ break;
+ }
+ }
+ /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
+ * but this is not important since only literal bytes will be emitted.
+ */
+
+ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
+
+ /* If the WIN_INIT bytes after the end of the current data have never been
+ * written, then zero those bytes in order to avoid memory check reports of
+ * the use of uninitialized (or uninitialised as Julian writes) bytes by
+ * the longest match routines. Update the high water mark for the next
+ * time through here. WIN_INIT is set to MAX_MATCH since the longest match
+ * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
+ */
+ if (s->high_water < s->window_size) {
+ ulg curr = s->strstart + (ulg)(s->lookahead);
+ ulg init;
+
+ if (s->high_water < curr) {
+ /* Previous high water mark below current data -- zero WIN_INIT
+ * bytes or up to end of window, whichever is less.
+ */
+ init = s->window_size - curr;
+ if (init > WIN_INIT)
+ init = WIN_INIT;
+ zmemzero(s->window + curr, (unsigned)init);
+ s->high_water = curr + init;
+ }
+ else if (s->high_water < (ulg)curr + WIN_INIT) {
+ /* High water mark at or above current data, but below current data
+ * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
+ * to end of window, whichever is less.
+ */
+ init = (ulg)curr + WIN_INIT - s->high_water;
+ if (init > s->window_size - s->high_water)
+ init = s->window_size - s->high_water;
+ zmemzero(s->window + s->high_water, (unsigned)init);
+ s->high_water += init;
+ }
+ }
+
+ Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+ "not enough room for search");
+}
+
/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
-{
+int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version,
+ int stream_size) {
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size);
/* To do: ignore strm->next_in if we use it as window */
}
/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
-{
+int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
+ int windowBits, int memLevel, int strategy,
+ const char *version, int stream_size) {
deflate_state *s;
int wrap = 1;
static const char my_version[] = ZLIB_VERSION;
@@ -366,7 +500,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
* symbols from which it is being constructed.
*/
- s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
@@ -376,8 +510,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
deflateEnd (strm);
return Z_MEM_ERROR;
}
+#ifdef LIT_MEM
+ s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
+ s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
+ s->sym_end = s->lit_bufsize - 1;
+#else
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
+#endif
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
@@ -393,9 +533,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
/* =========================================================================
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
*/
-local int deflateStateCheck(strm)
- z_streamp strm;
-{
+local int deflateStateCheck(z_streamp strm) {
deflate_state *s;
if (strm == Z_NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
@@ -416,11 +554,8 @@ local int deflateStateCheck(strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
-{
+int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary,
+ uInt dictLength) {
deflate_state *s;
uInt str, n;
int wrap;
@@ -485,11 +620,8 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
- z_streamp strm;
- Bytef *dictionary;
- uInt *dictLength;
-{
+int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary,
+ uInt *dictLength) {
deflate_state *s;
uInt len;
@@ -507,9 +639,7 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateResetKeep(strm)
- z_streamp strm;
-{
+int ZEXPORT deflateResetKeep(z_streamp strm) {
deflate_state *s;
if (deflateStateCheck(strm)) {
@@ -544,10 +674,32 @@ int ZEXPORT deflateResetKeep(strm)
return Z_OK;
}
+/* ===========================================================================
+ * Initialize the "longest match" routines for a new zlib stream
+ */
+local void lm_init(deflate_state *s) {
+ s->window_size = (ulg)2L*s->w_size;
+
+ CLEAR_HASH(s);
+
+ /* Set the default configuration parameters:
+ */
+ s->max_lazy_match = configuration_table[s->level].max_lazy;
+ s->good_match = configuration_table[s->level].good_length;
+ s->nice_match = configuration_table[s->level].nice_length;
+ s->max_chain_length = configuration_table[s->level].max_chain;
+
+ s->strstart = 0;
+ s->block_start = 0L;
+ s->lookahead = 0;
+ s->insert = 0;
+ s->match_length = s->prev_length = MIN_MATCH-1;
+ s->match_available = 0;
+ s->ins_h = 0;
+}
+
/* ========================================================================= */
-int ZEXPORT deflateReset(strm)
- z_streamp strm;
-{
+int ZEXPORT deflateReset(z_streamp strm) {
int ret;
ret = deflateResetKeep(strm);
@@ -557,10 +709,7 @@ int ZEXPORT deflateReset(strm)
}
/* ========================================================================= */
-int ZEXPORT deflateSetHeader(strm, head)
- z_streamp strm;
- gz_headerp head;
-{
+int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head) {
if (deflateStateCheck(strm) || strm->state->wrap != 2)
return Z_STREAM_ERROR;
strm->state->gzhead = head;
@@ -568,11 +717,7 @@ int ZEXPORT deflateSetHeader(strm, head)
}
/* ========================================================================= */
-int ZEXPORT deflatePending(strm, pending, bits)
- unsigned *pending;
- int *bits;
- z_streamp strm;
-{
+int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) {
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
if (pending != Z_NULL)
*pending = strm->state->pending;
@@ -582,19 +727,21 @@ int ZEXPORT deflatePending(strm, pending, bits)
}
/* ========================================================================= */
-int ZEXPORT deflatePrime(strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
+int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
deflate_state *s;
int put;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
+#ifdef LIT_MEM
+ if (bits < 0 || bits > 16 ||
+ (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
+ return Z_BUF_ERROR;
+#else
if (bits < 0 || bits > 16 ||
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
+#endif
do {
put = Buf_size - s->bi_valid;
if (put > bits)
@@ -609,11 +756,7 @@ int ZEXPORT deflatePrime(strm, bits, value)
}
/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
-{
+int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {
deflate_state *s;
compress_func func;
@@ -658,13 +801,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
}
/* ========================================================================= */
-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
-{
+int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy,
+ int nice_length, int max_chain) {
deflate_state *s;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -700,10 +838,7 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
*
* Shifts are used to approximate divisions, for speed.
*/
-uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
-{
+uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) {
deflate_state *s;
uLong fixedlen, storelen, wraplen;
@@ -759,7 +894,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
/* if not default parameters, return one of the conservative bounds */
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
+ return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
+ wraplen;
/* default settings: return tight bound for that case -- ~0.03% overhead
plus a small constant */
@@ -772,10 +908,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
-local void putShortMSB(s, b)
- deflate_state *s;
- uInt b;
-{
+local void putShortMSB(deflate_state *s, uInt b) {
put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff));
}
@@ -786,9 +919,7 @@ local void putShortMSB(s, b)
* applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()).
*/
-local void flush_pending(strm)
- z_streamp strm;
-{
+local void flush_pending(z_streamp strm) {
unsigned len;
deflate_state *s = strm->state;
@@ -819,10 +950,7 @@ local void flush_pending(strm)
} while (0)
/* ========================================================================= */
-int ZEXPORT deflate(strm, flush)
- z_streamp strm;
- int flush;
-{
+int ZEXPORT deflate(z_streamp strm, int flush) {
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
@@ -1134,9 +1262,7 @@ int ZEXPORT deflate(strm, flush)
}
/* ========================================================================= */
-int ZEXPORT deflateEnd(strm)
- z_streamp strm;
-{
+int ZEXPORT deflateEnd(z_streamp strm) {
int status;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1160,11 +1286,10 @@ int ZEXPORT deflateEnd(strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
-int ZEXPORT deflateCopy(dest, source)
- z_streamp dest;
- z_streamp source;
-{
+int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
#ifdef MAXSEG_64K
+ (void)dest;
+ (void)source;
return Z_STREAM_ERROR;
#else
deflate_state *ds;
@@ -1188,7 +1313,7 @@ int ZEXPORT deflateCopy(dest, source)
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@@ -1199,10 +1324,15 @@ int ZEXPORT deflateCopy(dest, source)
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+ zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
+#ifdef LIT_MEM
+ ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
+ ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
+#else
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
+#endif
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
@@ -1212,66 +1342,6 @@ int ZEXPORT deflateCopy(dest, source)
#endif /* MAXSEG_64K */
}
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local unsigned read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- zmemcpy(buf, strm->next_in, len);
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, buf, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, buf, len);
- }
-#endif
- strm->next_in += len;
- strm->total_in += len;
-
- return len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init(s)
- deflate_state *s;
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->insert = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-}
-
#ifndef FASTEST
/* ===========================================================================
* Set match_start to the longest match starting at the given string and
@@ -1282,10 +1352,7 @@ local void lm_init(s)
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
* OUT assertion: the match length is not greater than s->lookahead.
*/
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
+local uInt longest_match(deflate_state *s, IPos cur_match) {
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
@@ -1433,10 +1500,7 @@ local uInt longest_match(s, cur_match)
/* ---------------------------------------------------------------------------
* Optimized version for FASTEST only
*/
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
+local uInt longest_match(deflate_state *s, IPos cur_match) {
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
register int len; /* length of current match */
@@ -1497,19 +1561,23 @@ local uInt longest_match(s, cur_match)
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
-{
+local void check_match(deflate_state *s, IPos start, IPos match, int length) {
/* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
+ Bytef *back = s->window + (int)match, *here = s->window + start;
+ IPos len = length;
+ if (match == (IPos)-1) {
+ /* match starts one byte before the current window -- just compare the
+ subsequent length-1 bytes */
+ back++;
+ here++;
+ len--;
+ }
+ if (zmemcmp(back, here, len) != EQUAL) {
+ fprintf(stderr, " start %u, match %d, length %d\n",
+ start, (int)match, length);
do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
+ fprintf(stderr, "(%02x %02x)", *back++, *here++);
+ } while (--len != 0);
z_error("invalid match");
}
if (z_verbose > 1) {
@@ -1522,137 +1590,6 @@ local void check_match(s, start, match, length)
#endif /* ZLIB_DEBUG */
/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(s)
- deflate_state *s;
-{
- unsigned n;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize + MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
- if (s->insert > s->strstart)
- s->insert = s->strstart;
- slide_hash(s);
- more += wsize;
- }
- if (s->strm->avail_in == 0) break;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead + s->insert >= MIN_MATCH) {
- uInt str = s->strstart - s->insert;
- s->ins_h = s->window[str];
- UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- while (s->insert) {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- s->insert--;
- if (s->lookahead + s->insert < MIN_MATCH)
- break;
- }
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-
- /* If the WIN_INIT bytes after the end of the current data have never been
- * written, then zero those bytes in order to avoid memory check reports of
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
- * the longest match routines. Update the high water mark for the next
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
- */
- if (s->high_water < s->window_size) {
- ulg curr = s->strstart + (ulg)(s->lookahead);
- ulg init;
-
- if (s->high_water < curr) {
- /* Previous high water mark below current data -- zero WIN_INIT
- * bytes or up to end of window, whichever is less.
- */
- init = s->window_size - curr;
- if (init > WIN_INIT)
- init = WIN_INIT;
- zmemzero(s->window + curr, (unsigned)init);
- s->high_water = curr + init;
- }
- else if (s->high_water < (ulg)curr + WIN_INIT) {
- /* High water mark at or above current data, but below current data
- * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
- * to end of window, whichever is less.
- */
- init = (ulg)curr + WIN_INIT - s->high_water;
- if (init > s->window_size - s->high_water)
- init = s->window_size - s->high_water;
- zmemzero(s->window + s->high_water, (unsigned)init);
- s->high_water += init;
- }
- }
-
- Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
- "not enough room for search");
-}
-
-/* ===========================================================================
* Flush the current block, with given end-of-file flag.
* IN assertion: strstart is set to the end of the current match.
*/
@@ -1694,10 +1631,7 @@ local void fill_window(s)
* copied. It is most efficient with large input and output buffers, which
* maximizes the opportunities to have a single copy from next_in to next_out.
*/
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_stored(deflate_state *s, int flush) {
/* Smallest worthy block size when not flushing or finishing. By default
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
* large input and output buffers, the stored block size will be larger.
@@ -1881,10 +1815,7 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_fast(deflate_state *s, int flush) {
IPos hash_head; /* head of the hash chain */
int bflush; /* set if current block must be flushed */
@@ -1983,10 +1914,7 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_slow(deflate_state *s, int flush) {
IPos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */
@@ -2114,10 +2042,7 @@ local block_state deflate_slow(s, flush)
* one. Do not maintain a hash table. (It will be regenerated if this run of
* deflate switches away from Z_RLE.)
*/
-local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_rle(deflate_state *s, int flush) {
int bflush; /* set if current block must be flushed */
uInt prev; /* byte at distance one to match */
Bytef *scan, *strend; /* scan goes up to strend for length of run */
@@ -2188,10 +2113,7 @@ local block_state deflate_rle(s, flush)
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
* (It will be regenerated if this run of deflate switches away from Huffman.)
*/
-local block_state deflate_huff(s, flush)
- deflate_state *s;
- int flush;
-{
+local block_state deflate_huff(deflate_state *s, int flush) {
int bflush; /* set if current block must be flushed */
for (;;) {
diff --git a/Utilities/cmzlib/deflate.h b/Utilities/cmzlib/deflate.h
index 1a06cd5..300c6ad 100644
--- a/Utilities/cmzlib/deflate.h
+++ b/Utilities/cmzlib/deflate.h
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
- * Copyright (C) 1995-2018 Jean-loup Gailly
+ * Copyright (C) 1995-2024 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -23,6 +23,10 @@
# define GZIP
#endif
+/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
+ the cost of a larger memory footprint */
+/* #define LIT_MEM */
+
/* ===========================================================================
* Internal compression state.
*/
@@ -217,7 +221,14 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
+#ifdef LIT_MEM
+# define LIT_BUFS 5
+ ushf *d_buf; /* buffer for distances */
+ uchf *l_buf; /* buffer for literals/lengths */
+#else
+# define LIT_BUFS 4
uchf *sym_buf; /* buffer for distances and literals/lengths */
+#endif
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -239,7 +250,7 @@ typedef struct internal_state {
* - I can't count above 4
*/
- uInt sym_next; /* running index in sym_buf */
+ uInt sym_next; /* running index in symbol buffer */
uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
@@ -291,14 +302,14 @@ typedef struct internal_state {
memory checker errors from longest match routines */
/* in trees.c */
-void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
-int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
+void ZLIB_INTERNAL _tr_init(deflate_state *s);
+int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last);
+void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
+void ZLIB_INTERNAL _tr_align(deflate_state *s);
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last);
#define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
@@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
extern const uch ZLIB_INTERNAL _dist_code[];
#endif
+#ifdef LIT_MEM
+# define _tr_tally_lit(s, c, flush) \
+ { uch cc = (c); \
+ s->d_buf[s->sym_next] = 0; \
+ s->l_buf[s->sym_next++] = cc; \
+ s->dyn_ltree[cc].Freq++; \
+ flush = (s->sym_next == s->sym_end); \
+ }
+# define _tr_tally_dist(s, distance, length, flush) \
+ { uch len = (uch)(length); \
+ ush dist = (ush)(distance); \
+ s->d_buf[s->sym_next] = dist; \
+ s->l_buf[s->sym_next++] = len; \
+ dist--; \
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
+ s->dyn_dtree[d_code(dist)].Freq++; \
+ flush = (s->sym_next == s->sym_end); \
+ }
+#else
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
@@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
+#endif
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
diff --git a/Utilities/cmzlib/gzclose.c b/Utilities/cmzlib/gzclose.c
index caeb99a..48d6a86 100644
--- a/Utilities/cmzlib/gzclose.c
+++ b/Utilities/cmzlib/gzclose.c
@@ -8,9 +8,7 @@
/* gzclose() is in a separate file so that it is linked in only if it is used.
That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */
-int ZEXPORT gzclose(file)
- gzFile file;
-{
+int ZEXPORT gzclose(gzFile file) {
#ifndef NO_GZCOMPRESS
gz_statep state;
diff --git a/Utilities/cmzlib/gzguts.h b/Utilities/cmzlib/gzguts.h
index 57faf37..eba7208 100644
--- a/Utilities/cmzlib/gzguts.h
+++ b/Utilities/cmzlib/gzguts.h
@@ -1,5 +1,5 @@
/* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004-2019 Mark Adler
+ * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -7,9 +7,8 @@
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
-# endif
+# undef _FILE_OFFSET_BITS
+# undef _TIME_BITS
#endif
#ifdef HAVE_HIDDEN
@@ -119,8 +118,8 @@
/* gz* functions always use library allocation functions */
#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
+ extern voidp malloc(uInt size);
+ extern void free(voidpf ptr);
#endif
/* get errno and strerror definition */
@@ -138,10 +137,10 @@
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
+ ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
#endif
/* default memLevel */
@@ -203,17 +202,13 @@ typedef struct {
typedef gz_state FAR *gz_statep;
/* shared functions */
-void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
+void ZLIB_INTERNAL gz_error(gz_statep, int, const char *);
#if defined UNDER_CE
-char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
+char ZLIB_INTERNAL *gz_strwinerror(DWORD error);
#endif
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
-#ifdef INT_MAX
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
-#else
-unsigned ZLIB_INTERNAL gz_intmax OF((void));
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
-#endif
+unsigned ZLIB_INTERNAL gz_intmax(void);
+#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
diff --git a/Utilities/cmzlib/gzlib.c b/Utilities/cmzlib/gzlib.c
index 55da46a..983153c 100644
--- a/Utilities/cmzlib/gzlib.c
+++ b/Utilities/cmzlib/gzlib.c
@@ -1,5 +1,5 @@
/* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004-2019 Mark Adler
+ * Copyright (C) 2004-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -15,10 +15,6 @@
#endif
#endif
-/* Local functions */
-local void gz_reset OF((gz_statep));
-local gzFile gz_open OF((const void *, int, const char *));
-
#if defined UNDER_CE
/* Map the Windows error number in ERROR to a locale-dependent error message
@@ -30,9 +26,7 @@ local gzFile gz_open OF((const void *, int, const char *));
The gz_strwinerror function does not change the current setting of
GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror(error)
- DWORD error;
-{
+char ZLIB_INTERNAL *gz_strwinerror(DWORD error) {
static char buf[1024];
wchar_t *msgbuf;
@@ -72,9 +66,7 @@ char ZLIB_INTERNAL *gz_strwinerror(error)
#endif /* UNDER_CE */
/* Reset gzip file state */
-local void gz_reset(state)
- gz_statep state;
-{
+local void gz_reset(gz_statep state) {
state->x.have = 0; /* no output data available */
if (state->mode == GZ_READ) { /* for reading ... */
state->eof = 0; /* not at end of file */
@@ -90,11 +82,7 @@ local void gz_reset(state)
}
/* Open a gzip file either by name or file descriptor. */
-local gzFile gz_open(path, fd, mode)
- const void *path;
- int fd;
- const char *mode;
-{
+local gzFile gz_open(const void *path, int fd, const char *mode) {
gz_statep state;
z_size_t len;
int oflag;
@@ -269,26 +257,17 @@ local gzFile gz_open(path, fd, mode)
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen(path, mode)
- const char *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen64(path, mode)
- const char *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen64(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
-gzFile ZEXPORT gzdopen(fd, mode)
- int fd;
- const char *mode;
-{
+gzFile ZEXPORT gzdopen(int fd, const char *mode) {
char *path; /* identifier for error messages */
gzFile gz;
@@ -306,19 +285,13 @@ gzFile ZEXPORT gzdopen(fd, mode)
/* -- see zlib.h -- */
#ifdef WIDECHAR
-gzFile ZEXPORT gzopen_w(path, mode)
- const wchar_t *path;
- const char *mode;
-{
+gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) {
return gz_open(path, -2, mode);
}
#endif
/* -- see zlib.h -- */
-int ZEXPORT gzbuffer(file, size)
- gzFile file;
- unsigned size;
-{
+int ZEXPORT gzbuffer(gzFile file, unsigned size) {
gz_statep state;
/* get internal structure and check integrity */
@@ -335,16 +308,14 @@ int ZEXPORT gzbuffer(file, size)
/* check and set requested size */
if ((size << 1) < size)
return -1; /* need to be able to double it */
- if (size < 2)
- size = 2; /* need two bytes to check magic header */
+ if (size < 8)
+ size = 8; /* needed to behave well with flushing */
state->want = size;
return 0;
}
/* -- see zlib.h -- */
-int ZEXPORT gzrewind(file)
- gzFile file;
-{
+int ZEXPORT gzrewind(gzFile file) {
gz_statep state;
/* get internal structure */
@@ -365,11 +336,7 @@ int ZEXPORT gzrewind(file)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzseek64(file, offset, whence)
- gzFile file;
- z_off64_t offset;
- int whence;
-{
+z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence) {
unsigned n;
z_off64_t ret;
gz_statep state;
@@ -442,11 +409,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gzseek(file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
+z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence) {
z_off64_t ret;
ret = gzseek64(file, (z_off64_t)offset, whence);
@@ -454,9 +417,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gztell64(file)
- gzFile file;
-{
+z_off64_t ZEXPORT gztell64(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -471,9 +432,7 @@ z_off64_t ZEXPORT gztell64(file)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gztell(file)
- gzFile file;
-{
+z_off_t ZEXPORT gztell(gzFile file) {
z_off64_t ret;
ret = gztell64(file);
@@ -481,9 +440,7 @@ z_off_t ZEXPORT gztell(file)
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzoffset64(file)
- gzFile file;
-{
+z_off64_t ZEXPORT gzoffset64(gzFile file) {
z_off64_t offset;
gz_statep state;
@@ -504,9 +461,7 @@ z_off64_t ZEXPORT gzoffset64(file)
}
/* -- see zlib.h -- */
-z_off_t ZEXPORT gzoffset(file)
- gzFile file;
-{
+z_off_t ZEXPORT gzoffset(gzFile file) {
z_off64_t ret;
ret = gzoffset64(file);
@@ -514,9 +469,7 @@ z_off_t ZEXPORT gzoffset(file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzeof(file)
- gzFile file;
-{
+int ZEXPORT gzeof(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -531,10 +484,7 @@ int ZEXPORT gzeof(file)
}
/* -- see zlib.h -- */
-const char * ZEXPORT gzerror(file, errnum)
- gzFile file;
- int *errnum;
-{
+const char * ZEXPORT gzerror(gzFile file, int *errnum) {
gz_statep state;
/* get internal structure and check integrity */
@@ -552,9 +502,7 @@ const char * ZEXPORT gzerror(file, errnum)
}
/* -- see zlib.h -- */
-void ZEXPORT gzclearerr(file)
- gzFile file;
-{
+void ZEXPORT gzclearerr(gzFile file) {
gz_statep state;
/* get internal structure and check integrity */
@@ -578,11 +526,7 @@ void ZEXPORT gzclearerr(file)
memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to
out of memory. */
-void ZLIB_INTERNAL gz_error(state, err, msg)
- gz_statep state;
- int err;
- const char *msg;
-{
+void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) {
/* free previously allocated message and clear */
if (state->msg != NULL) {
if (state->err != Z_MEM_ERROR)
@@ -619,21 +563,20 @@ void ZLIB_INTERNAL gz_error(state, err, msg)
#endif
}
-#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZLIB_INTERNAL gz_intmax()
-{
- unsigned p, q;
-
- p = 1;
+unsigned ZLIB_INTERNAL gz_intmax(void) {
+#ifdef INT_MAX
+ return INT_MAX;
+#else
+ unsigned p = 1, q;
do {
q = p;
p <<= 1;
p++;
} while (p > q);
return q >> 1;
-}
#endif
+}
diff --git a/Utilities/cmzlib/gzread.c b/Utilities/cmzlib/gzread.c
index eaa5523..e1a8a8d 100644
--- a/Utilities/cmzlib/gzread.c
+++ b/Utilities/cmzlib/gzread.c
@@ -5,25 +5,12 @@
#include "gzguts.h"
-/* Local functions */
-local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
-local int gz_avail OF((gz_statep));
-local int gz_look OF((gz_statep));
-local int gz_decomp OF((gz_statep));
-local int gz_fetch OF((gz_statep));
-local int gz_skip OF((gz_statep, z_off64_t));
-local z_size_t gz_read OF((gz_statep, voidp, z_size_t));
-
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
state->fd, and update state->eof, state->err, and state->msg as appropriate.
This function needs to loop on read(), since read() is not guaranteed to
read the number of bytes requested, depending on the type of descriptor. */
-local int gz_load(state, buf, len, have)
- gz_statep state;
- unsigned char *buf;
- unsigned len;
- unsigned *have;
-{
+local int gz_load(gz_statep state, unsigned char *buf, unsigned len,
+ unsigned *have) {
int ret;
unsigned get, max = ((unsigned)-1 >> 2) + 1;
@@ -53,9 +40,7 @@ local int gz_load(state, buf, len, have)
If strm->avail_in != 0, then the current data is moved to the beginning of
the input buffer, and then the remainder of the buffer is loaded with the
available data from the input file. */
-local int gz_avail(state)
- gz_statep state;
-{
+local int gz_avail(gz_statep state) {
unsigned got;
z_streamp strm = &(state->strm);
@@ -88,9 +73,7 @@ local int gz_avail(state)
case, all further file reads will be directly to either the output buffer or
a user buffer. If decompressing, the inflate state will be initialized.
gz_look() will return 0 on success or -1 on failure. */
-local int gz_look(state)
- gz_statep state;
-{
+local int gz_look(gz_statep state) {
z_streamp strm = &(state->strm);
/* allocate read buffers and inflate memory */
@@ -170,9 +153,7 @@ local int gz_look(state)
data. If the gzip stream completes, state->how is reset to LOOK to look for
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
on success, -1 on failure. */
-local int gz_decomp(state)
- gz_statep state;
-{
+local int gz_decomp(gz_statep state) {
int ret = Z_OK;
unsigned had;
z_streamp strm = &(state->strm);
@@ -224,9 +205,7 @@ local int gz_decomp(state)
looked for to determine whether to copy or decompress. Returns -1 on error,
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
end of the input file has been reached and all data has been processed. */
-local int gz_fetch(state)
- gz_statep state;
-{
+local int gz_fetch(gz_statep state) {
z_streamp strm = &(state->strm);
do {
@@ -254,10 +233,7 @@ local int gz_fetch(state)
}
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
-local int gz_skip(state, len)
- gz_statep state;
- z_off64_t len;
-{
+local int gz_skip(gz_statep state, z_off64_t len) {
unsigned n;
/* skip over len bytes or reach end-of-file, whichever comes first */
@@ -289,11 +265,7 @@ local int gz_skip(state, len)
input. Return the number of bytes read. If zero is returned, either the
end of file was reached, or there was an error. state->err must be
consulted in that case to determine which. */
-local z_size_t gz_read(state, buf, len)
- gz_statep state;
- voidp buf;
- z_size_t len;
-{
+local z_size_t gz_read(gz_statep state, voidp buf, z_size_t len) {
z_size_t got;
unsigned n;
@@ -370,11 +342,7 @@ local z_size_t gz_read(state, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzread(file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
+int ZEXPORT gzread(gzFile file, voidp buf, unsigned len) {
gz_statep state;
/* get internal structure */
@@ -406,12 +374,7 @@ int ZEXPORT gzread(file, buf, len)
}
/* -- see zlib.h -- */
-z_size_t ZEXPORT gzfread(buf, size, nitems, file)
- voidp buf;
- z_size_t size;
- z_size_t nitems;
- gzFile file;
-{
+z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems, gzFile file) {
z_size_t len;
gz_statep state;
@@ -450,9 +413,7 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
#else
# undef gzgetc
#endif
-int ZEXPORT gzgetc(file)
- gzFile file;
-{
+int ZEXPORT gzgetc(gzFile file) {
unsigned char buf[1];
gz_statep state;
@@ -477,17 +438,12 @@ int ZEXPORT gzgetc(file)
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
}
-int ZEXPORT gzgetc_(file)
-gzFile file;
-{
+int ZEXPORT gzgetc_(gzFile file) {
return gzgetc(file);
}
/* -- see zlib.h -- */
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
+int ZEXPORT gzungetc(int c, gzFile file) {
gz_statep state;
/* get internal structure */
@@ -495,6 +451,10 @@ int ZEXPORT gzungetc(c, file)
return -1;
state = (gz_statep)file;
+ /* in case this was just opened, set up the input buffer */
+ if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
+ (void)gz_look(state);
+
/* check that we're reading and that there's no (serious) error */
if (state->mode != GZ_READ ||
(state->err != Z_OK && state->err != Z_BUF_ERROR))
@@ -544,11 +504,7 @@ int ZEXPORT gzungetc(c, file)
}
/* -- see zlib.h -- */
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
+char * ZEXPORT gzgets(gzFile file, char *buf, int len) {
unsigned left, n;
char *str;
unsigned char *eol;
@@ -608,9 +564,7 @@ char * ZEXPORT gzgets(file, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzdirect(file)
- gzFile file;
-{
+int ZEXPORT gzdirect(gzFile file) {
gz_statep state;
/* get internal structure */
@@ -628,9 +582,7 @@ int ZEXPORT gzdirect(file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzclose_r(file)
- gzFile file;
-{
+int ZEXPORT gzclose_r(gzFile file) {
int ret, err;
gz_statep state;
diff --git a/Utilities/cmzlib/gzwrite.c b/Utilities/cmzlib/gzwrite.c
index 16d4a22..6ac0de2 100644
--- a/Utilities/cmzlib/gzwrite.c
+++ b/Utilities/cmzlib/gzwrite.c
@@ -5,18 +5,10 @@
#include "gzguts.h"
-/* Local functions */
-local int gz_init OF((gz_statep));
-local int gz_comp OF((gz_statep, int));
-local int gz_zero OF((gz_statep, z_off64_t));
-local z_size_t gz_write OF((gz_statep, voidpc, z_size_t));
-
/* Initialize state for writing a gzip file. Mark initialization by setting
state->size to non-zero. Return -1 on a memory allocation failure, or 0 on
success. */
-local int gz_init(state)
- gz_statep state;
-{
+local int gz_init(gz_statep state) {
int ret;
z_streamp strm = &(state->strm);
@@ -70,10 +62,7 @@ local int gz_init(state)
deflate() flush value. If flush is Z_FINISH, then the deflate() state is
reset to start a new gzip stream. If gz->direct is true, then simply write
to the output file without compressing, and ignore flush. */
-local int gz_comp(state, flush)
- gz_statep state;
- int flush;
-{
+local int gz_comp(gz_statep state, int flush) {
int ret, writ;
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
z_streamp strm = &(state->strm);
@@ -151,10 +140,7 @@ local int gz_comp(state, flush)
/* Compress len zeros to output. Return -1 on a write error or memory
allocation failure by gz_comp(), or 0 on success. */
-local int gz_zero(state, len)
- gz_statep state;
- z_off64_t len;
-{
+local int gz_zero(gz_statep state, z_off64_t len) {
int first;
unsigned n;
z_streamp strm = &(state->strm);
@@ -184,11 +170,7 @@ local int gz_zero(state, len)
/* Write len bytes from buf to file. Return the number of bytes written. If
the returned value is less than len, then there was an error. */
-local z_size_t gz_write(state, buf, len)
- gz_statep state;
- voidpc buf;
- z_size_t len;
-{
+local z_size_t gz_write(gz_statep state, voidpc buf, z_size_t len) {
z_size_t put = len;
/* if len is zero, avoid unnecessary operations */
@@ -252,11 +234,7 @@ local z_size_t gz_write(state, buf, len)
}
/* -- see zlib.h -- */
-int ZEXPORT gzwrite(file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
+int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len) {
gz_statep state;
/* get internal structure */
@@ -280,12 +258,8 @@ int ZEXPORT gzwrite(file, buf, len)
}
/* -- see zlib.h -- */
-z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
- voidpc buf;
- z_size_t size;
- z_size_t nitems;
- gzFile file;
-{
+z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size, z_size_t nitems,
+ gzFile file) {
z_size_t len;
gz_statep state;
@@ -316,10 +290,7 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
}
/* -- see zlib.h -- */
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
+int ZEXPORT gzputc(gzFile file, int c) {
unsigned have;
unsigned char buf[1];
gz_statep state;
@@ -364,10 +335,7 @@ int ZEXPORT gzputc(file, c)
}
/* -- see zlib.h -- */
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
-{
+int ZEXPORT gzputs(gzFile file, const char *s) {
z_size_t len, put;
gz_statep state;
@@ -394,8 +362,7 @@ int ZEXPORT gzputs(file, s)
#include <stdarg.h>
/* -- see zlib.h -- */
-int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
-{
+int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) {
int len;
unsigned left;
char *next;
@@ -466,8 +433,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
return len;
}
-int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
-{
+int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) {
va_list va;
int ret;
@@ -480,13 +446,10 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
#else /* !STDC && !Z_HAVE_STDARG_H */
/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
+int ZEXPORTVA gzprintf(gzFile file, const char *format, int a1, int a2, int a3,
+ int a4, int a5, int a6, int a7, int a8, int a9, int a10,
+ int a11, int a12, int a13, int a14, int a15, int a16,
+ int a17, int a18, int a19, int a20) {
unsigned len, left;
char *next;
gz_statep state;
@@ -568,10 +531,7 @@ int ZEXPORTVA gzprintf(file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
#endif
/* -- see zlib.h -- */
-int ZEXPORT gzflush(file, flush)
- gzFile file;
- int flush;
-{
+int ZEXPORT gzflush(gzFile file, int flush) {
gz_statep state;
/* get internal structure */
@@ -600,11 +560,7 @@ int ZEXPORT gzflush(file, flush)
}
/* -- see zlib.h -- */
-int ZEXPORT gzsetparams(file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
+int ZEXPORT gzsetparams(gzFile file, int level, int strategy) {
gz_statep state;
z_streamp strm;
@@ -615,7 +571,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
strm = &(state->strm);
/* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
+ if (state->mode != GZ_WRITE || state->err != Z_OK || state->direct)
return Z_STREAM_ERROR;
/* if no change is requested, then do nothing */
@@ -642,9 +598,7 @@ int ZEXPORT gzsetparams(file, level, strategy)
}
/* -- see zlib.h -- */
-int ZEXPORT gzclose_w(file)
- gzFile file;
-{
+int ZEXPORT gzclose_w(gzFile file) {
int ret = Z_OK;
gz_statep state;
diff --git a/Utilities/cmzlib/inffast.c b/Utilities/cmzlib/inffast.c
index 1fec7f3..9354676 100644
--- a/Utilities/cmzlib/inffast.c
+++ b/Utilities/cmzlib/inffast.c
@@ -47,10 +47,7 @@
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
-void ZLIB_INTERNAL inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
+void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
struct inflate_state FAR *state;
z_const unsigned char FAR *in; /* local strm->next_in */
z_const unsigned char FAR *last; /* have enough input while in < last */
diff --git a/Utilities/cmzlib/inffast.h b/Utilities/cmzlib/inffast.h
index e5c1aa4..49c6d15 100644
--- a/Utilities/cmzlib/inffast.h
+++ b/Utilities/cmzlib/inffast.h
@@ -8,4 +8,4 @@
subject to change. Applications should only use zlib.h.
*/
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
+void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start);
diff --git a/Utilities/cmzlib/inflate.c b/Utilities/cmzlib/inflate.c
index 8acbef4..94ecff0 100644
--- a/Utilities/cmzlib/inflate.c
+++ b/Utilities/cmzlib/inflate.c
@@ -91,20 +91,7 @@
# endif
#endif
-/* function prototypes */
-local int inflateStateCheck OF((z_streamp strm));
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
- unsigned copy));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
- unsigned len));
-
-local int inflateStateCheck(strm)
-z_streamp strm;
-{
+local int inflateStateCheck(z_streamp strm) {
struct inflate_state FAR *state;
if (strm == Z_NULL ||
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
@@ -116,9 +103,7 @@ z_streamp strm;
return 0;
}
-int ZEXPORT inflateResetKeep(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateResetKeep(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -142,9 +127,7 @@ z_streamp strm;
return Z_OK;
}
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateReset(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -155,10 +138,7 @@ z_streamp strm;
return inflateResetKeep(strm);
}
-int ZEXPORT inflateReset2(strm, windowBits)
-z_streamp strm;
-int windowBits;
-{
+int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
int wrap;
struct inflate_state FAR *state;
@@ -195,12 +175,8 @@ int windowBits;
return inflateReset(strm);
}
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
-{
+int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
+ const char *version, int stream_size) {
int ret;
struct inflate_state FAR *state;
@@ -239,22 +215,17 @@ int stream_size;
return ret;
}
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
-{
+int ZEXPORT inflateInit_(z_streamp strm, const char *version,
+ int stream_size) {
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
}
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
-{
+int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
+ if (bits == 0)
+ return Z_OK;
state = (struct inflate_state FAR *)strm->state;
if (bits < 0) {
state->hold = 0;
@@ -278,9 +249,7 @@ int value;
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
+local void fixedtables(struct inflate_state FAR *state) {
#ifdef BUILDFIXED
static int virgin = 1;
static code *lenfix, *distfix;
@@ -342,7 +311,7 @@ struct inflate_state FAR *state;
a.out > inffixed.h
*/
-void makefixed()
+void makefixed(void)
{
unsigned low, size;
struct inflate_state state;
@@ -396,11 +365,7 @@ void makefixed()
output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches.
*/
-local int updatewindow(strm, end, copy)
-z_streamp strm;
-const Bytef *end;
-unsigned copy;
-{
+local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
struct inflate_state FAR *state;
unsigned dist;
@@ -622,10 +587,7 @@ unsigned copy;
will return Z_BUF_ERROR if it has not reached the end of the stream.
*/
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
-{
+int ZEXPORT inflate(z_streamp strm, int flush) {
struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
@@ -1301,9 +1263,7 @@ int flush;
return ret;
}
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateEnd(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm))
return Z_STREAM_ERROR;
@@ -1315,11 +1275,8 @@ z_streamp strm;
return Z_OK;
}
-int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-Bytef *dictionary;
-uInt *dictLength;
-{
+int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary,
+ uInt *dictLength) {
struct inflate_state FAR *state;
/* check state */
@@ -1338,11 +1295,8 @@ uInt *dictLength;
return Z_OK;
}
-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-const Bytef *dictionary;
-uInt dictLength;
-{
+int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary,
+ uInt dictLength) {
struct inflate_state FAR *state;
unsigned long dictid;
int ret;
@@ -1373,10 +1327,7 @@ uInt dictLength;
return Z_OK;
}
-int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
-gz_headerp head;
-{
+int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) {
struct inflate_state FAR *state;
/* check state */
@@ -1401,11 +1352,8 @@ gz_headerp head;
called again with more data and the *have state. *have is initialized to
zero for the first call.
*/
-local unsigned syncsearch(have, buf, len)
-unsigned FAR *have;
-const unsigned char FAR *buf;
-unsigned len;
-{
+local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf,
+ unsigned len) {
unsigned got;
unsigned next;
@@ -1424,9 +1372,7 @@ unsigned len;
return next;
}
-int ZEXPORT inflateSync(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateSync(z_streamp strm) {
unsigned len; /* number of bytes to look at or looked at */
int flags; /* temporary to save header status */
unsigned long in, out; /* temporary to save total_in and total_out */
@@ -1441,7 +1387,7 @@ z_streamp strm;
/* if first time, start search in bit buffer */
if (state->mode != SYNC) {
state->mode = SYNC;
- state->hold <<= state->bits & 7;
+ state->hold >>= state->bits & 7;
state->bits -= state->bits & 7;
len = 0;
while (state->bits >= 8) {
@@ -1482,9 +1428,7 @@ z_streamp strm;
block. When decompressing, PPP checks that at the end of input packet,
inflate is waiting for these length bytes.
*/
-int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
-{
+int ZEXPORT inflateSyncPoint(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1492,10 +1436,7 @@ z_streamp strm;
return state->mode == STORED && state->bits == 0;
}
-int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
-{
+int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) {
struct inflate_state FAR *state;
struct inflate_state FAR *copy;
unsigned char FAR *window;
@@ -1539,10 +1480,7 @@ z_streamp source;
return Z_OK;
}
-int ZEXPORT inflateUndermine(strm, subvert)
-z_streamp strm;
-int subvert;
-{
+int ZEXPORT inflateUndermine(z_streamp strm, int subvert) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1557,10 +1495,7 @@ int subvert;
#endif
}
-int ZEXPORT inflateValidate(strm, check)
-z_streamp strm;
-int check;
-{
+int ZEXPORT inflateValidate(z_streamp strm, int check) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@@ -1572,9 +1507,7 @@ int check;
return Z_OK;
}
-long ZEXPORT inflateMark(strm)
-z_streamp strm;
-{
+long ZEXPORT inflateMark(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm))
@@ -1585,9 +1518,7 @@ z_streamp strm;
(state->mode == MATCH ? state->was - state->length : 0));
}
-unsigned long ZEXPORT inflateCodesUsed(strm)
-z_streamp strm;
-{
+unsigned long ZEXPORT inflateCodesUsed(z_streamp strm) {
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return (unsigned long)-1;
state = (struct inflate_state FAR *)strm->state;
diff --git a/Utilities/cmzlib/inftrees.c b/Utilities/cmzlib/inftrees.c
index 57d2793..98cfe16 100644
--- a/Utilities/cmzlib/inftrees.c
+++ b/Utilities/cmzlib/inftrees.c
@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2022 Mark Adler
+ * Copyright (C) 1995-2024 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -9,7 +9,7 @@
#define MAXBITS 15
const char inflate_copyright[] =
- " inflate 1.2.13 Copyright 1995-2022 Mark Adler ";
+ " inflate 1.3.1 Copyright 1995-2024 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -29,14 +29,9 @@ const char inflate_copyright[] =
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
+int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work) {
unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */
unsigned min, max; /* minimum and maximum code lengths */
@@ -62,7 +57,7 @@ unsigned short FAR *work;
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 194, 65};
+ 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/Utilities/cmzlib/inftrees.h b/Utilities/cmzlib/inftrees.h
index f536653..396f74b 100644
--- a/Utilities/cmzlib/inftrees.h
+++ b/Utilities/cmzlib/inftrees.h
@@ -41,8 +41,8 @@ typedef struct {
examples/enough.c found in the zlib distribution. The arguments to that
program are the number of symbols, the initial root table size, and the
maximum bit length of a code. "enough 286 9 15" for literal/length codes
- returns returns 852, and "enough 30 6 15" for distance codes returns 592.
- The initial root table size (9 or 6) is found in the fifth argument of the
+ returns 852, and "enough 30 6 15" for distance codes returns 592. The
+ initial root table size (9 or 6) is found in the fifth argument of the
inflate_table() calls in inflate.c and infback.c. If the root table size is
changed, then these maximum sizes would be need to be recalculated and
updated. */
@@ -57,6 +57,6 @@ typedef enum {
DISTS
} codetype;
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
+int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
+ unsigned codes, code FAR * FAR *table,
+ unsigned FAR *bits, unsigned short FAR *work);
diff --git a/Utilities/cmzlib/trees.c b/Utilities/cmzlib/trees.c
index 5f305c4..6a523ef 100644
--- a/Utilities/cmzlib/trees.c
+++ b/Utilities/cmzlib/trees.c
@@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2021 Jean-loup Gailly
+ * Copyright (C) 1995-2024 Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -122,39 +122,116 @@ struct static_tree_desc_s {
int max_length; /* max bit length for the codes */
};
-local const static_tree_desc static_l_desc =
+#ifdef NO_INIT_GLOBAL_POINTERS
+# define TCONST
+#else
+# define TCONST const
+#endif
+
+local TCONST static_tree_desc static_l_desc =
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-local const static_tree_desc static_d_desc =
+local TCONST static_tree_desc static_d_desc =
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-local const static_tree_desc static_bl_desc =
+local TCONST static_tree_desc static_bl_desc =
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
/* ===========================================================================
- * Local (static) routines in this file.
+ * Output a short LSB first on the stream.
+ * IN assertion: there is enough room in pendingBuf.
+ */
+#define put_short(s, w) { \
+ put_byte(s, (uch)((w) & 0xff)); \
+ put_byte(s, (uch)((ush)(w) >> 8)); \
+}
+
+/* ===========================================================================
+ * Reverse the first len bits of a code, using straightforward code (a faster
+ * method would use a table)
+ * IN assertion: 1 <= len <= 15
*/
+local unsigned bi_reverse(unsigned code, int len) {
+ register unsigned res = 0;
+ do {
+ res |= code & 1;
+ code >>= 1, res <<= 1;
+ } while (--len > 0);
+ return res >> 1;
+}
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, const ct_data *ltree,
- const ct_data *dtree));
-local int detect_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned code, int len));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
+/* ===========================================================================
+ * Flush the bit buffer, keeping at most 7 bits in it.
+ */
+local void bi_flush(deflate_state *s) {
+ if (s->bi_valid == 16) {
+ put_short(s, s->bi_buf);
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+ } else if (s->bi_valid >= 8) {
+ put_byte(s, (Byte)s->bi_buf);
+ s->bi_buf >>= 8;
+ s->bi_valid -= 8;
+ }
+}
+
+/* ===========================================================================
+ * Flush the bit buffer and align the output on a byte boundary
+ */
+local void bi_windup(deflate_state *s) {
+ if (s->bi_valid > 8) {
+ put_short(s, s->bi_buf);
+ } else if (s->bi_valid > 0) {
+ put_byte(s, (Byte)s->bi_buf);
+ }
+ s->bi_buf = 0;
+ s->bi_valid = 0;
+#ifdef ZLIB_DEBUG
+ s->bits_sent = (s->bits_sent + 7) & ~7;
+#endif
+}
+
+/* ===========================================================================
+ * Generate the codes for a given tree and bit counts (which need not be
+ * optimal).
+ * IN assertion: the array bl_count contains the bit length statistics for
+ * the given tree and the field len is set for all tree elements.
+ * OUT assertion: the field code is set for all tree elements of non
+ * zero code length.
+ */
+local void gen_codes(ct_data *tree, int max_code, ushf *bl_count) {
+ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
+ unsigned code = 0; /* running code value */
+ int bits; /* bit index */
+ int n; /* code index */
+
+ /* The distribution counts are first used to generate the code values
+ * without bit reversal.
+ */
+ for (bits = 1; bits <= MAX_BITS; bits++) {
+ code = (code + bl_count[bits - 1]) << 1;
+ next_code[bits] = (ush)code;
+ }
+ /* Check that the bit counts in bl_count are consistent. The last code
+ * must be all ones.
+ */
+ Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
+ "inconsistent bit counts");
+ Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
+
+ for (n = 0; n <= max_code; n++) {
+ int len = tree[n].Len;
+ if (len == 0) continue;
+ /* Now reverse the bits */
+ tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
+
+ Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
+ n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
+ }
+}
#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
+local void gen_trees_header(void);
#endif
#ifndef ZLIB_DEBUG
@@ -168,26 +245,11 @@ local void gen_trees_header OF((void));
#endif
/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
* Send a value on a given number of bits.
* IN assertion: length <= 16 and value fits in length bits.
*/
#ifdef ZLIB_DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
-{
+local void send_bits(deflate_state *s, int value, int length) {
Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length");
s->bits_sent += (ulg)length;
@@ -229,8 +291,7 @@ local void send_bits(s, value, length)
/* ===========================================================================
* Initialize the various 'constant' tables.
*/
-local void tr_static_init()
-{
+local void tr_static_init(void) {
#if defined(GEN_TREES_H) || !defined(STDC)
static int static_init_done = 0;
int n; /* iterates over tree elements */
@@ -323,8 +384,7 @@ local void tr_static_init()
((i) == (last)? "\n};\n\n" : \
((i) % (width) == (width) - 1 ? ",\n" : ", "))
-void gen_trees_header()
-{
+void gen_trees_header(void) {
FILE *header = fopen("trees.h", "w");
int i;
@@ -374,11 +434,25 @@ void gen_trees_header()
#endif /* GEN_TREES_H */
/* ===========================================================================
+ * Initialize a new block.
+ */
+local void init_block(deflate_state *s) {
+ int n; /* iterates over tree elements */
+
+ /* Initialize the trees. */
+ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
+ for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
+ for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
+
+ s->dyn_ltree[END_BLOCK].Freq = 1;
+ s->opt_len = s->static_len = 0L;
+ s->sym_next = s->matches = 0;
+}
+
+/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
-void ZLIB_INTERNAL _tr_init(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_init(deflate_state *s) {
tr_static_init();
s->l_desc.dyn_tree = s->dyn_ltree;
@@ -401,24 +475,6 @@ void ZLIB_INTERNAL _tr_init(s)
init_block(s);
}
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(s)
- deflate_state *s;
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->sym_next = s->matches = 0;
-}
-
#define SMALLEST 1
/* Index within the heap array of least frequent node in the Huffman tree */
@@ -448,11 +504,7 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its
* two sons).
*/
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
-{
+local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
int v = s->heap[k];
int j = k << 1; /* left son of k */
while (j <= s->heap_len) {
@@ -483,10 +535,7 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
+local void gen_bitlen(deflate_state *s, tree_desc *desc) {
ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code;
const ct_data *stree = desc->stat_desc->static_tree;
@@ -561,48 +610,9 @@ local void gen_bitlen(s, desc)
}
}
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes(tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- unsigned code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- code = (code + bl_count[bits - 1]) << 1;
- next_code[bits] = (ush)code;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS] - 1 == (1 << MAX_BITS) - 1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = (ush)bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len] - 1));
- }
-}
+#ifdef DUMP_BL_TREE
+# include <stdio.h>
+#endif
/* ===========================================================================
* Construct one Huffman tree and assigns the code bit strings and lengths.
@@ -612,10 +622,7 @@ local void gen_codes(tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
+local void build_tree(deflate_state *s, tree_desc *desc) {
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
int elems = desc->stat_desc->elems;
@@ -700,11 +707,7 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
-local void scan_tree(s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
+local void scan_tree(deflate_state *s, ct_data *tree, int max_code) {
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
@@ -745,11 +748,7 @@ local void scan_tree(s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
-local void send_tree(s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
+local void send_tree(deflate_state *s, ct_data *tree, int max_code) {
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
int curlen; /* length of current code */
@@ -796,9 +795,7 @@ local void send_tree(s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
-local int build_bl_tree(s)
- deflate_state *s;
-{
+local int build_bl_tree(deflate_state *s) {
int max_blindex; /* index of last bit length code of non zero freq */
/* Determine the bit length frequencies for literal and distance trees */
@@ -831,10 +828,8 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
-{
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes,
+ int blcodes) {
int rank; /* index in bl_order */
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
@@ -860,12 +855,8 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
/* ===========================================================================
* Send a stored block
*/
-void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last) {
send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
bi_windup(s); /* align on byte boundary */
put_short(s, (ush)stored_len);
@@ -884,9 +875,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
-void ZLIB_INTERNAL _tr_flush_bits(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) {
bi_flush(s);
}
@@ -894,9 +883,7 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
-void ZLIB_INTERNAL _tr_align(s)
- deflate_state *s;
-{
+void ZLIB_INTERNAL _tr_align(deflate_state *s) {
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
#ifdef ZLIB_DEBUG
@@ -906,15 +893,107 @@ void ZLIB_INTERNAL _tr_align(s)
}
/* ===========================================================================
+ * Send the block data compressed using the given Huffman trees
+ */
+local void compress_block(deflate_state *s, const ct_data *ltree,
+ const ct_data *dtree) {
+ unsigned dist; /* distance of matched string */
+ int lc; /* match length or unmatched char (if dist == 0) */
+ unsigned sx = 0; /* running index in symbol buffers */
+ unsigned code; /* the code to send */
+ int extra; /* number of extra bits to send */
+
+ if (s->sym_next != 0) do {
+#ifdef LIT_MEM
+ dist = s->d_buf[sx];
+ lc = s->l_buf[sx++];
+#else
+ dist = s->sym_buf[sx++] & 0xff;
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
+ lc = s->sym_buf[sx++];
+#endif
+ if (dist == 0) {
+ send_code(s, lc, ltree); /* send a literal byte */
+ Tracecv(isgraph(lc), (stderr," '%c' ", lc));
+ } else {
+ /* Here, lc is the match length - MIN_MATCH */
+ code = _length_code[lc];
+ send_code(s, code + LITERALS + 1, ltree); /* send length code */
+ extra = extra_lbits[code];
+ if (extra != 0) {
+ lc -= base_length[code];
+ send_bits(s, lc, extra); /* send the extra length bits */
+ }
+ dist--; /* dist is now the match distance - 1 */
+ code = d_code(dist);
+ Assert (code < D_CODES, "bad d_code");
+
+ send_code(s, code, dtree); /* send the distance code */
+ extra = extra_dbits[code];
+ if (extra != 0) {
+ dist -= (unsigned)base_dist[code];
+ send_bits(s, dist, extra); /* send the extra distance bits */
+ }
+ } /* literal or match pair ? */
+
+ /* Check for no overlay of pending_buf on needed symbols */
+#ifdef LIT_MEM
+ Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow");
+#else
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
+#endif
+
+ } while (sx < s->sym_next);
+
+ send_code(s, END_BLOCK, ltree);
+}
+
+/* ===========================================================================
+ * Check if the data type is TEXT or BINARY, using the following algorithm:
+ * - TEXT if the two conditions below are satisfied:
+ * a) There are no non-portable control characters belonging to the
+ * "block list" (0..6, 14..25, 28..31).
+ * b) There is at least one printable character belonging to the
+ * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
+ * - BINARY otherwise.
+ * - The following partially-portable control characters form a
+ * "gray list" that is ignored in this detection algorithm:
+ * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
+ * IN assertion: the fields Freq of dyn_ltree are set.
+ */
+local int detect_data_type(deflate_state *s) {
+ /* block_mask is the bit mask of block-listed bytes
+ * set bits 0..6, 14..25, and 28..31
+ * 0xf3ffc07f = binary 11110011111111111100000001111111
+ */
+ unsigned long block_mask = 0xf3ffc07fUL;
+ int n;
+
+ /* Check for non-textual ("block-listed") bytes. */
+ for (n = 0; n <= 31; n++, block_mask >>= 1)
+ if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
+ return Z_BINARY;
+
+ /* Check for textual ("allow-listed") bytes. */
+ if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
+ || s->dyn_ltree[13].Freq != 0)
+ return Z_TEXT;
+ for (n = 32; n < LITERALS; n++)
+ if (s->dyn_ltree[n].Freq != 0)
+ return Z_TEXT;
+
+ /* There are no "block-listed" or "allow-listed" bytes:
+ * this stream either is empty or has tolerated ("gray-listed") bytes only.
+ */
+ return Z_BINARY;
+}
+
+/* ===========================================================================
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
-void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
+ ulg stored_len, int last) {
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
@@ -1011,14 +1090,15 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
-int ZLIB_INTERNAL _tr_tally(s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */
-{
+int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
+#ifdef LIT_MEM
+ s->d_buf[s->sym_next] = (ush)dist;
+ s->l_buf[s->sym_next++] = (uch)lc;
+#else
s->sym_buf[s->sym_next++] = (uch)dist;
s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
s->sym_buf[s->sym_next++] = (uch)lc;
+#endif
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
@@ -1035,147 +1115,3 @@ int ZLIB_INTERNAL _tr_tally(s, dist, lc)
}
return (s->sym_next == s->sym_end);
}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- const ct_data *ltree; /* literal tree */
- const ct_data *dtree; /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned sx = 0; /* running index in sym_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->sym_next != 0) do {
- dist = s->sym_buf[sx++] & 0xff;
- dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
- lc = s->sym_buf[sx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code + LITERALS + 1, ltree); /* send length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= (unsigned)base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and sym_buf is ok: */
- Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
-
- } while (sx < s->sym_next);
-
- send_code(s, END_BLOCK, ltree);
-}
-
-/* ===========================================================================
- * Check if the data type is TEXT or BINARY, using the following algorithm:
- * - TEXT if the two conditions below are satisfied:
- * a) There are no non-portable control characters belonging to the
- * "block list" (0..6, 14..25, 28..31).
- * b) There is at least one printable character belonging to the
- * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
- * - BINARY otherwise.
- * - The following partially-portable control characters form a
- * "gray list" that is ignored in this detection algorithm:
- * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local int detect_data_type(s)
- deflate_state *s;
-{
- /* block_mask is the bit mask of block-listed bytes
- * set bits 0..6, 14..25, and 28..31
- * 0xf3ffc07f = binary 11110011111111111100000001111111
- */
- unsigned long block_mask = 0xf3ffc07fUL;
- int n;
-
- /* Check for non-textual ("block-listed") bytes. */
- for (n = 0; n <= 31; n++, block_mask >>= 1)
- if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
- return Z_BINARY;
-
- /* Check for textual ("allow-listed") bytes. */
- if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
- || s->dyn_ltree[13].Freq != 0)
- return Z_TEXT;
- for (n = 32; n < LITERALS; n++)
- if (s->dyn_ltree[n].Freq != 0)
- return Z_TEXT;
-
- /* There are no "block-listed" or "allow-listed" bytes:
- * this stream either is empty or has tolerated ("gray-listed") bytes only.
- */
- return Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(s)
- deflate_state *s;
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(s)
- deflate_state *s;
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef ZLIB_DEBUG
- s->bits_sent = (s->bits_sent + 7) & ~7;
-#endif
-}
diff --git a/Utilities/cmzlib/uncompr.c b/Utilities/cmzlib/uncompr.c
index f9532f4..5e25666 100644
--- a/Utilities/cmzlib/uncompr.c
+++ b/Utilities/cmzlib/uncompr.c
@@ -24,12 +24,8 @@
Z_DATA_ERROR if the input data was corrupted, including if the input data is
an incomplete zlib stream.
*/
-int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong *sourceLen;
-{
+int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong *sourceLen) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
@@ -83,11 +79,7 @@ int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
err;
}
-int ZEXPORT uncompress(dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
+int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
+ uLong sourceLen) {
return uncompress2(dest, destLen, source, &sourceLen);
}
diff --git a/Utilities/cmzlib/zconf.h b/Utilities/cmzlib/zconf.h
index fe4ec59..3247b08 100644
--- a/Utilities/cmzlib/zconf.h
+++ b/Utilities/cmzlib/zconf.h
@@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -243,7 +243,11 @@
#endif
#ifdef Z_SOLO
- typedef unsigned long z_size_t;
+# ifdef _WIN64
+ typedef unsigned long long z_size_t;
+# else
+ typedef unsigned long z_size_t;
+# endif
#else
# define z_longlong long long
# if defined(NO_SIZE_T)
@@ -298,14 +302,6 @@
# endif
#endif
-#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
-#endif
-
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
@@ -522,7 +518,7 @@ typedef uLong FAR uLongf;
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
-# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
+# if defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
diff --git a/Utilities/cmzlib/zlib.h b/Utilities/cmzlib/zlib.h
index 808ae68..43c5f2f 100644
--- a/Utilities/cmzlib/zlib.h
+++ b/Utilities/cmzlib/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.13, October 13th, 2022
+ version 1.3.1, January 22nd, 2024
- Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
+ Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -37,11 +37,11 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.2.13"
-#define ZLIB_VERNUM 0x12d0
+#define ZLIB_VERSION "1.3.1"
+#define ZLIB_VERNUM 0x1310
#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 13
+#define ZLIB_VER_MINOR 3
+#define ZLIB_VER_REVISION 1
#define ZLIB_VER_SUBREVISION 0
/*
@@ -78,8 +78,8 @@ extern "C" {
even in the case of corrupted input.
*/
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
+typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
+typedef void (*free_func)(voidpf opaque, voidpf address);
struct internal_state;
@@ -217,7 +217,7 @@ typedef gz_header FAR *gz_headerp;
/* basic functions */
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+ZEXTERN const char * ZEXPORT zlibVersion(void);
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is not
compatible with the zlib.h header file used by the application. This check
@@ -225,12 +225,12 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void));
*/
/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. If
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
- allocation functions.
+ allocation functions. total_in, total_out, adler, and msg are initialized.
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
1 gives best speed, 9 gives best compression, 0 gives no compression at all
@@ -247,7 +247,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
/*
deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
@@ -320,8 +320,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
with the same value of the flush parameter and more output space (updated
avail_out), until the flush is complete (deflate returns with non-zero
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
+ avail_out is greater than six when the flush marker begins, in order to avoid
+ repeated flush markers upon calling deflate() again when avail_out == 0.
If the parameter flush is set to Z_FINISH, pending input is processed,
pending output is flushed and deflate returns with Z_STREAM_END if there was
@@ -360,7 +360,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
*/
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateEnd(z_streamp strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
@@ -375,7 +375,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
@@ -383,7 +383,8 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
read or consumed. The allocation of a sliding window will be deferred to
the first call of inflate (if the decompression does not complete on the
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
- them to use default allocation functions.
+ them to use default allocation functions. total_in, total_out, adler, and
+ msg are initialized.
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -397,7 +398,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
*/
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce
@@ -517,7 +518,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
*/
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateEnd(z_streamp strm);
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any pending
@@ -535,12 +536,12 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
*/
/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
+ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
+ int level,
+ int method,
+ int windowBits,
+ int memLevel,
+ int strategy);
This is another version of deflateInit with more compression options. The
fields zalloc, zfree and opaque must be initialized before by the caller.
@@ -607,9 +608,9 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength);
/*
Initializes the compression dictionary from the given byte sequence
without producing any compressed output. When using the zlib format, this
@@ -651,9 +652,9 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
not perform any compression: this will be done by deflate().
*/
-ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
+ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength);
/*
Returns the sliding dictionary being maintained by deflate. dictLength is
set to the number of bytes in the dictionary, and that many bytes are copied
@@ -673,8 +674,8 @@ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
stream state is inconsistent.
*/
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
+ZEXTERN int ZEXPORT deflateCopy(z_streamp dest,
+ z_streamp source);
/*
Sets the destination stream as a complete copy of the source stream.
@@ -691,20 +692,20 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
destination.
*/
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
/*
This function is equivalent to deflateEnd followed by deflateInit, but
does not free and reallocate the internal compression state. The stream
will leave the compression level and any other attributes that may have been
- set unchanged.
+ set unchanged. total_in, total_out, adler, and msg are initialized.
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
+ZEXTERN int ZEXPORT deflateParams(z_streamp strm,
+ int level,
+ int strategy);
/*
Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2(). This can be
@@ -729,7 +730,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
Then no more input data should be provided before the deflateParams() call.
If this is done, the old level and strategy will be applied to the data
compressed before deflateParams(), and the new level and strategy will be
- applied to the the data compressed after deflateParams().
+ applied to the data compressed after deflateParams().
deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
@@ -740,11 +741,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
retried with more output space.
*/
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
+ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
+ int good_length,
+ int max_lazy,
+ int nice_length,
+ int max_chain);
/*
Fine tune deflate's internal compression parameters. This should only be
used by someone who understands the algorithm used by zlib's deflate for
@@ -757,8 +758,8 @@ ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
*/
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
+ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
+ uLong sourceLen);
/*
deflateBound() returns an upper bound on the compressed size after
deflation of sourceLen bytes. It must be called after deflateInit() or
@@ -772,9 +773,9 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
than Z_FINISH or Z_NO_FLUSH are used.
*/
-ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
- unsigned *pending,
- int *bits));
+ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
+ unsigned *pending,
+ int *bits);
/*
deflatePending() returns the number of bytes and bits of output that have
been generated, but not yet provided in the available output. The bytes not
@@ -787,9 +788,9 @@ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ZEXTERN int ZEXPORT deflatePrime(z_streamp strm,
+ int bits,
+ int value);
/*
deflatePrime() inserts bits in the deflate output stream. The intent
is that this function is used to start off the deflate output with the bits
@@ -804,8 +805,8 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
+ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
+ gz_headerp head);
/*
deflateSetHeader() provides gzip header information for when a gzip
stream is requested by deflateInit2(). deflateSetHeader() may be called
@@ -821,16 +822,17 @@ ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
gzip file" and give up.
If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
+ the time set to zero, and os set to the current operating system, with no
+ extra, name, or comment fields. The gzip header is returned to the default
+ state by deflateReset().
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
+ZEXTERN int ZEXPORT inflateInit2(z_streamp strm,
+ int windowBits);
This is another version of inflateInit with an extra parameter. The
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
@@ -883,9 +885,9 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
deferred until inflate() is called.
*/
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
+ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm,
+ const Bytef *dictionary,
+ uInt dictLength);
/*
Initializes the decompression dictionary from the given uncompressed byte
sequence. This function must be called immediately after a call of inflate,
@@ -906,9 +908,9 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
inflate().
*/
-ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
- Bytef *dictionary,
- uInt *dictLength));
+ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm,
+ Bytef *dictionary,
+ uInt *dictLength);
/*
Returns the sliding dictionary being maintained by inflate. dictLength is
set to the number of bytes in the dictionary, and that many bytes are copied
@@ -921,7 +923,7 @@ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
stream state is inconsistent.
*/
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
/*
Skips invalid compressed data until a possible full flush point (see above
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -934,14 +936,14 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
inflateSync returns Z_OK if a possible full flush point has been found,
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
- In the success case, the application may save the current current value of
- total_in which indicates where valid compressed data was found. In the
- error case, the application may repeatedly call inflateSync, providing more
- input each time, until success or end of the input data.
+ In the success case, the application may save the current value of total_in
+ which indicates where valid compressed data was found. In the error case,
+ the application may repeatedly call inflateSync, providing more input each
+ time, until success or end of the input data.
*/
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
+ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
+ z_streamp source);
/*
Sets the destination stream as a complete copy of the source stream.
@@ -956,18 +958,19 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
destination.
*/
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate the internal decompression state. The
stream will keep attributes that may have been set by inflateInit2.
+ total_in, total_out, adler, and msg are initialized.
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent (such as zalloc or state being Z_NULL).
*/
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
- int windowBits));
+ZEXTERN int ZEXPORT inflateReset2(z_streamp strm,
+ int windowBits);
/*
This function is the same as inflateReset, but it also permits changing
the wrap and window size requests. The windowBits parameter is interpreted
@@ -980,9 +983,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
the windowBits parameter is invalid.
*/
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
+ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
+ int bits,
+ int value);
/*
This function inserts bits in the inflate input stream. The intent is
that this function is used to start inflating at a bit position in the
@@ -1001,7 +1004,7 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
stream state was inconsistent.
*/
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
+ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
/*
This function returns two values, one in the lower 16 bits of the return
value, and the other in the remaining upper bits, obtained by shifting the
@@ -1029,8 +1032,8 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
source stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
+ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
+ gz_headerp head);
/*
inflateGetHeader() requests that gzip header information be stored in the
provided gz_header structure. inflateGetHeader() may be called after
@@ -1070,8 +1073,8 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
*/
/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
+ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits,
+ unsigned char FAR *window);
Initialize the internal stream state for decompression using inflateBack()
calls. The fields zalloc, zfree and opaque in strm must be initialized
@@ -1091,13 +1094,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
the version of the header file.
*/
-typedef unsigned (*in_func) OF((void FAR *,
- z_const unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+typedef unsigned (*in_func)(void FAR *,
+ z_const unsigned char FAR * FAR *);
+typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned);
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
+ZEXTERN int ZEXPORT inflateBack(z_streamp strm,
+ in_func in, void FAR *in_desc,
+ out_func out, void FAR *out_desc);
/*
inflateBack() does a raw inflate with a single call using a call-back
interface for input and output. This is potentially more efficient than
@@ -1165,7 +1168,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
cannot return Z_OK.
*/
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm);
/*
All memory allocated by inflateBackInit() is freed.
@@ -1173,7 +1176,7 @@ ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
state was inconsistent.
*/
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
/* Return flags indicating compile-time options.
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
@@ -1226,8 +1229,8 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
you need special options.
*/
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen);
/*
Compresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1241,9 +1244,9 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
buffer.
*/
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
+ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen,
+ int level);
/*
Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -1257,15 +1260,15 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
/*
compressBound() returns an upper bound on the compressed size after
compress() or compress2() on sourceLen bytes. It would be used before a
compress() or compress2() call to allocate the destination buffer.
*/
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
+ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen);
/*
Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total size
@@ -1282,8 +1285,8 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
buffer with the uncompressed data up to that point.
*/
-ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong *sourceLen));
+ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong *sourceLen);
/*
Same as uncompress, except that sourceLen is a pointer, where the
length of the source is *sourceLen. On return, *sourceLen is the number of
@@ -1302,7 +1305,7 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
Open the gzip (.gz) file at path for reading and decompressing, or
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
@@ -1339,7 +1342,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
file could not be opened.
*/
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
/*
Associate a gzFile with the file descriptor fd. File descriptors are
obtained from calls like open, dup, creat, pipe or fileno (if the file has
@@ -1362,7 +1365,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
will not detect if fd is invalid (unless fd is -1).
*/
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
+ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size);
/*
Set the internal buffer size used by this library's functions for file to
size. The default buffer size is 8192 bytes. This function must be called
@@ -1378,7 +1381,7 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
too late.
*/
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy);
/*
Dynamically update the compression level and strategy for file. See the
description of deflateInit2 for the meaning of these parameters. Previously
@@ -1389,7 +1392,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
or Z_MEM_ERROR if there is a memory allocation error.
*/
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
/*
Read and decompress up to len uncompressed bytes from file into buf. If
the input file is not in gzip format, gzread copies the given number of
@@ -1419,8 +1422,8 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
Z_STREAM_ERROR.
*/
-ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
- gzFile file));
+ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
+ gzFile file);
/*
Read and decompress up to nitems items of size size from file into buf,
otherwise operating as gzread() does. This duplicates the interface of
@@ -1445,14 +1448,14 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
file, resetting and retrying on end-of-file, when size is not 1.
*/
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
+ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
/*
Compress and write the len uncompressed bytes at buf to file. gzwrite
returns the number of uncompressed bytes written or 0 in case of error.
*/
-ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
- z_size_t nitems, gzFile file));
+ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
+ z_size_t nitems, gzFile file);
/*
Compress and write nitems items of size size from buf to file, duplicating
the interface of stdio's fwrite(), with size_t request and return types. If
@@ -1465,7 +1468,7 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
is returned, and the error state is set to Z_STREAM_ERROR.
*/
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
/*
Convert, format, compress, and write the arguments (...) to file under
control of the string format, as in fprintf. gzprintf returns the number of
@@ -1480,7 +1483,7 @@ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
This can be determined using zlibCompileFlags().
*/
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
/*
Compress and write the given null-terminated string s to file, excluding
the terminating null character.
@@ -1488,7 +1491,7 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
gzputs returns the number of characters written, or -1 in case of error.
*/
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
/*
Read and decompress bytes from file into buf, until len-1 characters are
read, or until a newline character is read and transferred to buf, or an
@@ -1502,13 +1505,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
buf are indeterminate.
*/
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
/*
Compress and write c, converted to an unsigned char, into file. gzputc
returns the value that was written, or -1 in case of error.
*/
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+ZEXTERN int ZEXPORT gzgetc(gzFile file);
/*
Read and decompress one byte from file. gzgetc returns this byte or -1
in case of end of file or error. This is implemented as a macro for speed.
@@ -1517,7 +1520,7 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
points to has been clobbered or not.
*/
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
/*
Push c back onto the stream for file to be read as the first character on
the next read. At least one character of push-back is always allowed.
@@ -1529,7 +1532,7 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
gzseek() or gzrewind().
*/
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
/*
Flush all pending output to file. The parameter flush is as in the
deflate() function. The return value is the zlib error number (see function
@@ -1545,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
*/
/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
+ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
+ z_off_t offset, int whence);
Set the starting position to offset relative to whence for the next gzread
or gzwrite on file. The offset represents a number of bytes in the
@@ -1564,7 +1567,7 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
would be before the current position.
*/
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
+ZEXTERN int ZEXPORT gzrewind(gzFile file);
/*
Rewind file. This function is supported only for reading.
@@ -1572,7 +1575,7 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
*/
/*
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
+ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
Return the starting position for the next gzread or gzwrite on file.
This position represents a number of bytes in the uncompressed data stream,
@@ -1583,7 +1586,7 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
*/
/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
+ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file);
Return the current compressed (actual) read or write offset of file. This
offset includes the count of bytes that precede the gzip stream, for example
@@ -1592,7 +1595,7 @@ ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
be used for a progress indicator. On error, gzoffset() returns -1.
*/
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+ZEXTERN int ZEXPORT gzeof(gzFile file);
/*
Return true (1) if the end-of-file indicator for file has been set while
reading, false (0) otherwise. Note that the end-of-file indicator is set
@@ -1607,7 +1610,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
has grown since the previous end of file was detected.
*/
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+ZEXTERN int ZEXPORT gzdirect(gzFile file);
/*
Return true (1) if file is being copied directly while reading, or false
(0) if file is a gzip stream being decompressed.
@@ -1628,7 +1631,7 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
gzip file reading and decompression, which may not be desired.)
*/
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose(gzFile file);
/*
Flush all pending output for file, if necessary, close file and
deallocate the (de)compression state. Note that once file is closed, you
@@ -1641,8 +1644,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
last read ended in the middle of a gzip stream, or Z_OK on success.
*/
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose_r(gzFile file);
+ZEXTERN int ZEXPORT gzclose_w(gzFile file);
/*
Same as gzclose(), but gzclose_r() is only for use when reading, and
gzclose_w() is only for use when writing or appending. The advantage to
@@ -1653,7 +1656,7 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
zlib library.
*/
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
/*
Return the error message for the last error which occurred on file.
errnum is set to zlib error number. If an error occurred in the file system
@@ -1669,7 +1672,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
functions above that do not distinguish those cases in their return values.
*/
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+ZEXTERN void ZEXPORT gzclearerr(gzFile file);
/*
Clear the error and end-of-file flags for file. This is analogous to the
clearerr() function in stdio. This is useful for continuing to read a gzip
@@ -1686,7 +1689,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
library.
*/
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
return the updated checksum. An Adler-32 value is in the range of a 32-bit
@@ -1706,15 +1709,15 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error();
*/
-ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
- z_size_t len));
+ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
+ z_size_t len);
/*
Same as adler32(), but with a size_t length.
*/
/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
+ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2,
+ z_off_t len2);
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
@@ -1724,7 +1727,7 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
negative, the result has no meaning or utility.
*/
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
+ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
@@ -1742,30 +1745,30 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
if (crc != original_crc) error();
*/
-ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
- z_size_t len));
+ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
+ z_size_t len);
/*
Same as crc32(), but with a size_t length.
*/
/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
+ len2. len2 must be non-negative.
*/
/*
-ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
+ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
Return the operator corresponding to length len2, to be used with
- crc32_combine_op().
+ crc32_combine_op(). len2 must be non-negative.
*/
-ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
+ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
/*
Give the same result as crc32_combine(), using op in place of len2. op is
is generated from len2 by crc32_combine_gen(). This will be faster than
@@ -1778,20 +1781,20 @@ ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
+ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateInit_(z_streamp strm,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
+ int windowBits, int memLevel,
+ int strategy, const char *version,
+ int stream_size);
+ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
+ const char *version, int stream_size);
+ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
+ unsigned char FAR *window,
+ const char *version,
+ int stream_size);
#ifdef Z_PREFIX_SET
# define z_deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
@@ -1850,7 +1853,7 @@ struct gzFile_s {
unsigned char *next;
z_off64_t pos;
};
-ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
+ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
#ifdef Z_PREFIX_SET
# undef z_gzgetc
# define z_gzgetc(g) \
@@ -1871,13 +1874,13 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
* without large file support, _LFS64_LARGEFILE must also be true
*/
#ifdef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
+ ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
#endif
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
@@ -1899,50 +1902,50 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
# define crc32_combine_gen crc32_combine_gen64
# endif
# ifndef Z_LARGE64
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
+ ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
+ ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
+ ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
# endif
#else
- ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
+ ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
+ ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
+ ZEXTERN z_off_t ZEXPORT gztell(gzFile);
+ ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
+ ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
#endif
#else /* Z_SOLO */
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
+ ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
#endif /* !Z_SOLO */
/* undocumented functions */
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
-ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
-ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
-ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
-ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
-ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
+ZEXTERN const char * ZEXPORT zError(int);
+ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
+ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
+ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
+ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
+ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp);
+ZEXTERN int ZEXPORT inflateResetKeep(z_streamp);
+ZEXTERN int ZEXPORT deflateResetKeep(z_streamp);
#if defined(_WIN32) && !defined(Z_SOLO)
-ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
- const char *mode));
+ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path,
+ const char *mode);
#endif
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifndef Z_SOLO
-ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
- const char *format,
- va_list va));
+ZEXTERN int ZEXPORTVA gzvprintf(gzFile file,
+ const char *format,
+ va_list va);
# endif
#endif
diff --git a/Utilities/cmzlib/zutil.c b/Utilities/cmzlib/zutil.c
index 9543ae8..b1c5d2d 100644
--- a/Utilities/cmzlib/zutil.c
+++ b/Utilities/cmzlib/zutil.c
@@ -24,13 +24,11 @@ z_const char * const z_errmsg[10] = {
};
-const char * ZEXPORT zlibVersion()
-{
+const char * ZEXPORT zlibVersion(void) {
return ZLIB_VERSION;
}
-uLong ZEXPORT zlibCompileFlags()
-{
+uLong ZEXPORT zlibCompileFlags(void) {
uLong flags;
flags = 0;
@@ -121,9 +119,7 @@ uLong ZEXPORT zlibCompileFlags()
# endif
int ZLIB_INTERNAL z_verbose = verbose;
-void ZLIB_INTERNAL z_error(m)
- char *m;
-{
+void ZLIB_INTERNAL z_error(char *m) {
fprintf(stderr, "%s\n", m);
exit(1);
}
@@ -132,9 +128,7 @@ void ZLIB_INTERNAL z_error(m)
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
-const char * ZEXPORT zError(err)
- int err;
-{
+const char * ZEXPORT zError(int err) {
return ERR_MSG(err);
}
@@ -148,22 +142,14 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
-void ZLIB_INTERNAL zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
+void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) {
if (len == 0) return;
do {
*dest++ = *source++; /* ??? to be unrolled */
} while (--len != 0);
}
-int ZLIB_INTERNAL zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
+int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) {
uInt j;
for (j = 0; j < len; j++) {
@@ -172,10 +158,7 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
return 0;
}
-void ZLIB_INTERNAL zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
+void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) {
if (len == 0) return;
do {
*dest++ = 0; /* ??? to be unrolled */
@@ -216,8 +199,7 @@ local ptr_table table[MAX_PTR];
* a protected system like OS/2. Use Microsoft C instead.
*/
-voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
voidpf buf;
ulg bsize = (ulg)items*size;
@@ -242,8 +224,7 @@ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size)
return buf;
}
-void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
int n;
(void)opaque;
@@ -279,14 +260,12 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
# define _hfree hfree
#endif
-voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size)
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, uInt items, uInt size) {
(void)opaque;
return _halloc((long)items, size);
}
-void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
_hfree(ptr);
}
@@ -299,25 +278,18 @@ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr)
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
+extern voidp malloc(uInt size);
+extern voidp calloc(uInt items, uInt size);
+extern void free(voidpf ptr);
#endif
-voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
+voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
(void)opaque;
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size);
}
-void ZLIB_INTERNAL zcfree(opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
+void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
(void)opaque;
free(ptr);
}
diff --git a/Utilities/cmzlib/zutil.h b/Utilities/cmzlib/zutil.h
index 8939d1d..6cf07e7 100644
--- a/Utilities/cmzlib/zutil.h
+++ b/Utilities/cmzlib/zutil.h
@@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -56,7 +56,7 @@ typedef unsigned long ulg;
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
+#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
#define ERR_RETURN(strm,err) \
return (strm->msg = ERR_MSG(err), (err))
@@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# endif
#endif
-#if defined(MACOS) || defined(TARGET_OS_MAC)
+#if defined(MACOS)
# define OS_CODE 7
-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-# endif
#endif
#ifdef __acorn
@@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 19
#endif
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
#if defined(_MSC_VER)
#pragma warning ( disable : 4127 ) /* cond expr is constant */
#pragma warning ( disable : 4131 ) /* old style declaration */
@@ -197,9 +176,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
+ ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
#endif
/* common defaults */
@@ -238,16 +217,16 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
+ void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
+ int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
+ void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
#endif
/* Diagnostic functions */
#ifdef ZLIB_DEBUG
# include <stdio.h>
extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error OF((char *m));
+ extern void ZLIB_INTERNAL z_error(char *m);
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
@@ -264,9 +243,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
#ifndef Z_SOLO
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
+ voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items,
+ unsigned size);
+ void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr);
#endif
#define ZALLOC(strm, items, size) \
diff --git a/Utilities/cmzstd/CMakeLists.txt b/Utilities/cmzstd/CMakeLists.txt
index 981e3d5..e8bee76 100644
--- a/Utilities/cmzstd/CMakeLists.txt
+++ b/Utilities/cmzstd/CMakeLists.txt
@@ -44,7 +44,12 @@ add_library(cmzstd STATIC
lib/dictBuilder/zdict.c
)
-# BMI2 instructions are not supported in older environments.
-set_property(TARGET cmzstd PROPERTY COMPILE_DEFINITIONS DYNAMIC_BMI2=0)
+target_compile_definitions(cmzstd PRIVATE
+ # BMI2 instructions are not supported in older environments.
+ DYNAMIC_BMI2=0
+ # Explicitly disable ASM build to work with more compilers.
+ # Our vendored zstd does not include the assembly language file.
+ ZSTD_DISABLE_ASM=1
+ )
install(FILES LICENSE DESTINATION ${CMAKE_DOC_DIR}/cmzstd)
diff --git a/Utilities/cmzstd/LICENSE b/Utilities/cmzstd/LICENSE
index a793a80..7580028 100644
--- a/Utilities/cmzstd/LICENSE
+++ b/Utilities/cmzstd/LICENSE
@@ -2,7 +2,7 @@ BSD License
For Zstandard software
-Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -14,9 +14,9 @@ are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- * Neither the name Facebook nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
+ * Neither the name Facebook, nor Meta, nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
diff --git a/Utilities/cmzstd/README.md b/Utilities/cmzstd/README.md
index dcca766..f91e68f 100644
--- a/Utilities/cmzstd/README.md
+++ b/Utilities/cmzstd/README.md
@@ -4,23 +4,21 @@ __Zstandard__, or `zstd` as short version, is a fast lossless compression algori
targeting real-time compression scenarios at zlib-level and better compression ratios.
It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy).
-The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
+Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available.
+This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files.
Should your project require another programming language,
-a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages).
+a list of known ports and bindings is provided on [Zstandard homepage](https://facebook.github.io/zstd/#other-languages).
**Development branch status:**
[![Build Status][travisDevBadge]][travisLink]
-[![Build status][AppveyorDevBadge]][AppveyorLink]
[![Build status][CircleDevBadge]][CircleLink]
[![Build status][CirrusDevBadge]][CirrusLink]
[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink]
-[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
-[travisLink]: https://travis-ci.org/facebook/zstd
-[AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite"
-[AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0
+[travisDevBadge]: https://api.travis-ci.com/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
+[travisLink]: https://travis-ci.com/facebook/zstd
[CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite"
[CircleLink]: https://circleci.com/gh/facebook/zstd
[CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev
@@ -31,37 +29,36 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww
## Benchmarks
For reference, several fast compression algorithms were tested and compared
-on a server running Arch Linux (`Linux version 5.5.11-arch1-1`),
-with a Core i9-9900K CPU @ 5.0GHz,
+on a desktop running Ubuntu 20.04 (`Linux 5.11.0-41-generic`),
+with a Core i7-9700K CPU @ 4.9GHz,
using [lzbench], an open-source in-memory benchmark by @inikep
compiled with [gcc] 9.3.0,
on the [Silesia compression corpus].
[lzbench]: https://github.com/inikep/lzbench
-[Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
+[Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia
[gcc]: https://gcc.gnu.org/
| Compressor name | Ratio | Compression| Decompress.|
| --------------- | ------| -----------| ---------- |
-| **zstd 1.4.5 -1** | 2.884 | 500 MB/s | 1660 MB/s |
-| zlib 1.2.11 -1 | 2.743 | 90 MB/s | 400 MB/s |
-| brotli 1.0.7 -0 | 2.703 | 400 MB/s | 450 MB/s |
-| **zstd 1.4.5 --fast=1** | 2.434 | 570 MB/s | 2200 MB/s |
-| **zstd 1.4.5 --fast=3** | 2.312 | 640 MB/s | 2300 MB/s |
-| quicklz 1.5.0 -1 | 2.238 | 560 MB/s | 710 MB/s |
-| **zstd 1.4.5 --fast=5** | 2.178 | 700 MB/s | 2420 MB/s |
-| lzo1x 2.10 -1 | 2.106 | 690 MB/s | 820 MB/s |
-| lz4 1.9.2 | 2.101 | 740 MB/s | 4530 MB/s |
-| **zstd 1.4.5 --fast=7** | 2.096 | 750 MB/s | 2480 MB/s |
-| lzf 3.6 -1 | 2.077 | 410 MB/s | 860 MB/s |
-| snappy 1.1.8 | 2.073 | 560 MB/s | 1790 MB/s |
-
-[zlib]: http://www.zlib.net/
-[LZ4]: http://www.lz4.org/
+| **zstd 1.5.1 -1** | 2.887 | 530 MB/s | 1700 MB/s |
+| [zlib] 1.2.11 -1 | 2.743 | 95 MB/s | 400 MB/s |
+| brotli 1.0.9 -0 | 2.702 | 395 MB/s | 450 MB/s |
+| **zstd 1.5.1 --fast=1** | 2.437 | 600 MB/s | 2150 MB/s |
+| **zstd 1.5.1 --fast=3** | 2.239 | 670 MB/s | 2250 MB/s |
+| quicklz 1.5.0 -1 | 2.238 | 540 MB/s | 760 MB/s |
+| **zstd 1.5.1 --fast=4** | 2.148 | 710 MB/s | 2300 MB/s |
+| lzo1x 2.10 -1 | 2.106 | 660 MB/s | 845 MB/s |
+| [lz4] 1.9.3 | 2.101 | 740 MB/s | 4500 MB/s |
+| lzf 3.6 -1 | 2.077 | 410 MB/s | 830 MB/s |
+| snappy 1.1.9 | 2.073 | 550 MB/s | 1750 MB/s |
+
+[zlib]: https://www.zlib.net/
+[lz4]: https://lz4.github.io/lz4/
The negative compression levels, specified with `--fast=#`,
-offer faster compression and decompression speed in exchange for some loss in
-compression ratio compared to level 1, as seen in the table above.
+offer faster compression and decompression speed
+at the cost of compression ratio (compared to level 1).
Zstd can also offer stronger compression ratios at the cost of compression speed.
Speed vs Compression trade-off is configurable by small increments.
@@ -124,14 +121,27 @@ Dictionary gains are mostly effective in the first few KB. Then, the compression
## Build instructions
+`make` is the officially maintained build system of this project.
+All other build systems are "compatible" and 3rd-party maintained,
+they may feature small differences in advanced options.
+When your system allows it, prefer using `make` to build `zstd` and `libzstd`.
+
### Makefile
If your system is compatible with standard `make` (or `gmake`),
invoking `make` in root directory will generate `zstd` cli in root directory.
+It will also create `libzstd` into `lib/`.
Other available options include:
- `make install` : create and install zstd cli, library and man pages
-- `make check` : create and run `zstd`, tests its behavior on local platform
+- `make check` : create and run `zstd`, test its behavior on local platform
+
+The `Makefile` follows the [GNU Standard Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html),
+allowing staged install, standard flags, directory variables and command variables.
+
+For advanced use cases, specialized compilation flags which control binary generation
+are documented in [`lib/README.md`](lib/README.md#modular-build) for the `libzstd` library
+and in [`programs/README.md`](programs/README.md#compilation-variables) for the `zstd` CLI.
### cmake
@@ -141,6 +151,18 @@ to create `zstd` binary, and `libzstd` dynamic and static libraries.
By default, `CMAKE_BUILD_TYPE` is set to `Release`.
+#### Support for Fat (Universal2) Output
+
+`zstd` can be built and installed with support for both Apple Silicon (M1/M2) as well as Intel by using CMake's Universal2 support.
+To perform a Fat/Universal2 build and install use the following commands:
+
+```bash
+cmake -B build-cmake-debug -S build/cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h;arm64"
+cd build-cmake-debug
+ninja
+sudo ninja install
+```
+
### Meson
A Meson project is provided within [`build/meson`](build/meson). Follow
@@ -178,13 +200,15 @@ The output binary will be in `buck-out/gen/programs/`.
## Testing
-You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory.
-Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the zstd and datagen binary.
-For information on CI testing, please refer to TESTING.md
+You can run quick local smoke tests by running `make check`.
+If you can't use `make`, execute the `playTest.sh` script from the `src/tests` directory.
+Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the `zstd` and `datagen` binary.
+For information on CI testing, please refer to `TESTING.md`.
## Status
-Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases.
+Zstandard is currently deployed within Facebook and many other large cloud infrastructures.
+It is run continuously to compress large amounts of data in multiple formats and use cases.
Zstandard is considered safe for production environments.
## License
diff --git a/Utilities/cmzstd/lib/common/allocations.h b/Utilities/cmzstd/lib/common/allocations.h
new file mode 100644